Commit 54d9a1b4 authored by Alasdair G Kergon's avatar Alasdair G Kergon

dm: simplify dm_request loop

Refactor the code in dm_request().

Require the new DMF_BLOCK_FOR_SUSPEND flag on readahead bios we will
discard so we don't drop such bios while processing a barrier.
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent 1eb787ec
...@@ -929,7 +929,6 @@ static int dm_merge_bvec(struct request_queue *q, ...@@ -929,7 +929,6 @@ static int dm_merge_bvec(struct request_queue *q,
*/ */
static int dm_request(struct request_queue *q, struct bio *bio) static int dm_request(struct request_queue *q, struct bio *bio)
{ {
int r = -EIO;
int rw = bio_data_dir(bio); int rw = bio_data_dir(bio);
struct mapped_device *md = q->queuedata; struct mapped_device *md = q->queuedata;
int cpu; int cpu;
...@@ -957,11 +956,14 @@ static int dm_request(struct request_queue *q, struct bio *bio) ...@@ -957,11 +956,14 @@ static int dm_request(struct request_queue *q, struct bio *bio)
while (test_bit(DMF_QUEUE_IO_TO_THREAD, &md->flags)) { while (test_bit(DMF_QUEUE_IO_TO_THREAD, &md->flags)) {
up_read(&md->io_lock); up_read(&md->io_lock);
if (bio_rw(bio) != READA) if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags)) &&
r = queue_io(md, bio); bio_rw(bio) == READA) {
bio_io_error(bio);
return 0;
}
if (r <= 0) if (!queue_io(md, bio))
goto out_req; return 0;
/* /*
* We're in a while loop, because someone could suspend * We're in a while loop, because someone could suspend
...@@ -973,12 +975,6 @@ static int dm_request(struct request_queue *q, struct bio *bio) ...@@ -973,12 +975,6 @@ static int dm_request(struct request_queue *q, struct bio *bio)
__split_and_process_bio(md, bio); __split_and_process_bio(md, bio);
up_read(&md->io_lock); up_read(&md->io_lock);
return 0; return 0;
out_req:
if (r < 0)
bio_io_error(bio);
return 0;
} }
static void dm_unplug_all(struct request_queue *q) static void dm_unplug_all(struct request_queue *q)
......
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