Commit 89d3d9a1 authored by Heinz Mauelshagen's avatar Heinz Mauelshagen Committed by Mike Snitzer

dm raid: fix random optimal_io_size for raid0

raid_io_hints() was retrieving the number of data stripes used for the
calculation of io_opt from struct r5conf, which is not defined for raid0
mappings.

Base the calculation on the in-core raid_set structure instead.

Also, adjust to use to_bytes() for the sector -> bytes conversion
throughout.
Signed-off-by: default avatarHeinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 094f394d
...@@ -904,7 +904,7 @@ static int validate_region_size(struct raid_set *rs, unsigned long region_size) ...@@ -904,7 +904,7 @@ static int validate_region_size(struct raid_set *rs, unsigned long region_size)
/* /*
* Convert sectors to bytes. * Convert sectors to bytes.
*/ */
rs->md.bitmap_info.chunksize = (region_size << 9); rs->md.bitmap_info.chunksize = to_bytes(region_size);
return 0; return 0;
} }
...@@ -3368,11 +3368,10 @@ static int raid_iterate_devices(struct dm_target *ti, ...@@ -3368,11 +3368,10 @@ static int raid_iterate_devices(struct dm_target *ti,
static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits) static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits)
{ {
struct raid_set *rs = ti->private; struct raid_set *rs = ti->private;
unsigned int chunk_size = rs->md.chunk_sectors << 9; unsigned int chunk_size = to_bytes(rs->md.chunk_sectors);
struct r5conf *conf = rs->md.private;
blk_limits_io_min(limits, chunk_size); blk_limits_io_min(limits, chunk_size);
blk_limits_io_opt(limits, chunk_size * (conf->raid_disks - conf->max_degraded)); blk_limits_io_opt(limits, chunk_size * mddev_data_stripes(rs));
} }
static void raid_presuspend(struct dm_target *ti) static void raid_presuspend(struct dm_target *ti)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment