aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/z2ram.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/z2ram.c')
-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;
70static void do_z2_request(struct request_queue *q) 70static void do_z2_request(struct request_queue *q)
71{ 71{
72 struct request *req; 72 struct request *req;
73 while ((req = elv_next_request(q)) != NULL) { 73
74 req = elv_next_request(q);
75 if (req)
76 blkdev_dequeue_request(req);
77
78 while (req) {
74 unsigned long start = blk_rq_pos(req) << 9; 79 unsigned long start = blk_rq_pos(req) << 9;
75 unsigned long len = blk_rq_cur_bytes(req); 80 unsigned long len = blk_rq_cur_bytes(req);
81 int err = 0;
76 82
77 if (start + len > z2ram_size) { 83 if (start + len > z2ram_size) {
78 printk( KERN_ERR DEVICE_NAME ": bad access: block=%lu, count=%u\n", 84 printk( KERN_ERR DEVICE_NAME ": bad access: block=%lu, count=%u\n",
79 blk_rq_pos(req), blk_rq_cur_sectors(req)); 85 blk_rq_pos(req), blk_rq_cur_sectors(req));
80 __blk_end_request_cur(req, -EIO); 86 err = -EIO;
81 continue; 87 goto done;
82 } 88 }
83 while (len) { 89 while (len) {
84 unsigned long addr = start & Z2RAM_CHUNKMASK; 90 unsigned long addr = start & Z2RAM_CHUNKMASK;
@@ -93,7 +99,12 @@ static void do_z2_request(struct request_queue *q)
93 start += size; 99 start += size;
94 len -= size; 100 len -= size;
95 } 101 }
96 __blk_end_request_cur(req, 0); 102 done:
103 if (!__blk_end_request_cur(req, err)) {
104 req = elv_next_request(q);
105 if (req)
106 blkdev_dequeue_request(req);
107 }
97 } 108 }
98} 109}
99 110