From: Mike Snitzer Date: Mon, 14 Sep 2020 16:02:23 +0000 (-0400) Subject: dm table: stack 'chunk_sectors' limit to account for target-specific splitting X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=882ec4e609c1a6de1836e765905f62de1502ae1e;p=linux.git dm table: stack 'chunk_sectors' limit to account for target-specific splitting If target set ti->max_io_len it must be used when stacking DM device's queue_limits to establish a 'chunk_sectors' that is compatible with the IO stack. By using lcm_not_zero() care is taken to avoid blindly overriding the chunk_sectors limit stacked up by blk_stack_limits(). Depends-on: 07d098e6bbad ("block: allow 'chunk_sectors' to be non-power-of-2") Signed-off-by: Mike Snitzer --- diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index c3be7cb2570cb..704345e95cc1a 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -1506,6 +1507,10 @@ int dm_calculate_queue_limits(struct dm_table *table, zone_sectors = ti_limits.chunk_sectors; } + /* Stack chunk_sectors if target-specific splitting is required */ + if (ti->max_io_len) + ti_limits.chunk_sectors = lcm_not_zero(ti->max_io_len, + ti_limits.chunk_sectors); /* Set I/O hints portion of queue limits */ if (ti->type->io_hints) ti->type->io_hints(ti, &ti_limits);