diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2012-07-27 10:08:03 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2012-07-27 10:08:03 -0400 |
commit | 7acf0277cea0f2da89ffffcc9892bea23f618e63 (patch) | |
tree | 5f5c77f9ab0750826691d53a027cdcd786771fbb | |
parent | 55f2b8bdb0c7387eb2dc645b9ecbe5d0faa6b54e (diff) |
dm: introduce split_discard_requests
This patch introduces a new variable split_discard_requests. It can be
set by targets so that discard requests are split on max_io_len
boundaries.
When split_discard_requests is not set, discard requests are only split on
boundaries between targets, as was the case before this patch.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
-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; |