btrfs: move btrfs_dev_replace_update_device_in_mapping_tree to drop declaration
authorAnand Jain <anand.jain@oracle.com>
Fri, 4 Sep 2020 17:34:36 +0000 (01:34 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 7 Oct 2020 10:13:15 +0000 (12:13 +0200)
The function is short and simple, we can get rid of the declaration as
it's not necessary for a static function. Move it before its first
caller.  No functional changes.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/dev-replace.c

index 500e45f7aa3f6e57705cd30b356ff01cf85e3944..4a0243cb9d9730401f967c46ede2ec3a62a58556 100644 (file)
 
 static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
                                       int scrub_ret);
-static void btrfs_dev_replace_update_device_in_mapping_tree(
-                                               struct btrfs_fs_info *fs_info,
-                                               struct btrfs_device *srcdev,
-                                               struct btrfs_device *tgtdev);
 static int btrfs_dev_replace_kthread(void *data);
 
 int btrfs_init_dev_replace(struct btrfs_fs_info *fs_info)
@@ -628,6 +624,32 @@ static int btrfs_set_target_alloc_state(struct btrfs_device *srcdev,
        return ret;
 }
 
+static void btrfs_dev_replace_update_device_in_mapping_tree(
+                                               struct btrfs_fs_info *fs_info,
+                                               struct btrfs_device *srcdev,
+                                               struct btrfs_device *tgtdev)
+{
+       struct extent_map_tree *em_tree = &fs_info->mapping_tree;
+       struct extent_map *em;
+       struct map_lookup *map;
+       u64 start = 0;
+       int i;
+
+       write_lock(&em_tree->lock);
+       do {
+               em = lookup_extent_mapping(em_tree, start, (u64)-1);
+               if (!em)
+                       break;
+               map = em->map_lookup;
+               for (i = 0; i < map->num_stripes; i++)
+                       if (srcdev == map->stripes[i].dev)
+                               map->stripes[i].dev = tgtdev;
+               start = em->start + em->len;
+               free_extent_map(em);
+       } while (start);
+       write_unlock(&em_tree->lock);
+}
+
 static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
                                       int scrub_ret)
 {
@@ -797,32 +819,6 @@ error:
        return 0;
 }
 
-static void btrfs_dev_replace_update_device_in_mapping_tree(
-                                               struct btrfs_fs_info *fs_info,
-                                               struct btrfs_device *srcdev,
-                                               struct btrfs_device *tgtdev)
-{
-       struct extent_map_tree *em_tree = &fs_info->mapping_tree;
-       struct extent_map *em;
-       struct map_lookup *map;
-       u64 start = 0;
-       int i;
-
-       write_lock(&em_tree->lock);
-       do {
-               em = lookup_extent_mapping(em_tree, start, (u64)-1);
-               if (!em)
-                       break;
-               map = em->map_lookup;
-               for (i = 0; i < map->num_stripes; i++)
-                       if (srcdev == map->stripes[i].dev)
-                               map->stripes[i].dev = tgtdev;
-               start = em->start + em->len;
-               free_extent_map(em);
-       } while (start);
-       write_unlock(&em_tree->lock);
-}
-
 /*
  * Read progress of device replace status according to the state and last
  * stored position. The value format is the same as for