All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: Matthew Bobrowski <mbobrowski@mbobrowski.org>,
	linux-fsdevel@vger.kernel.org
Subject: [PATCH v2 04/16] fsnotify: remove unneeded refcounts of s_fsnotify_connectors
Date: Tue, 29 Mar 2022 10:48:52 +0300	[thread overview]
Message-ID: <20220329074904.2980320-5-amir73il@gmail.com> (raw)
In-Reply-To: <20220329074904.2980320-1-amir73il@gmail.com>

s_fsnotify_connectors is elevated for every inode mark in addition to
the refcount already taken by the inode connector.

This is a relic from s_fsnotify_inode_refs pre connector era.
Remove those unneeded recounts.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 fs/notify/mark.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/fs/notify/mark.c b/fs/notify/mark.c
index b1443e66ba26..698ed0a1a47e 100644
--- a/fs/notify/mark.c
+++ b/fs/notify/mark.c
@@ -169,21 +169,6 @@ static void fsnotify_connector_destroy_workfn(struct work_struct *work)
 	}
 }
 
-static void fsnotify_get_inode_ref(struct inode *inode)
-{
-	ihold(inode);
-	atomic_long_inc(&inode->i_sb->s_fsnotify_connectors);
-}
-
-static void fsnotify_put_inode_ref(struct inode *inode)
-{
-	struct super_block *sb = inode->i_sb;
-
-	iput(inode);
-	if (atomic_long_dec_and_test(&sb->s_fsnotify_connectors))
-		wake_up_var(&sb->s_fsnotify_connectors);
-}
-
 static void fsnotify_get_sb_connectors(struct fsnotify_mark_connector *conn)
 {
 	struct super_block *sb = fsnotify_connector_sb(conn);
@@ -245,7 +230,7 @@ static void fsnotify_drop_object(unsigned int type, void *objp)
 	/* Currently only inode references are passed to be dropped */
 	if (WARN_ON_ONCE(type != FSNOTIFY_OBJ_TYPE_INODE))
 		return;
-	fsnotify_put_inode_ref(objp);
+	iput(objp);
 }
 
 void fsnotify_put_mark(struct fsnotify_mark *mark)
@@ -519,7 +504,7 @@ static int fsnotify_attach_connector_to_object(fsnotify_connp_t *connp,
 	}
 	if (conn->type == FSNOTIFY_OBJ_TYPE_INODE) {
 		inode = fsnotify_conn_inode(conn);
-		fsnotify_get_inode_ref(inode);
+		ihold(inode);
 	}
 	fsnotify_get_sb_connectors(conn);
 
@@ -530,7 +515,7 @@ static int fsnotify_attach_connector_to_object(fsnotify_connp_t *connp,
 	if (cmpxchg(connp, NULL, conn)) {
 		/* Someone else created list structure for us */
 		if (inode)
-			fsnotify_put_inode_ref(inode);
+			iput(inode);
 		fsnotify_put_sb_connectors(conn);
 		kmem_cache_free(fsnotify_mark_connector_cachep, conn);
 	}
-- 
2.25.1


  parent reply	other threads:[~2022-03-29  7:49 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-29  7:48 [PATCH v2 00/16] Evictable fanotify marks Amir Goldstein
2022-03-29  7:48 ` [PATCH v2 01/16] inotify: show inotify mask flags in proc fdinfo Amir Goldstein
2022-04-05 12:40   ` Jan Kara
2022-04-05 12:43     ` Jan Kara
2022-03-29  7:48 ` [PATCH v2 02/16] inotify: move control flags from mask to mark flags Amir Goldstein
2022-03-29  7:48 ` [PATCH v2 03/16] fsnotify: pass flags argument to fsnotify_add_mark() via mark Amir Goldstein
2022-03-29  7:48 ` Amir Goldstein [this message]
2022-04-05 12:54   ` [PATCH v2 04/16] fsnotify: remove unneeded refcounts of s_fsnotify_connectors Jan Kara
2022-04-05 13:09     ` Amir Goldstein
2022-04-06 17:47       ` Jan Kara
2022-04-06 18:19         ` Amir Goldstein
2022-03-29  7:48 ` [PATCH v2 05/16] fsnotify: fix wrong lockdep annotations Amir Goldstein
2022-03-29  7:48 ` [PATCH v2 06/16] fsnotify: create helpers for group mark_mutex lock Amir Goldstein
2022-04-07 14:35   ` Jan Kara
2022-04-07 14:53     ` Amir Goldstein
2022-04-08  8:38       ` Amir Goldstein
2022-04-11 10:31         ` Jan Kara
2022-03-29  7:48 ` [PATCH v2 07/16] inotify: use fsnotify group lock helpers Amir Goldstein
2022-03-29  7:48 ` [PATCH v2 08/16] audit: " Amir Goldstein
2022-03-29  7:48 ` [PATCH v2 09/16] nfsd: " Amir Goldstein
2022-03-29  7:48 ` [PATCH v2 10/16] dnotify: " Amir Goldstein
2022-03-29  7:48 ` [PATCH v2 11/16] fsnotify: allow adding an inode mark without pinning inode Amir Goldstein
2022-03-29  7:49 ` [PATCH v2 12/16] fanotify: factor out helper fanotify_mark_update_flags() Amir Goldstein
2022-04-11 10:52   ` Jan Kara
2022-04-11 12:00     ` Amir Goldstein
2022-03-29  7:49 ` [PATCH v2 13/16] fanotify: implement "evictable" inode marks Amir Goldstein
2022-04-11 11:47   ` Jan Kara
2022-04-11 12:57     ` Amir Goldstein
2022-04-11 14:19       ` Jan Kara
2022-04-12  8:07         ` Amir Goldstein
2022-03-29  7:49 ` [PATCH v2 14/16] fanotify: add FAN_IOC_SET_MARK_PAGE_ORDER ioctl for testing Amir Goldstein
2022-04-11 12:53   ` Jan Kara
2022-04-11 13:07     ` Amir Goldstein
2022-03-29  7:49 ` [PATCH v2 15/16] fanotify: use fsnotify group lock helpers Amir Goldstein
2022-03-29  7:49 ` [PATCH v2 16/16] fanotify: enable "evictable" inode marks Amir Goldstein
2022-04-09 16:12 ` [PATCH v2 00/16] Evictable fanotify marks Amir Goldstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220329074904.2980320-5-amir73il@gmail.com \
    --to=amir73il@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mbobrowski@mbobrowski.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.