diff options
Diffstat (limited to 'drivers/block/z2ram.c')
-rw-r--r-- | drivers/block/z2ram.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c index 80754cdd3119..4575171e5beb 100644 --- a/drivers/block/z2ram.c +++ b/drivers/block/z2ram.c | |||
@@ -70,15 +70,18 @@ static struct gendisk *z2ram_gendisk; | |||
70 | static void do_z2_request(struct request_queue *q) | 70 | static 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 | unsigned long start = req->sector << 9; | 74 | req = blk_fetch_request(q); |
75 | unsigned long len = req->current_nr_sectors << 9; | 75 | while (req) { |
76 | unsigned long start = blk_rq_pos(req) << 9; | ||
77 | unsigned long len = blk_rq_cur_bytes(req); | ||
78 | int err = 0; | ||
76 | 79 | ||
77 | if (start + len > z2ram_size) { | 80 | if (start + len > z2ram_size) { |
78 | printk( KERN_ERR DEVICE_NAME ": bad access: block=%lu, count=%u\n", | 81 | printk( KERN_ERR DEVICE_NAME ": bad access: block=%lu, count=%u\n", |
79 | req->sector, req->current_nr_sectors); | 82 | blk_rq_pos(req), blk_rq_cur_sectors(req)); |
80 | end_request(req, 0); | 83 | err = -EIO; |
81 | continue; | 84 | goto done; |
82 | } | 85 | } |
83 | while (len) { | 86 | while (len) { |
84 | unsigned long addr = start & Z2RAM_CHUNKMASK; | 87 | unsigned long addr = start & Z2RAM_CHUNKMASK; |
@@ -93,7 +96,9 @@ static void do_z2_request(struct request_queue *q) | |||
93 | start += size; | 96 | start += size; |
94 | len -= size; | 97 | len -= size; |
95 | } | 98 | } |
96 | end_request(req, 1); | 99 | done: |
100 | if (!__blk_end_request_cur(req, err)) | ||
101 | req = blk_fetch_request(q); | ||
97 | } | 102 | } |
98 | } | 103 | } |
99 | 104 | ||