Re: [PATCH v2 14/20] fsnotify: pass object and object type to fsnotify_add_mark()

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

 



On Thu 05-04-18 16:18:15, Amir Goldstein wrote:
> diff --git a/fs/notify/mark.c b/fs/notify/mark.c
> index 112f54dceeef..ea6d97f5fc3b 100644
> --- a/fs/notify/mark.c
> +++ b/fs/notify/mark.c
> @@ -437,9 +437,9 @@ int fsnotify_compare_groups(struct fsnotify_group *a, struct fsnotify_group *b)
>  }
>  
>  static int fsnotify_attach_connector_to_object(struct fsnotify_obj *obj,
> -					       struct inode *inode,
> -					       struct vfsmount *mnt)
> +					       unsigned int type)
>  {
> +	struct inode *inode = NULL;
>  	struct fsnotify_mark_connector *conn;
>  
>  	conn = kmem_cache_alloc(fsnotify_mark_connector_cachep, GFP_KERNEL);
> @@ -447,13 +447,11 @@ static int fsnotify_attach_connector_to_object(struct fsnotify_obj *obj,
>  		return -ENOMEM;
>  	spin_lock_init(&conn->lock);
>  	INIT_HLIST_HEAD(&conn->list);
> -	if (inode) {
> -		conn->type = FSNOTIFY_OBJ_TYPE_INODE;
> -		conn->inode = igrab(inode);
> -	} else {
> -		conn->type = FSNOTIFY_OBJ_TYPE_VFSMOUNT;
> -		conn->mnt = mnt;
> -	}
> +	conn->type = type;
> +	if (conn->type == FSNOTIFY_OBJ_TYPE_INODE)
> +		inode = conn->inode = igrab(fsnotify_inode(obj));
> +	else if (conn->type == FSNOTIFY_OBJ_TYPE_VFSMOUNT)
> +		conn->mnt = fsnotify_vfsmount(obj);


How about making connector point to fsnotify_obj and then get real inode /
mount pointers only in those few places which need them (basically only for
grabbing inode references and dentry flag propagation AFAIR)? That should
make the code even less aware of different object types.

Also fsnotify_inode() and fsnotify_vfsmount() seem like too generic names.
I'd call them fsnotify_obj_inode() and fsnotify_obj_vfsmount().

								Honza
-- 
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