summaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-05-08 11:54:13 +0900
committerJens Axboe <jens.axboe@oracle.com>2009-05-11 09:52:17 +0200
commitfb3ac7f6b811eac8e0aafa3df1c16ed872e898a8 (patch)
treebfd7cab2afe52dc4eba37f6428a42c1e496454b0 /drivers/block
parent6b0bf407b586b6ba8e060ad9979cb2bc3370b7eb (diff)
downloadlinux-fb3ac7f6b811eac8e0aafa3df1c16ed872e898a8.tar.gz
linux-fb3ac7f6b811eac8e0aafa3df1c16ed872e898a8.tar.bz2
linux-fb3ac7f6b811eac8e0aafa3df1c16ed872e898a8.zip
z2ram: dequeue in-flight request
z2ram processes requests one-by-one synchronously and can be easily converted to dequeueing model. Convert it. [ Impact: dequeue in-flight request ] Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/z2ram.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c
index 6a1383834ecf..c909c1a3f650 100644
--- a/drivers/block/z2ram.c
+++ b/drivers/block/z2ram.c
@@ -70,15 +70,21 @@ static struct gendisk *z2ram_gendisk;
static void do_z2_request(struct request_queue *q)
{
struct request *req;
- while ((req = elv_next_request(q)) != NULL) {
+
+ req = elv_next_request(q);
+ if (req)
+ blkdev_dequeue_request(req);
+
+ while (req) {
unsigned long start = blk_rq_pos(req) << 9;
unsigned long len = blk_rq_cur_bytes(req);
+ int err = 0;
if (start + len > z2ram_size) {
printk( KERN_ERR DEVICE_NAME ": bad access: block=%lu, count=%u\n",
blk_rq_pos(req), blk_rq_cur_sectors(req));
- __blk_end_request_cur(req, -EIO);
- continue;
+ err = -EIO;
+ goto done;
}
while (len) {
unsigned long addr = start & Z2RAM_CHUNKMASK;
@@ -93,7 +99,12 @@ static void do_z2_request(struct request_queue *q)
start += size;
len -= size;
}
- __blk_end_request_cur(req, 0);
+ done:
+ if (!__blk_end_request_cur(req, err)) {
+ req = elv_next_request(q);
+ if (req)
+ blkdev_dequeue_request(req);
+ }
}
}