aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/dm-io.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c
index f6a714c5aab0..10f457ca6af2 100644
--- a/drivers/md/dm-io.c
+++ b/drivers/md/dm-io.c
@@ -309,7 +309,11 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where,
309 unsigned num_bvecs; 309 unsigned num_bvecs;
310 sector_t remaining = where->count; 310 sector_t remaining = where->count;
311 311
312 while (remaining) { 312 /*
313 * where->count may be zero if rw holds a write barrier and we
314 * need to send a zero-sized barrier.
315 */
316 do {
313 /* 317 /*
314 * Allocate a suitably sized-bio. 318 * Allocate a suitably sized-bio.
315 */ 319 */
@@ -339,7 +343,7 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where,
339 343
340 atomic_inc(&io->count); 344 atomic_inc(&io->count);
341 submit_bio(rw, bio); 345 submit_bio(rw, bio);
342 } 346 } while (remaining);
343} 347}
344 348
345static void dispatch_io(int rw, unsigned int num_regions, 349static void dispatch_io(int rw, unsigned int num_regions,
@@ -360,7 +364,7 @@ static void dispatch_io(int rw, unsigned int num_regions,
360 */ 364 */
361 for (i = 0; i < num_regions; i++) { 365 for (i = 0; i < num_regions; i++) {
362 *dp = old_pages; 366 *dp = old_pages;
363 if (where[i].count) 367 if (where[i].count || (rw & (1 << BIO_RW_BARRIER)))
364 do_region(rw, i, where + i, dp, io); 368 do_region(rw, i, where + i, dp, io);
365 } 369 }
366 370