diff mbox series

[04/21] fuse: no need for special dentry_operations for root dentry

Message ID 20250224212051.1756517-4-viro@zeniv.linux.org.uk (mailing list archive)
State New
Headers show
Series [01/21] procfs: kill ->proc_dops | expand

Commit Message

Al Viro Feb. 24, 2025, 9:20 p.m. UTC
->d_revalidate() is never called for root anyway...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/fuse/dir.c    | 7 -------
 fs/fuse/fuse_i.h | 1 -
 fs/fuse/inode.c  | 4 +---
 3 files changed, 1 insertion(+), 11 deletions(-)

Comments

Christian Brauner Feb. 26, 2025, 8:29 a.m. UTC | #1
On Mon, Feb 24, 2025 at 09:20:34PM +0000, Al Viro wrote:
> ->d_revalidate() is never called for root anyway...
> 
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---

Reviewed-by: Christian Brauner <brauner@kernel.org>

>  fs/fuse/dir.c    | 7 -------
>  fs/fuse/fuse_i.h | 1 -
>  fs/fuse/inode.c  | 4 +---
>  3 files changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
> index 198862b086ff..24979d5413fa 100644
> --- a/fs/fuse/dir.c
> +++ b/fs/fuse/dir.c
> @@ -336,13 +336,6 @@ const struct dentry_operations fuse_dentry_operations = {
>  	.d_automount	= fuse_dentry_automount,
>  };
>  
> -const struct dentry_operations fuse_root_dentry_operations = {
> -#if BITS_PER_LONG < 64
> -	.d_init		= fuse_dentry_init,
> -	.d_release	= fuse_dentry_release,
> -#endif
> -};
> -
>  int fuse_valid_type(int m)
>  {
>  	return S_ISREG(m) || S_ISDIR(m) || S_ISLNK(m) || S_ISCHR(m) ||
> diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
> index fee96fe7887b..71a2b3900854 100644
> --- a/fs/fuse/fuse_i.h
> +++ b/fs/fuse/fuse_i.h
> @@ -1069,7 +1069,6 @@ static inline void fuse_sync_bucket_dec(struct fuse_sync_bucket *bucket)
>  extern const struct file_operations fuse_dev_operations;
>  
>  extern const struct dentry_operations fuse_dentry_operations;
> -extern const struct dentry_operations fuse_root_dentry_operations;
>  
>  /**
>   * Get a filled in inode
> diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
> index e9db2cb8c150..57a1ee016b73 100644
> --- a/fs/fuse/inode.c
> +++ b/fs/fuse/inode.c
> @@ -1800,12 +1800,10 @@ int fuse_fill_super_common(struct super_block *sb, struct fuse_fs_context *ctx)
>  
>  	err = -ENOMEM;
>  	root = fuse_get_root_inode(sb, ctx->rootmode);
> -	sb->s_d_op = &fuse_root_dentry_operations;
> +	sb->s_d_op = &fuse_dentry_operations;
>  	root_dentry = d_make_root(root);
>  	if (!root_dentry)
>  		goto err_dev_free;
> -	/* Root dentry doesn't have .d_revalidate */
> -	sb->s_d_op = &fuse_dentry_operations;
>  
>  	mutex_lock(&fuse_mutex);
>  	err = -EINVAL;
> -- 
> 2.39.5
>
Miklos Szeredi Feb. 27, 2025, 2:33 p.m. UTC | #2
On Mon, 24 Feb 2025 at 22:20, Al Viro <viro@zeniv.linux.org.uk> wrote:
>
> ->d_revalidate() is never called for root anyway...
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Acked-by: Miklos Szeredi <mszeredi@redhat.com>
diff mbox series

Patch

diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 198862b086ff..24979d5413fa 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -336,13 +336,6 @@  const struct dentry_operations fuse_dentry_operations = {
 	.d_automount	= fuse_dentry_automount,
 };
 
-const struct dentry_operations fuse_root_dentry_operations = {
-#if BITS_PER_LONG < 64
-	.d_init		= fuse_dentry_init,
-	.d_release	= fuse_dentry_release,
-#endif
-};
-
 int fuse_valid_type(int m)
 {
 	return S_ISREG(m) || S_ISDIR(m) || S_ISLNK(m) || S_ISCHR(m) ||
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index fee96fe7887b..71a2b3900854 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -1069,7 +1069,6 @@  static inline void fuse_sync_bucket_dec(struct fuse_sync_bucket *bucket)
 extern const struct file_operations fuse_dev_operations;
 
 extern const struct dentry_operations fuse_dentry_operations;
-extern const struct dentry_operations fuse_root_dentry_operations;
 
 /**
  * Get a filled in inode
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index e9db2cb8c150..57a1ee016b73 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -1800,12 +1800,10 @@  int fuse_fill_super_common(struct super_block *sb, struct fuse_fs_context *ctx)
 
 	err = -ENOMEM;
 	root = fuse_get_root_inode(sb, ctx->rootmode);
-	sb->s_d_op = &fuse_root_dentry_operations;
+	sb->s_d_op = &fuse_dentry_operations;
 	root_dentry = d_make_root(root);
 	if (!root_dentry)
 		goto err_dev_free;
-	/* Root dentry doesn't have .d_revalidate */
-	sb->s_d_op = &fuse_dentry_operations;
 
 	mutex_lock(&fuse_mutex);
 	err = -EINVAL;