[dm-devel] [PATCH] dm: use gcd() to fix chunk_sectors limit stacking
Jeffle Xu
jefflexu at linux.alibaba.com
Wed Dec 2 03:38:55 UTC 2020
As it said in commit 7e7986f9d3ba ("block: use gcd() to fix
chunk_sectors limit stacking"), chunk_sectors should reflect the most
limited of all devices in the IO stack.
The previous commit only fixes block/blk-settings.c:blk_stack_limits(),
while leaving dm.c:dm_calculate_queue_limits() unfixed.
Fixes: 882ec4e609c1 ("dm table: stack 'chunk_sectors' limit to account for target-specific splitting")
cc: stable at vger.kernel.org
Reported-by: John Dorminy <jdorminy at redhat.com>
Reported-by: Bruce Johnston <bjohnsto at redhat.com>
Signed-off-by: Jeffle Xu <jefflexu at linux.alibaba.com>
---
drivers/md/dm-table.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index ce543b761be7..dcc0a27355d7 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -22,6 +22,7 @@
#include <linux/blk-mq.h>
#include <linux/mount.h>
#include <linux/dax.h>
+#include <linux/gcd.h>
#define DM_MSG_PREFIX "table"
@@ -1457,7 +1458,7 @@ int dm_calculate_queue_limits(struct dm_table *table,
/* 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 = gcd(ti->max_io_len,
ti_limits.chunk_sectors);
/* Set I/O hints portion of queue limits */
if (ti->type->io_hints)
--
2.27.0
More information about the dm-devel
mailing list