diff options
Diffstat (limited to 'drivers/md/dm-io.c')
-rw-r--r-- | drivers/md/dm-io.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c index 03940bf36f6c..b808cbe22678 100644 --- a/drivers/md/dm-io.c +++ b/drivers/md/dm-io.c | |||
@@ -328,11 +328,17 @@ static void do_region(int op, int op_flags, unsigned region, | |||
328 | /* | 328 | /* |
329 | * Allocate a suitably sized-bio. | 329 | * Allocate a suitably sized-bio. |
330 | */ | 330 | */ |
331 | if ((op == REQ_OP_DISCARD) || (op == REQ_OP_WRITE_SAME)) | 331 | switch (op) { |
332 | case REQ_OP_DISCARD: | ||
333 | num_bvecs = 0; | ||
334 | break; | ||
335 | case REQ_OP_WRITE_SAME: | ||
332 | num_bvecs = 1; | 336 | num_bvecs = 1; |
333 | else | 337 | break; |
338 | default: | ||
334 | num_bvecs = min_t(int, BIO_MAX_PAGES, | 339 | num_bvecs = min_t(int, BIO_MAX_PAGES, |
335 | dm_sector_div_up(remaining, (PAGE_SIZE >> SECTOR_SHIFT))); | 340 | dm_sector_div_up(remaining, (PAGE_SIZE >> SECTOR_SHIFT))); |
341 | } | ||
336 | 342 | ||
337 | bio = bio_alloc_bioset(GFP_NOIO, num_bvecs, io->client->bios); | 343 | bio = bio_alloc_bioset(GFP_NOIO, num_bvecs, io->client->bios); |
338 | bio->bi_iter.bi_sector = where->sector + (where->count - remaining); | 344 | bio->bi_iter.bi_sector = where->sector + (where->count - remaining); |