diff mbox series

[4/7] fs: remove get_active_super()

Message ID 20230927-vfs-super-freeze-v1-4-ecc36d9ab4d9@kernel.org (mailing list archive)
State New, archived
Headers show
Series Implement freeze and thaw as holder operations | expand

Commit Message

Christian Brauner Sept. 27, 2023, 1:21 p.m. UTC
This function is now unused so remove it. One less function that uses
the global superblock list.

Signed-off-by: Christian Brauner <brauner@kernel.org>
---
 fs/super.c         | 28 ----------------------------
 include/linux/fs.h |  1 -
 2 files changed, 29 deletions(-)

Comments

Darrick J. Wong Sept. 27, 2023, 2:54 p.m. UTC | #1
On Wed, Sep 27, 2023 at 03:21:17PM +0200, Christian Brauner wrote:
> This function is now unused so remove it. One less function that uses
> the global superblock list.
> 
> Signed-off-by: Christian Brauner <brauner@kernel.org>

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/super.c         | 28 ----------------------------
>  include/linux/fs.h |  1 -
>  2 files changed, 29 deletions(-)
> 
> diff --git a/fs/super.c b/fs/super.c
> index 672f1837fbef..181ac8501301 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -1016,34 +1016,6 @@ void iterate_supers_type(struct file_system_type *type,
>  
>  EXPORT_SYMBOL(iterate_supers_type);
>  
> -/**
> - * get_active_super - get an active reference to the superblock of a device
> - * @bdev: device to get the superblock for
> - *
> - * Scans the superblock list and finds the superblock of the file system
> - * mounted on the device given.  Returns the superblock with an active
> - * reference or %NULL if none was found.
> - */
> -struct super_block *get_active_super(struct block_device *bdev)
> -{
> -	struct super_block *sb;
> -
> -	if (!bdev)
> -		return NULL;
> -
> -	spin_lock(&sb_lock);
> -	list_for_each_entry(sb, &super_blocks, s_list) {
> -		if (sb->s_bdev == bdev) {
> -			if (!grab_super(sb))
> -				return NULL;
> -			super_unlock_excl(sb);
> -			return sb;
> -		}
> -	}
> -	spin_unlock(&sb_lock);
> -	return NULL;
> -}
> -
>  struct super_block *user_get_super(dev_t dev, bool excl)
>  {
>  	struct super_block *sb;
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index b528f063e8ff..ad0ddc10d560 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -3052,7 +3052,6 @@ extern int vfs_readlink(struct dentry *, char __user *, int);
>  extern struct file_system_type *get_filesystem(struct file_system_type *fs);
>  extern void put_filesystem(struct file_system_type *fs);
>  extern struct file_system_type *get_fs_type(const char *name);
> -extern struct super_block *get_active_super(struct block_device *bdev);
>  extern void drop_super(struct super_block *sb);
>  extern void drop_super_exclusive(struct super_block *sb);
>  extern void iterate_supers(void (*)(struct super_block *, void *), void *);
> 
> -- 
> 2.34.1
>
Christoph Hellwig Oct. 2, 2023, 7:10 a.m. UTC | #2
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Jan Kara Oct. 2, 2023, 4:22 p.m. UTC | #3
On Wed 27-09-23 15:21:17, Christian Brauner wrote:
> This function is now unused so remove it. One less function that uses
> the global superblock list.
> 
> Signed-off-by: Christian Brauner <brauner@kernel.org>

Nice. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/super.c         | 28 ----------------------------
>  include/linux/fs.h |  1 -
>  2 files changed, 29 deletions(-)
> 
> diff --git a/fs/super.c b/fs/super.c
> index 672f1837fbef..181ac8501301 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -1016,34 +1016,6 @@ void iterate_supers_type(struct file_system_type *type,
>  
>  EXPORT_SYMBOL(iterate_supers_type);
>  
> -/**
> - * get_active_super - get an active reference to the superblock of a device
> - * @bdev: device to get the superblock for
> - *
> - * Scans the superblock list and finds the superblock of the file system
> - * mounted on the device given.  Returns the superblock with an active
> - * reference or %NULL if none was found.
> - */
> -struct super_block *get_active_super(struct block_device *bdev)
> -{
> -	struct super_block *sb;
> -
> -	if (!bdev)
> -		return NULL;
> -
> -	spin_lock(&sb_lock);
> -	list_for_each_entry(sb, &super_blocks, s_list) {
> -		if (sb->s_bdev == bdev) {
> -			if (!grab_super(sb))
> -				return NULL;
> -			super_unlock_excl(sb);
> -			return sb;
> -		}
> -	}
> -	spin_unlock(&sb_lock);
> -	return NULL;
> -}
> -
>  struct super_block *user_get_super(dev_t dev, bool excl)
>  {
>  	struct super_block *sb;
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index b528f063e8ff..ad0ddc10d560 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -3052,7 +3052,6 @@ extern int vfs_readlink(struct dentry *, char __user *, int);
>  extern struct file_system_type *get_filesystem(struct file_system_type *fs);
>  extern void put_filesystem(struct file_system_type *fs);
>  extern struct file_system_type *get_fs_type(const char *name);
> -extern struct super_block *get_active_super(struct block_device *bdev);
>  extern void drop_super(struct super_block *sb);
>  extern void drop_super_exclusive(struct super_block *sb);
>  extern void iterate_supers(void (*)(struct super_block *, void *), void *);
> 
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/fs/super.c b/fs/super.c
index 672f1837fbef..181ac8501301 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1016,34 +1016,6 @@  void iterate_supers_type(struct file_system_type *type,
 
 EXPORT_SYMBOL(iterate_supers_type);
 
-/**
- * get_active_super - get an active reference to the superblock of a device
- * @bdev: device to get the superblock for
- *
- * Scans the superblock list and finds the superblock of the file system
- * mounted on the device given.  Returns the superblock with an active
- * reference or %NULL if none was found.
- */
-struct super_block *get_active_super(struct block_device *bdev)
-{
-	struct super_block *sb;
-
-	if (!bdev)
-		return NULL;
-
-	spin_lock(&sb_lock);
-	list_for_each_entry(sb, &super_blocks, s_list) {
-		if (sb->s_bdev == bdev) {
-			if (!grab_super(sb))
-				return NULL;
-			super_unlock_excl(sb);
-			return sb;
-		}
-	}
-	spin_unlock(&sb_lock);
-	return NULL;
-}
-
 struct super_block *user_get_super(dev_t dev, bool excl)
 {
 	struct super_block *sb;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b528f063e8ff..ad0ddc10d560 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3052,7 +3052,6 @@  extern int vfs_readlink(struct dentry *, char __user *, int);
 extern struct file_system_type *get_filesystem(struct file_system_type *fs);
 extern void put_filesystem(struct file_system_type *fs);
 extern struct file_system_type *get_fs_type(const char *name);
-extern struct super_block *get_active_super(struct block_device *bdev);
 extern void drop_super(struct super_block *sb);
 extern void drop_super_exclusive(struct super_block *sb);
 extern void iterate_supers(void (*)(struct super_block *, void *), void *);