dm-thinp: report correct optimal I/O size
PATCH 1/1 dm-thinp: report correct optimal I/O size
tc->block_shift is the shift to get from a sector to the block_size, and it doesn't make any sense to apply that to the block size. Without this I get overflows of the optimal I/O size queue limit when using large block sizes in dm-thinp.
drivers/md/dm-thin-prov.c +1 -1
@@ -641,7 +641,7 @@ thinp_io_hints(struct dm_target *ti, strstruct thinp_c *tc = ti->private;blk_limits_io_min (limits,0 ); -blk_limits_io_opt (limits, tc->block_size << tc->block_shift); +blk_limits_io_opt (limits, tc->block_size); } static int thinp_iterate_devices(struct dm_target *ti,
Joe Thornber
NAKQuoted 4 lines · Christoph Hellwig
tc->block_shiftis the shift to get from a sector to theblock_size, and it doesn't make any sense to apply that to the block size. Without this I get overflows of the optimal I/O size queue limit when using large block sizes in dm-thinp.
NACK.
From looking at dm-raid and dm-stripe it appears that the blk_limits_io_opt function is expecting the size to be in bytes, not sectors.
static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits)
{
struct raid_set *rs = ti->private;
unsigned chunk_size = rs->md.chunk_sectors << 9;
raid5_conf_t *conf = rs->md.private;
blk_limits_io_min(limits, chunk_size);
blk_limits_io_opt(limits, chunk_size * (conf->raid_disks - conf->max_degraded));
}static void stripe_io_hints(struct dm_target *ti,
struct queue_limits *limits)
{
struct stripe_c *sc = ti->private;
unsigned chunk_size = (sc->chunk_mask + 1) << 9;
blk_limits_io_min(limits, chunk_size);
blk_limits_io_opt(limits, chunk_size * sc->stripes);
}tc->block_size is in sectors (you are passing sectors on the target line?).
What's probably happening here is we should be doing:
blk_limits_io_opt(limits, min(<some theoretical max>, tc->block_size << SECTOR_SHIFT));
- Joe
Quoted 6 lines · Joe Thornber
tc->block_sizeis in sectors (you are passing sectors on the target line?).What's probably happening here is we should be doing:
blk_limits_io_opt(limits, min(<some theoretical max>, tc->block_size << SECTOR_SHIFT));
Yes, that should do it. I don't even think we need the max, the optimum I/O size is a 32-bit value and we'll reach the limit of the possible block sizes much earlier.
Quoted 11 lines · Christoph Hellwig
Quoted 6 lines · Joe Thornber
tc->block_sizeis in sectors (you are passing sectors on the target line?).What's probably happening here is we should be doing:
blk_limits_io_opt(limits, min(<some theoretical max>, tc->block_size << SECTOR_SHIFT));Yes, that should do it. I don't even think we need the max, the optimum I/O size is a 32-bit value and we'll reach the limit of the possible block sizes much earlier.
I'm tempted to just say min(16M, tc->block_size << SECTOR_SHIFT). Does this sound reasonable to you?
Quoted 2 lines · Joe Thornber
I'm tempted to just say
min(16M, tc->block_size << SECTOR_SHIFT). Does this sound reasonable to you?
If you have a good reason for the limit go for it. But please add a comment explaining why the limit is there, so people running into it later on won't be completely puzzled.