[PATCH 10/12] dm: Add support for copy offloading

Bart Van Assche
2026-04-24T22:42:44Z

In dm_calculate_queue_limits(), clear the copy offload limits if the
device mapper driver does not support copy offloading. This is necessary
since blk_set_stacking_limits() sets the copy offload limits to their
maximum.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/md/dm-table.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index dc2eff6b739d..888c5bdca5f1 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1816,6 +1816,14 @@ int dm_calculate_queue_limits(struct dm_table *t,
return -EINVAL;

combine_limits:
+ if (!(ti_limits.features & BLK_FEAT_STACKING_COPY_OFFL)) {
+ ti_limits.max_copy_hw_sectors = 0;
+ ti_limits.max_copy_src_segments = 0;
+ ti_limits.max_copy_dst_segments = 0;
+ ti_limits.max_user_copy_sectors = 0;
+ ti_limits.max_copy_sectors = 0;
+ }
+
/*
* Merge this target's queue limits into the overall limits
* for the table.