diff options
author | Heinz Mauelshagen <heinzm@redhat.com> | 2016-07-19 07:16:24 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2016-07-19 11:37:08 -0400 |
commit | 89d3d9a1e38a6bd453038cfdc7e1576ef2d19719 (patch) | |
tree | acafef3a5b3713da5c702c9b7ba95a7a4a33da12 | |
parent | 094f394df6a33f959888d445b362a9086823a2fb (diff) |
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: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
-rw-r--r-- | drivers/md/dm-raid.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 10c136f789b9..84983549b5e1 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c | |||
@@ -904,7 +904,7 @@ static int validate_region_size(struct raid_set *rs, unsigned long region_size) | |||
904 | /* | 904 | /* |
905 | * Convert sectors to bytes. | 905 | * Convert sectors to bytes. |
906 | */ | 906 | */ |
907 | rs->md.bitmap_info.chunksize = (region_size << 9); | 907 | rs->md.bitmap_info.chunksize = to_bytes(region_size); |
908 | 908 | ||
909 | return 0; | 909 | return 0; |
910 | } | 910 | } |
@@ -3368,11 +3368,10 @@ static int raid_iterate_devices(struct dm_target *ti, | |||
3368 | static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits) | 3368 | static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits) |
3369 | { | 3369 | { |
3370 | struct raid_set *rs = ti->private; | 3370 | struct raid_set *rs = ti->private; |
3371 | unsigned int chunk_size = rs->md.chunk_sectors << 9; | 3371 | unsigned int chunk_size = to_bytes(rs->md.chunk_sectors); |
3372 | struct r5conf *conf = rs->md.private; | ||
3373 | 3372 | ||
3374 | blk_limits_io_min(limits, chunk_size); | 3373 | blk_limits_io_min(limits, chunk_size); |
3375 | blk_limits_io_opt(limits, chunk_size * (conf->raid_disks - conf->max_degraded)); | 3374 | blk_limits_io_opt(limits, chunk_size * mddev_data_stripes(rs)); |
3376 | } | 3375 | } |
3377 | 3376 | ||
3378 | static void raid_presuspend(struct dm_target *ti) | 3377 | static void raid_presuspend(struct dm_target *ti) |