Skip to content

Commit

Permalink
dm io: handle empty barriers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mikulas Patocka authored and Alasdair G Kergon committed Dec 10, 2009
1 parent 67a46da commit 12fc0f4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/md/dm-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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,
Expand All @@ -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);
}

Expand Down

0 comments on commit 12fc0f4

Please sign in to comment.