Skip to content

Commit 6edf682

Browse files
morbidrsakdave
authored andcommitted
btrfs: pass struct btrfs_io_geometry to set_io_stripe
Instead of passing three members of 'struct btrfs_io_geometry' into set_io_stripe() pass a pointer to the whole structure and then get the needed members out of btrfs_io_geometry. 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 89f547c commit 6edf682

1 file changed

Lines changed: 15 additions & 17 deletions

File tree

fs/btrfs/volumes.c

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6325,19 +6325,22 @@ static u64 btrfs_max_io_len(struct btrfs_chunk_map *map, enum btrfs_map_op op,
63256325
return U64_MAX;
63266326
}
63276327

6328-
static int set_io_stripe(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
6329-
u64 logical, u64 *length, struct btrfs_io_stripe *dst,
6330-
struct btrfs_chunk_map *map, u32 stripe_index,
6331-
u64 stripe_offset, u64 stripe_nr)
6328+
static int set_io_stripe(struct btrfs_fs_info *fs_info, u64 logical,
6329+
u64 *length, struct btrfs_io_stripe *dst,
6330+
struct btrfs_chunk_map *map,
6331+
struct btrfs_io_geometry *io_geom)
63326332
{
6333-
dst->dev = map->stripes[stripe_index].dev;
6333+
dst->dev = map->stripes[io_geom->stripe_index].dev;
63346334

6335-
if (op == BTRFS_MAP_READ && btrfs_need_stripe_tree_update(fs_info, map->type))
6335+
if (io_geom->op == BTRFS_MAP_READ &&
6336+
btrfs_need_stripe_tree_update(fs_info, map->type))
63366337
return btrfs_get_raid_extent_offset(fs_info, logical, length,
6337-
map->type, stripe_index, dst);
6338+
map->type,
6339+
io_geom->stripe_index, dst);
63386340

6339-
dst->physical = map->stripes[stripe_index].physical +
6340-
stripe_offset + btrfs_stripe_nr_to_offset(stripe_nr);
6341+
dst->physical = map->stripes[io_geom->stripe_index].physical +
6342+
io_geom->stripe_offset +
6343+
btrfs_stripe_nr_to_offset(io_geom->stripe_nr);
63416344
return 0;
63426345
}
63436346

@@ -6633,9 +6636,7 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
66336636
*/
66346637
if (is_single_device_io(fs_info, smap, map, num_alloc_stripes, op,
66356638
io_geom.mirror_num)) {
6636-
ret = set_io_stripe(fs_info, op, logical, length, smap, map,
6637-
io_geom.stripe_index, io_geom.stripe_offset,
6638-
io_geom.stripe_nr);
6639+
ret = set_io_stripe(fs_info, logical, length, smap, map, &io_geom);
66396640
if (mirror_num_ret)
66406641
*mirror_num_ret = io_geom.mirror_num;
66416642
*bioc_ret = NULL;
@@ -6686,11 +6687,8 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
66866687
* stripe into the bioc.
66876688
*/
66886689
for (i = 0; i < io_geom.num_stripes; i++) {
6689-
ret = set_io_stripe(fs_info, op, logical, length,
6690-
&bioc->stripes[i], map,
6691-
io_geom.stripe_index,
6692-
io_geom.stripe_offset,
6693-
io_geom.stripe_nr);
6690+
ret = set_io_stripe(fs_info, logical, length,
6691+
&bioc->stripes[i], map, &io_geom);
66946692
if (ret < 0)
66956693
break;
66966694
io_geom.stripe_index++;

0 commit comments

Comments
 (0)