aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2025-02-23 19:39:47 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2025-06-10 22:21:16 -0400
commit05fb0e666495cda068c068a681ecbbf8e57324d0 (patch)
tree1d7e3bde874c7710b24909b20e8042c57151ea92 /fs/dcache.c
parent4bd9f3fd87e252303e8fef6105b704f05d3f2678 (diff)
downloadlinux-05fb0e666495cda068c068a681ecbbf8e57324d0.tar.gz
new helper: set_default_d_op()
... to be used instead of manually assigning to ->s_d_op. All in-tree filesystem converted (and field itself is renamed, so any out-of-tree ones in need of conversion will be caught by compiler). Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index bf550d438e40ce..2ed875558ccc9b 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1738,7 +1738,7 @@ static struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name)
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);
+ 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);
@@ -1821,7 +1821,7 @@ struct dentry *d_alloc_pseudo(struct super_block *sb, const struct qstr *name)
struct dentry *dentry = __d_alloc(sb, name);
if (likely(dentry)) {
dentry->d_flags |= DCACHE_NORCU;
- if (!sb->s_d_op)
+ if (!dentry->d_op)
d_set_d_op(dentry, &anon_ops);
}
return dentry;
@@ -1867,6 +1867,12 @@ void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op)
}
EXPORT_SYMBOL(d_set_d_op);
+void set_default_d_op(struct super_block *s, const struct dentry_operations *ops)
+{
+ s->__s_d_op = ops;
+}
+EXPORT_SYMBOL(set_default_d_op);
+
static unsigned d_flags_for_inode(struct inode *inode)
{
unsigned add_flags = DCACHE_REGULAR_TYPE;