Skip to content

Commit d9d4ce9

Browse files
morbidrsakdave
authored andcommitted
btrfs: reduce scope of data_stripes in btrfs_map_block
Reduce the scope of 'data_stripes' in btrfs_map_block(). While the change alone may not make too much sense, it helps us factoring out a helper function for the block mapping of RAID56 I/O. Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 8938f11 commit d9d4ce9

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

fs/btrfs/volumes.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6478,7 +6478,6 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
64786478
struct btrfs_chunk_map *map;
64796479
struct btrfs_io_geometry io_geom = { 0 };
64806480
u64 map_offset;
6481-
int data_stripes;
64826481
int i;
64836482
int ret = 0;
64846483
int num_copies;
@@ -6503,8 +6502,6 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
65036502
if (IS_ERR(map))
65046503
return PTR_ERR(map);
65056504

6506-
data_stripes = nr_data_stripes(map);
6507-
65086505
map_offset = logical - map->start;
65096506
io_geom.raid56_full_stripe_start = (u64)-1;
65106507
max_len = btrfs_max_io_len(map, io_geom.op, map_offset, &io_geom.stripe_nr,
@@ -6530,6 +6527,8 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
65306527
} else if (map->type & BTRFS_BLOCK_GROUP_RAID10) {
65316528
map_blocks_raid10(fs_info, map, &io_geom, dev_replace_is_ongoing);
65326529
} else if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) {
6530+
int data_stripes = nr_data_stripes(map);
6531+
65336532
if (op != BTRFS_MAP_READ || io_geom.mirror_num > 1) {
65346533
/*
65356534
* Needs full stripe mapping.
@@ -6641,7 +6640,8 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
66416640
* modulo, to reduce one modulo call.
66426641
*/
66436642
bioc->full_stripe_logical = map->start +
6644-
btrfs_stripe_nr_to_offset(io_geom.stripe_nr * data_stripes);
6643+
btrfs_stripe_nr_to_offset(io_geom.stripe_nr *
6644+
nr_data_stripes(map));
66456645
for (int i = 0; i < io_geom.num_stripes; i++) {
66466646
ret = set_io_stripe(fs_info, op, logical, length,
66476647
&bioc->stripes[i], map,

0 commit comments

Comments
 (0)