diff options
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-thin.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index e9e9584fe769..8735543eacdb 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c @@ -3587,27 +3587,20 @@ static void pool_io_hints(struct dm_target *ti, struct queue_limits *limits) sector_t io_opt_sectors = limits->io_opt >> SECTOR_SHIFT; /* - * Adjust max_sectors_kb to highest possible power-of-2 - * factor of pool->sectors_per_block. + * If max_sectors is smaller than pool->sectors_per_block adjust it + * to the highest possible power-of-2 factor of pool->sectors_per_block. + * This is especially beneficial when the pool's data device is a RAID + * device that has a full stripe width that matches pool->sectors_per_block + * -- because even though partial RAID stripe-sized IOs will be issued to a + * single RAID stripe; when aggregated they will end on a full RAID stripe + * boundary.. which avoids additional partial RAID stripe writes cascading */ - if (limits->max_hw_sectors & (limits->max_hw_sectors - 1)) - limits->max_sectors = rounddown_pow_of_two(limits->max_hw_sectors); - else - limits->max_sectors = limits->max_hw_sectors; - if (limits->max_sectors < pool->sectors_per_block) { while (!is_factor(pool->sectors_per_block, limits->max_sectors)) { if ((limits->max_sectors & (limits->max_sectors - 1)) == 0) limits->max_sectors--; limits->max_sectors = rounddown_pow_of_two(limits->max_sectors); } - } else if (block_size_is_power_of_two(pool)) { - /* max_sectors_kb is >= power-of-2 thinp blocksize */ - while (!is_factor(limits->max_sectors, pool->sectors_per_block)) { - if ((limits->max_sectors & (limits->max_sectors - 1)) == 0) - limits->max_sectors--; - limits->max_sectors = rounddown_pow_of_two(limits->max_sectors); - } } /* |