mirror of https://gitee.com/openkylin/linux.git
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 <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>
This commit is contained in:
parent
c83b60c0e4
commit
0725c0c935
|
@ -64,10 +64,6 @@
|
|||
|
||||
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 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue