Skip to content

Commit 0725c0c

Browse files
asjkdave
authored andcommitted
btrfs: move btrfs_dev_replace_update_device_in_mapping_tree to drop declaration
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 <[email protected]> Signed-off-by: Anand Jain <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent c83b60c commit 0725c0c

File tree

1 file changed

+26
-30
lines changed

1 file changed

+26
-30
lines changed

fs/btrfs/dev-replace.c

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@
6464

6565
static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
6666
int scrub_ret);
67-
static void btrfs_dev_replace_update_device_in_mapping_tree(
68-
struct btrfs_fs_info *fs_info,
69-
struct btrfs_device *srcdev,
70-
struct btrfs_device *tgtdev);
7167
static int btrfs_dev_replace_kthread(void *data);
7268

7369
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,
628624
return ret;
629625
}
630626

627+
static void btrfs_dev_replace_update_device_in_mapping_tree(
628+
struct btrfs_fs_info *fs_info,
629+
struct btrfs_device *srcdev,
630+
struct btrfs_device *tgtdev)
631+
{
632+
struct extent_map_tree *em_tree = &fs_info->mapping_tree;
633+
struct extent_map *em;
634+
struct map_lookup *map;
635+
u64 start = 0;
636+
int i;
637+
638+
write_lock(&em_tree->lock);
639+
do {
640+
em = lookup_extent_mapping(em_tree, start, (u64)-1);
641+
if (!em)
642+
break;
643+
map = em->map_lookup;
644+
for (i = 0; i < map->num_stripes; i++)
645+
if (srcdev == map->stripes[i].dev)
646+
map->stripes[i].dev = tgtdev;
647+
start = em->start + em->len;
648+
free_extent_map(em);
649+
} while (start);
650+
write_unlock(&em_tree->lock);
651+
}
652+
631653
static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
632654
int scrub_ret)
633655
{
@@ -797,32 +819,6 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
797819
return 0;
798820
}
799821

800-
static void btrfs_dev_replace_update_device_in_mapping_tree(
801-
struct btrfs_fs_info *fs_info,
802-
struct btrfs_device *srcdev,
803-
struct btrfs_device *tgtdev)
804-
{
805-
struct extent_map_tree *em_tree = &fs_info->mapping_tree;
806-
struct extent_map *em;
807-
struct map_lookup *map;
808-
u64 start = 0;
809-
int i;
810-
811-
write_lock(&em_tree->lock);
812-
do {
813-
em = lookup_extent_mapping(em_tree, start, (u64)-1);
814-
if (!em)
815-
break;
816-
map = em->map_lookup;
817-
for (i = 0; i < map->num_stripes; i++)
818-
if (srcdev == map->stripes[i].dev)
819-
map->stripes[i].dev = tgtdev;
820-
start = em->start + em->len;
821-
free_extent_map(em);
822-
} while (start);
823-
write_unlock(&em_tree->lock);
824-
}
825-
826822
/*
827823
* Read progress of device replace status according to the state and last
828824
* stored position. The value format is the same as for

0 commit comments

Comments
 (0)