Skip to content

Commit 882ec4e

Browse files
committed
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: 07d098e ("block: allow 'chunk_sectors' to be non-power-of-2") Signed-off-by: Mike Snitzer <[email protected]>
1 parent 1471308 commit 882ec4e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/md/dm-table.c

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/mutex.h>
1919
#include <linux/delay.h>
2020
#include <linux/atomic.h>
21+
#include <linux/lcm.h>
2122
#include <linux/blk-mq.h>
2223
#include <linux/mount.h>
2324
#include <linux/dax.h>
@@ -1506,6 +1507,10 @@ int dm_calculate_queue_limits(struct dm_table *table,
15061507
zone_sectors = ti_limits.chunk_sectors;
15071508
}
15081509

1510+
/* Stack chunk_sectors if target-specific splitting is required */
1511+
if (ti->max_io_len)
1512+
ti_limits.chunk_sectors = lcm_not_zero(ti->max_io_len,
1513+
ti_limits.chunk_sectors);
15091514
/* Set I/O hints portion of queue limits */
15101515
if (ti->type->io_hints)
15111516
ti->type->io_hints(ti, &ti_limits);

0 commit comments

Comments
 (0)