diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2025-02-23 19:53:00 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2025-06-11 13:30:55 -0400 |
commit | 2fa8bf42c50582c7302918474aae8c52b59e7910 (patch) | |
tree | 57be62cc1b6eb370b46685e8d7b584d51269257c | |
parent | a3e65fa2e31ec529febce0c9c4946d4fcbd416bf (diff) |
set_default_d_op(): calculate the matching value for ->d_flags
... and store it in ->s_d_flags, to be used by __d_alloc()
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/dcache.c | 6 | ||||
-rw-r--r-- | include/linux/fs.h | 1 |
2 files changed, 5 insertions, 2 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index 27e6d2f36973..7519c5f66f79 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1731,14 +1731,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); @@ -1877,7 +1877,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 7cd8eaab4d4e..65548e70e596 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1400,6 +1400,7 @@ struct super_block { char s_sysfs_name[UUID_STRING_LEN + 1]; unsigned int s_max_links; + unsigned int s_d_flags; /* default d_flags for dentries */ /* * The next field is for VFS *only*. No filesystems have any business |