diff options
author | Anand Jain <Anand.Jain@oracle.com> | 2018-03-14 11:29:12 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-03-31 02:41:11 +0300 |
commit | 99f92a7c1eba4e3aa82b361bbe92a7ac088fc176 (patch) | |
tree | 526b0ee27aa5dd41cbc4f6465bc40006e72d7dfe /fs/btrfs | |
parent | 0a1e458a1e49dc6cf13b05f81098e01cf79ceaa1 (diff) | |
download | linux-99f92a7c1eba4e3aa82b361bbe92a7ac088fc176.tar.xz |
btrfs: drop num argument from find_live_mirror()
Obtain the stripes info from the map directly and so no need
to pass it as an argument.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/volumes.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index dcc2b486b2c5..82c21f6eeb3e 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -5274,13 +5274,22 @@ int btrfs_is_parity_mirror(struct btrfs_fs_info *fs_info, u64 logical, u64 len) } static int find_live_mirror(struct btrfs_fs_info *fs_info, - struct map_lookup *map, int first, int num, + struct map_lookup *map, int first, int optimal, int dev_replace_is_ongoing) { int i; + int num_stripes; int tolerance; struct btrfs_device *srcdev; + ASSERT((map->type & + (BTRFS_BLOCK_GROUP_RAID1 | BTRFS_BLOCK_GROUP_RAID10))); + + if (map->type & BTRFS_BLOCK_GROUP_RAID10) + num_stripes = map->sub_stripes; + else + num_stripes = map->num_stripes; + if (dev_replace_is_ongoing && fs_info->dev_replace.cont_reading_from_srcdev_mode == BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_AVOID) @@ -5297,7 +5306,7 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info, if (map->stripes[optimal].dev->bdev && (tolerance || map->stripes[optimal].dev != srcdev)) return optimal; - for (i = first; i < first + num; i++) { + for (i = first; i < first + num_stripes; i++) { if (map->stripes[i].dev->bdev && (tolerance || map->stripes[i].dev != srcdev)) return i; @@ -5834,7 +5843,6 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, stripe_index = mirror_num - 1; else { stripe_index = find_live_mirror(fs_info, map, 0, - map->num_stripes, current->pid % map->num_stripes, dev_replace_is_ongoing); mirror_num = stripe_index + 1; @@ -5863,7 +5871,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int old_stripe_index = stripe_index; stripe_index = find_live_mirror(fs_info, map, stripe_index, - map->sub_stripes, stripe_index + + stripe_index + current->pid % map->sub_stripes, dev_replace_is_ongoing); mirror_num = stripe_index - old_stripe_index + 1; |