summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/md/dm.c5
-rw-r--r--include/linux/device-mapper.h6
2 files changed, 10 insertions, 1 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 415c2803c0c9..4e09b6ff5b49 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1215,7 +1215,10 @@ static int __clone_and_map_discard(struct clone_info *ci)
if (!ti->num_discard_requests)
return -EOPNOTSUPP;
- len = min(ci->sector_count, max_io_len_target_boundary(ci->sector, ti));
+ if (!ti->split_discard_requests)
+ len = min(ci->sector_count, max_io_len_target_boundary(ci->sector, ti));
+ else
+ len = min(ci->sector_count, max_io_len(ci->sector, ti));
__issue_target_requests(ci, ti, ti->num_discard_requests, len);
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index b19c1e189a68..8bdbbfce759a 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -218,6 +218,12 @@ struct dm_target {
unsigned discards_supported:1;
/*
+ * Set if the target required discard request to be split
+ * on max_io_len boundary.
+ */
+ unsigned split_discard_requests:1;
+
+ /*
* Set if this target does not return zeroes on discarded blocks.
*/
unsigned discard_zeroes_data_unsupported:1;