diff mbox series

[1/4] fsnotify: replace igrab() with ihold() on attach connector

Message ID 20210803180344.2398374-2-amir73il@gmail.com (mailing list archive)
State New, archived
Headers show
Series Performance optimization for no fsnotify marks | expand

Commit Message

Amir Goldstein Aug. 3, 2021, 6:03 p.m. UTC
We must have a reference on inode, so ihold is cheaper.

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

Comments

Matthew Bobrowski Aug. 10, 2021, 5:39 a.m. UTC | #1
On Tue, Aug 03, 2021 at 09:03:41PM +0300, Amir Goldstein wrote:
> We must have a reference on inode, so ihold is cheaper.
> 
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>

LGTM.

Reviewed-by: Matthew Bobrowski <repnop@google.com>

> ---
>  fs/notify/mark.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/notify/mark.c b/fs/notify/mark.c
> index d32ab349db74..80459db58f63 100644
> --- a/fs/notify/mark.c
> +++ b/fs/notify/mark.c
> @@ -493,8 +493,11 @@ static int fsnotify_attach_connector_to_object(fsnotify_connp_t *connp,
>  		conn->fsid.val[0] = conn->fsid.val[1] = 0;
>  		conn->flags = 0;
>  	}
> -	if (conn->type == FSNOTIFY_OBJ_TYPE_INODE)
> -		inode = igrab(fsnotify_conn_inode(conn));
> +	if (conn->type == FSNOTIFY_OBJ_TYPE_INODE) {
> +		inode = fsnotify_conn_inode(conn);
> +		ihold(inode);
> +	}
> +
>  	/*
>  	 * cmpxchg() provides the barrier so that readers of *connp can see
>  	 * only initialized structure
> -- 
> 2.25.1
> 
/M
diff mbox series

Patch

diff --git a/fs/notify/mark.c b/fs/notify/mark.c
index d32ab349db74..80459db58f63 100644
--- a/fs/notify/mark.c
+++ b/fs/notify/mark.c
@@ -493,8 +493,11 @@  static int fsnotify_attach_connector_to_object(fsnotify_connp_t *connp,
 		conn->fsid.val[0] = conn->fsid.val[1] = 0;
 		conn->flags = 0;
 	}
-	if (conn->type == FSNOTIFY_OBJ_TYPE_INODE)
-		inode = igrab(fsnotify_conn_inode(conn));
+	if (conn->type == FSNOTIFY_OBJ_TYPE_INODE) {
+		inode = fsnotify_conn_inode(conn);
+		ihold(inode);
+	}
+
 	/*
 	 * cmpxchg() provides the barrier so that readers of *connp can see
 	 * only initialized structure