summaryrefslogtreecommitdiff
path: root/drivers/md/dm-io.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2009-12-11 02:52:22 +0300
committerAlasdair G Kergon <agk@redhat.com>2009-12-11 02:52:22 +0300
commit12fc0f49dc994d8d90dcf3df13f5b1ee5441288d (patch)
tree60959c326d01807f3e9a72bd1799717d0166ac6e /drivers/md/dm-io.c
parent67a46dad25ccc8910995d8671f7ec17a6bc823cb (diff)
downloadlinux-12fc0f49dc994d8d90dcf3df13f5b1ee5441288d.tar.xz
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>
Diffstat (limited to 'drivers/md/dm-io.c')
-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,
unsigned num_bvecs;
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.
*/
@@ -339,7 +343,7 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where,
atomic_inc(&io->count);
submit_bio(rw, bio);
- }
+ } while (remaining);
}
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++) {
*dp = old_pages;
- if (where[i].count)
+ if (where[i].count || (rw & (1 << BIO_RW_BARRIER)))
do_region(rw, i, where + i, dp, io);
}