aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2009-04-09 00:27:14 +0100
committerAlasdair G Kergon <agk@redhat.com>2009-04-09 00:27:14 +0100
commit54d9a1b4513b96cbd835ca6866c6a604d194b2ae (patch)
tree42813374e137f5ac6d9d7aedfae02a089b6443a6
parent1eb787ec183d1267cac95aae632e92dee05ed50a (diff)
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: Alasdair G Kergon <agk@redhat.com>
-rw-r--r--drivers/md/dm.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 7cac7220937..bb97ec8d664 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -929,7 +929,6 @@ out:
*/
static int dm_request(struct request_queue *q, struct bio *bio)
{
- int r = -EIO;
int rw = bio_data_dir(bio);
struct mapped_device *md = q->queuedata;
int cpu;
@@ -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)) {
up_read(&md->io_lock);
- if (bio_rw(bio) != READA)
- r = queue_io(md, bio);
+ if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags)) &&
+ bio_rw(bio) == READA) {
+ bio_io_error(bio);
+ return 0;
+ }
- if (r <= 0)
- goto out_req;
+ if (!queue_io(md, bio))
+ return 0;
/*
* 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)
__split_and_process_bio(md, bio);
up_read(&md->io_lock);
return 0;
-
-out_req:
- if (r < 0)
- bio_io_error(bio);
-
- return 0;
}
static void dm_unplug_all(struct request_queue *q)