Re: [PATCH 07/21] set_default_d_op(): calculate the matching value for ->d_flags

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

 



On Mon, Feb 24, 2025 at 09:20:37PM +0000, Al Viro wrote:
> ... and store it in ->s_d_flags, to be used in __d_alloc()
> 
> Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> ---

Reviewed-by: Christian Brauner <brauner@xxxxxxxxxx>

>  fs/dcache.c        | 6 ++++--
>  include/linux/fs.h | 1 +
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/dcache.c b/fs/dcache.c
> index 1201149e1e2c..a4795617c3db 100644
> --- a/fs/dcache.c
> +++ b/fs/dcache.c
> @@ -1705,14 +1705,14 @@ static struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name)
>  	dentry->d_inode = NULL;
>  	dentry->d_parent = dentry;
>  	dentry->d_sb = sb;
> -	dentry->d_op = NULL;
> +	dentry->d_op = sb->__s_d_op;
> +	dentry->d_flags = sb->s_d_flags;
>  	dentry->d_fsdata = NULL;
>  	INIT_HLIST_BL_NODE(&dentry->d_hash);
>  	INIT_LIST_HEAD(&dentry->d_lru);
>  	INIT_HLIST_HEAD(&dentry->d_children);
>  	INIT_HLIST_NODE(&dentry->d_u.d_alias);
>  	INIT_HLIST_NODE(&dentry->d_sib);
> -	d_set_d_op(dentry, dentry->d_sb->__s_d_op);
>  
>  	if (dentry->d_op && dentry->d_op->d_init) {
>  		err = dentry->d_op->d_init(dentry);
> @@ -1850,7 +1850,9 @@ EXPORT_SYMBOL(d_set_d_op);
>  
>  void set_default_d_op(struct super_block *s, const struct dentry_operations *ops)
>  {
> +	unsigned int flags = d_op_flags(ops);
>  	s->__s_d_op = ops;
> +	s->s_d_flags = (s->s_d_flags & ~DCACHE_OP_FLAGS) | flags;
>  }
>  EXPORT_SYMBOL(set_default_d_op);
>  
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 23fd8b0d4e81..473a9de5fc8f 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -1392,6 +1392,7 @@ struct super_block {
>  	char			s_sysfs_name[UUID_STRING_LEN + 1];
>  
>  	unsigned int		s_max_links;
> +	unsigned int		s_d_flags;
>  
>  	/*
>  	 * The next field is for VFS *only*. No filesystems have any business
> -- 
> 2.39.5
> 




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

  Powered by Linux