]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
make d_set_d_op() static
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 24 Feb 2025 01:18:15 +0000 (20:18 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 11 Jun 2025 17:39:52 +0000 (13:39 -0400)
Convert the last user (d_alloc_pseudo()) and be done with that.
Any out-of-tree filesystem using it should switch to d_splice_alias_ops()
or, better yet, check whether it really needs to have ->d_op vary among
its dentries.

Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Documentation/filesystems/porting.rst
fs/dcache.c
include/linux/dcache.h

index b16139e9194220cabcea3c9b7800aa8cfaa3b2ab..579f17df46cf6b7b4e3a1592c4be65749075bca1 100644 (file)
@@ -1256,3 +1256,14 @@ an extra reference to new mount - it should be returned with refcount 1.
 
 If your filesystem sets the default dentry_operations, use set_default_d_op()
 rather than manually setting sb->s_d_op.
+
+---
+
+**mandatory**
+
+d_set_d_op() is no longer exported (or public, for that matter); _if_
+your filesystem really needed that, make use of d_splice_alias_ops()
+to have them set.  Better yet, think hard whether you need different
+->d_op for different dentries - if not, just use set_default_d_op()
+at mount time and be done with that.  Currently procfs is the only
+thing that really needs ->d_op varying between dentries.
index 7519c5f66f791b6ebb466f41f2fd840f6e4b954f..4e6ab27471a437820d9421104b24464b6d86955a 100644 (file)
@@ -1821,8 +1821,9 @@ 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;
+               /* d_op_flags(&anon_ops) is 0 */
                if (!dentry->d_op)
-                       d_set_d_op(dentry, &anon_ops);
+                       dentry->d_op = &anon_ops;
        }
        return dentry;
 }
@@ -1864,7 +1865,7 @@ static unsigned int d_op_flags(const struct dentry_operations *op)
        return flags;
 }
 
-void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op)
+static void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op)
 {
        unsigned int flags = d_op_flags(op);
        WARN_ON_ONCE(dentry->d_op);
@@ -1873,7 +1874,6 @@ void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op)
        if (flags)
                dentry->d_flags |= flags;
 }
-EXPORT_SYMBOL(d_set_d_op);
 
 void set_default_d_op(struct super_block *s, const struct dentry_operations *ops)
 {
index be7ae058fa90a1fd95134f4702fad835487fbe68..cc3e1c1a3454460a672cf86b5d5a248f4e840719 100644 (file)
@@ -237,7 +237,6 @@ extern void d_instantiate_new(struct dentry *, struct inode *);
 extern void __d_drop(struct dentry *dentry);
 extern void d_drop(struct dentry *dentry);
 extern void d_delete(struct dentry *);
-extern void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op);
 
 /* allocate/de-allocate */
 extern struct dentry * d_alloc(struct dentry *, const struct qstr *);