mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
btrfs: factor out block mapping for single profiles
Now that we have a container for the I/O geometry that has all the needed information for the block mappings of SINGLE profiles, factor out a helper calculating this information. Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
089221d345
commit
a16fb8c6f6
1 changed files with 9 additions and 3 deletions
|
@ -6484,6 +6484,14 @@ static void map_blocks_raid56_read(struct btrfs_chunk_map *map,
|
||||||
io_geom->mirror_num = 1;
|
io_geom->mirror_num = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void map_blocks_single(const struct btrfs_chunk_map *map,
|
||||||
|
struct btrfs_io_geometry *io_geom)
|
||||||
|
{
|
||||||
|
io_geom->stripe_index = io_geom->stripe_nr % map->num_stripes;
|
||||||
|
io_geom->stripe_nr /= map->num_stripes;
|
||||||
|
io_geom->mirror_num = io_geom->stripe_index + 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Map one logical range to one or more physical ranges.
|
* Map one logical range to one or more physical ranges.
|
||||||
*
|
*
|
||||||
|
@ -6586,9 +6594,7 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
|
||||||
* device we have to walk to find the data, and stripe_index is
|
* device we have to walk to find the data, and stripe_index is
|
||||||
* the number of our device in the stripe array
|
* the number of our device in the stripe array
|
||||||
*/
|
*/
|
||||||
io_geom.stripe_index = io_geom.stripe_nr % map->num_stripes;
|
map_blocks_single(map, &io_geom);
|
||||||
io_geom.stripe_nr /= map->num_stripes;
|
|
||||||
io_geom.mirror_num = io_geom.stripe_index + 1;
|
|
||||||
}
|
}
|
||||||
if (io_geom.stripe_index >= map->num_stripes) {
|
if (io_geom.stripe_index >= map->num_stripes) {
|
||||||
btrfs_crit(fs_info,
|
btrfs_crit(fs_info,
|
||||||
|
|
Loading…
Reference in a new issue