diff options
Diffstat (limited to 'drivers/md/dm-io.c')
-rw-r--r-- | drivers/md/dm-io.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c index b808cbe22678..3702e502466d 100644 --- a/drivers/md/dm-io.c +++ b/drivers/md/dm-io.c | |||
@@ -312,9 +312,12 @@ static void do_region(int op, int op_flags, unsigned region, | |||
312 | */ | 312 | */ |
313 | if (op == REQ_OP_DISCARD) | 313 | if (op == REQ_OP_DISCARD) |
314 | special_cmd_max_sectors = q->limits.max_discard_sectors; | 314 | special_cmd_max_sectors = q->limits.max_discard_sectors; |
315 | else if (op == REQ_OP_WRITE_ZEROES) | ||
316 | special_cmd_max_sectors = q->limits.max_write_zeroes_sectors; | ||
315 | else if (op == REQ_OP_WRITE_SAME) | 317 | else if (op == REQ_OP_WRITE_SAME) |
316 | special_cmd_max_sectors = q->limits.max_write_same_sectors; | 318 | special_cmd_max_sectors = q->limits.max_write_same_sectors; |
317 | if ((op == REQ_OP_DISCARD || op == REQ_OP_WRITE_SAME) && | 319 | if ((op == REQ_OP_DISCARD || op == REQ_OP_WRITE_ZEROES || |
320 | op == REQ_OP_WRITE_SAME) && | ||
318 | special_cmd_max_sectors == 0) { | 321 | special_cmd_max_sectors == 0) { |
319 | dec_count(io, region, -EOPNOTSUPP); | 322 | dec_count(io, region, -EOPNOTSUPP); |
320 | return; | 323 | return; |
@@ -330,6 +333,7 @@ static void do_region(int op, int op_flags, unsigned region, | |||
330 | */ | 333 | */ |
331 | switch (op) { | 334 | switch (op) { |
332 | case REQ_OP_DISCARD: | 335 | case REQ_OP_DISCARD: |
336 | case REQ_OP_WRITE_ZEROES: | ||
333 | num_bvecs = 0; | 337 | num_bvecs = 0; |
334 | break; | 338 | break; |
335 | case REQ_OP_WRITE_SAME: | 339 | case REQ_OP_WRITE_SAME: |
@@ -347,7 +351,7 @@ static void do_region(int op, int op_flags, unsigned region, | |||
347 | bio_set_op_attrs(bio, op, op_flags); | 351 | bio_set_op_attrs(bio, op, op_flags); |
348 | store_io_and_region_in_bio(bio, io, region); | 352 | store_io_and_region_in_bio(bio, io, region); |
349 | 353 | ||
350 | if (op == REQ_OP_DISCARD) { | 354 | if (op == REQ_OP_DISCARD || op == REQ_OP_WRITE_ZEROES) { |
351 | num_sectors = min_t(sector_t, special_cmd_max_sectors, remaining); | 355 | num_sectors = min_t(sector_t, special_cmd_max_sectors, remaining); |
352 | bio->bi_iter.bi_size = num_sectors << SECTOR_SHIFT; | 356 | bio->bi_iter.bi_size = num_sectors << SECTOR_SHIFT; |
353 | remaining -= num_sectors; | 357 | remaining -= num_sectors; |