btrfs: simplify the bioc argument for handle_ops_on_dev_replace()
authorQu Wenruo <wqu@suse.com>
Tue, 7 Feb 2023 04:26:12 +0000 (12:26 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 17 Apr 2023 16:01:14 +0000 (18:01 +0200)
There is no memory re-allocation for handle_ops_on_dev_replace(), thus
we don't need to pass a btrfs_io_context pointer.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c

index 9f80ff74101fb9a5796698e9ee76f4bdac7a61cb..a29c9d5503914d4155c51b6babb4e03443ed54f8 100644 (file)
@@ -6196,12 +6196,11 @@ static bool is_block_group_to_copy(struct btrfs_fs_info *fs_info, u64 logical)
 }
 
 static void handle_ops_on_dev_replace(enum btrfs_map_op op,
-                                     struct btrfs_io_context **bioc_ret,
+                                     struct btrfs_io_context *bioc,
                                      struct btrfs_dev_replace *dev_replace,
                                      u64 logical,
                                      int *num_stripes_ret, int *max_errors_ret)
 {
-       struct btrfs_io_context *bioc = *bioc_ret;
        u64 srcdev_devid = dev_replace->srcdev->devid;
        int tgtdev_indexes = 0;
        int num_stripes = *num_stripes_ret;
@@ -6290,7 +6289,6 @@ static void handle_ops_on_dev_replace(enum btrfs_map_op op,
        *num_stripes_ret = num_stripes;
        *max_errors_ret = max_errors;
        bioc->num_tgtdevs = tgtdev_indexes;
-       *bioc_ret = bioc;
 }
 
 static bool need_full_stripe(enum btrfs_map_op op)
@@ -6594,7 +6592,7 @@ int __btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
 
        if (dev_replace_is_ongoing && dev_replace->tgtdev != NULL &&
            need_full_stripe(op)) {
-               handle_ops_on_dev_replace(op, &bioc, dev_replace, logical,
+               handle_ops_on_dev_replace(op, bioc, dev_replace, logical,
                                          &num_stripes, &max_errors);
        }