Commit 12fc0f49dc994d8d90dcf3df13f5b1ee5441288d

Authored by Mikulas Patocka
Committed by Alasdair G Kergon
1 parent 67a46dad25

dm io: handle empty barriers

Accept empty barriers in dm-io.

dm-io will process empty write barrier requests just like the other
read/write requests.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>

Showing 1 changed file with 7 additions and 3 deletions Side-by-side Diff

... ... @@ -309,7 +309,11 @@
309 309 unsigned num_bvecs;
310 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 318 * Allocate a suitably sized-bio.
315 319 */
... ... @@ -339,7 +343,7 @@
339 343  
340 344 atomic_inc(&io->count);
341 345 submit_bio(rw, bio);
342   - }
  346 + } while (remaining);
343 347 }
344 348  
345 349 static void dispatch_io(int rw, unsigned int num_regions,
... ... @@ -360,7 +364,7 @@
360 364 */
361 365 for (i = 0; i < num_regions; i++) {
362 366 *dp = old_pages;
363   - if (where[i].count)
  367 + if (where[i].count || (rw & (1 << BIO_RW_BARRIER)))
364 368 do_region(rw, i, where + i, dp, io);
365 369 }
366 370