diff options
-rw-r--r-- | drivers/md/dm.c | 5 | ||||
-rw-r--r-- | include/linux/device-mapper.h | 6 |
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) | |||
1215 | if (!ti->num_discard_requests) | 1215 | if (!ti->num_discard_requests) |
1216 | return -EOPNOTSUPP; | 1216 | return -EOPNOTSUPP; |
1217 | 1217 | ||
1218 | len = min(ci->sector_count, max_io_len_target_boundary(ci->sector, ti)); | 1218 | if (!ti->split_discard_requests) |
1219 | len = min(ci->sector_count, max_io_len_target_boundary(ci->sector, ti)); | ||
1220 | else | ||
1221 | len = min(ci->sector_count, max_io_len(ci->sector, ti)); | ||
1219 | 1222 | ||
1220 | __issue_target_requests(ci, ti, ti->num_discard_requests, len); | 1223 | __issue_target_requests(ci, ti, ti->num_discard_requests, len); |
1221 | 1224 | ||
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 { | |||
218 | unsigned discards_supported:1; | 218 | unsigned discards_supported:1; |
219 | 219 | ||
220 | /* | 220 | /* |
221 | * Set if the target required discard request to be split | ||
222 | * on max_io_len boundary. | ||
223 | */ | ||
224 | unsigned split_discard_requests:1; | ||
225 | |||
226 | /* | ||
221 | * Set if this target does not return zeroes on discarded blocks. | 227 | * Set if this target does not return zeroes on discarded blocks. |
222 | */ | 228 | */ |
223 | unsigned discard_zeroes_data_unsupported:1; | 229 | unsigned discard_zeroes_data_unsupported:1; |