btrfs: drop unused space_info parameter from create_space_info
diff mbox

Message ID 20180528063027.4527-1-lufq.fnst@cn.fujitsu.com
State New
Headers show

Commit Message

Lu Fengqi May 28, 2018, 6:30 a.m. UTC
Since commit dc2d3005d27d ("btrfs: remove dead create_space_info
calls"), there is only one caller btrfs_init_space_info. However, it
doesn't need create_space_info to return space_info at all.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
---
 fs/btrfs/extent-tree.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

Comments

Nikolay Borisov May 28, 2018, 6:40 a.m. UTC | #1
On 28.05.2018 09:30, Lu Fengqi wrote:
> Since commit dc2d3005d27d ("btrfs: remove dead create_space_info
> calls"), there is only one caller btrfs_init_space_info. However, it
> doesn't need create_space_info to return space_info at all.
> 
> Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>

Nice,

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
>  fs/btrfs/extent-tree.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 2c65a09535b6..31627de751d1 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -4007,8 +4007,7 @@ static const char *alloc_name(u64 flags)
>  	};
>  }
>  
> -static int create_space_info(struct btrfs_fs_info *info, u64 flags,
> -			     struct btrfs_space_info **new)
> +static int create_space_info(struct btrfs_fs_info *info, u64 flags)
>  {
>  
>  	struct btrfs_space_info *space_info;
> @@ -4046,7 +4045,6 @@ static int create_space_info(struct btrfs_fs_info *info, u64 flags,
>  		return ret;
>  	}
>  
> -	*new = space_info;
>  	list_add_rcu(&space_info->list, &info->space_info);
>  	if (flags & BTRFS_BLOCK_GROUP_DATA)
>  		info->data_sinfo = space_info;
> @@ -10810,7 +10808,6 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info)
>  
>  int btrfs_init_space_info(struct btrfs_fs_info *fs_info)
>  {
> -	struct btrfs_space_info *space_info;
>  	struct btrfs_super_block *disk_super;
>  	u64 features;
>  	u64 flags;
> @@ -10826,21 +10823,21 @@ int btrfs_init_space_info(struct btrfs_fs_info *fs_info)
>  		mixed = 1;
>  
>  	flags = BTRFS_BLOCK_GROUP_SYSTEM;
> -	ret = create_space_info(fs_info, flags, &space_info);
> +	ret = create_space_info(fs_info, flags);
>  	if (ret)
>  		goto out;
>  
>  	if (mixed) {
>  		flags = BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_DATA;
> -		ret = create_space_info(fs_info, flags, &space_info);
> +		ret = create_space_info(fs_info, flags);
>  	} else {
>  		flags = BTRFS_BLOCK_GROUP_METADATA;
> -		ret = create_space_info(fs_info, flags, &space_info);
> +		ret = create_space_info(fs_info, flags);
>  		if (ret)
>  			goto out;
>  
>  		flags = BTRFS_BLOCK_GROUP_DATA;
> -		ret = create_space_info(fs_info, flags, &space_info);
> +		ret = create_space_info(fs_info, flags);
>  	}
>  out:
>  	return ret;
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Sterba May 28, 2018, 12:16 p.m. UTC | #2
On Mon, May 28, 2018 at 02:30:27PM +0800, Lu Fengqi wrote:
> Since commit dc2d3005d27d ("btrfs: remove dead create_space_info
> calls"), there is only one caller btrfs_init_space_info. However, it
> doesn't need create_space_info to return space_info at all.
> 
> Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>

Reviewed-by: David Sterba <dsterba@suse.com>

Added to 4.18 queue, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 2c65a09535b6..31627de751d1 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4007,8 +4007,7 @@  static const char *alloc_name(u64 flags)
 	};
 }
 
-static int create_space_info(struct btrfs_fs_info *info, u64 flags,
-			     struct btrfs_space_info **new)
+static int create_space_info(struct btrfs_fs_info *info, u64 flags)
 {
 
 	struct btrfs_space_info *space_info;
@@ -4046,7 +4045,6 @@  static int create_space_info(struct btrfs_fs_info *info, u64 flags,
 		return ret;
 	}
 
-	*new = space_info;
 	list_add_rcu(&space_info->list, &info->space_info);
 	if (flags & BTRFS_BLOCK_GROUP_DATA)
 		info->data_sinfo = space_info;
@@ -10810,7 +10808,6 @@  void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info)
 
 int btrfs_init_space_info(struct btrfs_fs_info *fs_info)
 {
-	struct btrfs_space_info *space_info;
 	struct btrfs_super_block *disk_super;
 	u64 features;
 	u64 flags;
@@ -10826,21 +10823,21 @@  int btrfs_init_space_info(struct btrfs_fs_info *fs_info)
 		mixed = 1;
 
 	flags = BTRFS_BLOCK_GROUP_SYSTEM;
-	ret = create_space_info(fs_info, flags, &space_info);
+	ret = create_space_info(fs_info, flags);
 	if (ret)
 		goto out;
 
 	if (mixed) {
 		flags = BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_DATA;
-		ret = create_space_info(fs_info, flags, &space_info);
+		ret = create_space_info(fs_info, flags);
 	} else {
 		flags = BTRFS_BLOCK_GROUP_METADATA;
-		ret = create_space_info(fs_info, flags, &space_info);
+		ret = create_space_info(fs_info, flags);
 		if (ret)
 			goto out;
 
 		flags = BTRFS_BLOCK_GROUP_DATA;
-		ret = create_space_info(fs_info, flags, &space_info);
+		ret = create_space_info(fs_info, flags);
 	}
 out:
 	return ret;