Re: [PATCH v2 16/20] fsnotify: generalize fsnotify_detach_connector_from_object()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu 05-04-18 16:18:17, Amir Goldstein wrote:
> Use helper fsnotify_connector_obj() helper to reduce object type
> dependent code.
> 
> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>

So up to this patch I had only minor comments so once you address them
could you please send these preparatory cleanups, I'll go through them and
can then queue them up for 4.18-rc1? I like them and I think they are
worthwhile cleanups regardless of the new watch type so we don't need to
delay them more than necessary...

								Honza

> ---
>  fs/notify/mark.c                 | 21 ++++++++-------------
>  include/linux/fsnotify_backend.h |  1 +
>  2 files changed, 9 insertions(+), 13 deletions(-)
> 
> diff --git a/fs/notify/mark.c b/fs/notify/mark.c
> index 53bacbce1145..3b19ed700ac3 100644
> --- a/fs/notify/mark.c
> +++ b/fs/notify/mark.c
> @@ -177,19 +177,14 @@ static void fsnotify_connector_destroy_workfn(struct work_struct *work)
>  static struct inode *fsnotify_detach_connector_from_object(
>  					struct fsnotify_mark_connector *conn)
>  {
> -	struct inode *inode = NULL;
> -
> -	if (conn->type == FSNOTIFY_OBJ_TYPE_INODE) {
> -		inode = conn->inode;
> -		rcu_assign_pointer(inode->i_fsnotify.marks, NULL);
> -		inode->i_fsnotify.mask = 0;
> -		conn->inode = NULL;
> -		conn->type = FSNOTIFY_OBJ_TYPE_DETACHED;
> -	} else if (conn->type == FSNOTIFY_OBJ_TYPE_VFSMOUNT) {
> -		rcu_assign_pointer(real_mount(conn->mnt)->mnt_fsnotify.marks,
> -				   NULL);
> -		real_mount(conn->mnt)->mnt_fsnotify.mask = 0;
> -		conn->mnt = NULL;
> +	struct fsnotify_obj *obj = fsnotify_connector_obj(conn);
> +	struct inode *inode = (conn->type == FSNOTIFY_OBJ_TYPE_INODE) ?
> +			      conn->inode : NULL;
> +
> +	if (obj) {
> +		rcu_assign_pointer(obj->marks, NULL);
> +		obj->mask = 0;
> +		conn->object = NULL;
>  		conn->type = FSNOTIFY_OBJ_TYPE_DETACHED;
>  	}
>  
> diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
> index 9a908b96909e..abbd7311077f 100644
> --- a/include/linux/fsnotify_backend.h
> +++ b/include/linux/fsnotify_backend.h
> @@ -275,6 +275,7 @@ struct fsnotify_mark_connector {
>  	spinlock_t lock;
>  	unsigned int type;	/* Type of object [lock] */
>  	union {	/* Object pointer [lock] */
> +		void *object;
>  		struct inode *inode;
>  		struct vfsmount *mnt;
>  	};
> -- 
> 2.7.4
> 
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux