Commit 12fc0f49 authored by Mikulas Patocka's avatar Mikulas Patocka Committed by Alasdair G Kergon

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: default avatarMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent 67a46dad
...@@ -309,7 +309,11 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where, ...@@ -309,7 +309,11 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where,
unsigned num_bvecs; unsigned num_bvecs;
sector_t remaining = where->count; sector_t remaining = where->count;
while (remaining) { /*
* where->count may be zero if rw holds a write barrier and we
* need to send a zero-sized barrier.
*/
do {
/* /*
* Allocate a suitably sized-bio. * Allocate a suitably sized-bio.
*/ */
...@@ -339,7 +343,7 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where, ...@@ -339,7 +343,7 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where,
atomic_inc(&io->count); atomic_inc(&io->count);
submit_bio(rw, bio); submit_bio(rw, bio);
} } while (remaining);
} }
static void dispatch_io(int rw, unsigned int num_regions, static void dispatch_io(int rw, unsigned int num_regions,
...@@ -360,7 +364,7 @@ static void dispatch_io(int rw, unsigned int num_regions, ...@@ -360,7 +364,7 @@ static void dispatch_io(int rw, unsigned int num_regions,
*/ */
for (i = 0; i < num_regions; i++) { for (i = 0; i < num_regions; i++) {
*dp = old_pages; *dp = old_pages;
if (where[i].count) if (where[i].count || (rw & (1 << BIO_RW_BARRIER)))
do_region(rw, i, where + i, dp, io); do_region(rw, i, where + i, dp, io);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment