Commit 6b0bf407 authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe

jsflash: dequeue in-flight request

jsflash processes requests one-by-one synchronously from a kthread and
can be easily converted to dequeueing model.  Convert it.

[ Impact: dequeue in-flight request ]
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 1498ada7
...@@ -186,31 +186,37 @@ static void jsfd_do_request(struct request_queue *q) ...@@ -186,31 +186,37 @@ static void jsfd_do_request(struct request_queue *q)
{ {
struct request *req; struct request *req;
while ((req = elv_next_request(q)) != NULL) { req = elv_next_request(q);
if (req)
blkdev_dequeue_request(req);
while (req) {
struct jsfd_part *jdp = req->rq_disk->private_data; struct jsfd_part *jdp = req->rq_disk->private_data;
unsigned long offset = blk_rq_pos(req) << 9; unsigned long offset = blk_rq_pos(req) << 9;
size_t len = blk_rq_cur_bytes(req); size_t len = blk_rq_cur_bytes(req);
int err = -EIO;
if ((offset + len) > jdp->dsize) { if ((offset + len) > jdp->dsize)
__blk_end_request_cur(req, -EIO); goto end;
continue;
}
if (rq_data_dir(req) != READ) { if (rq_data_dir(req) != READ) {
printk(KERN_ERR "jsfd: write\n"); printk(KERN_ERR "jsfd: write\n");
__blk_end_request_cur(req, -EIO); goto end;
continue;
} }
if ((jdp->dbase & 0xff000000) != 0x20000000) { if ((jdp->dbase & 0xff000000) != 0x20000000) {
printk(KERN_ERR "jsfd: bad base %x\n", (int)jdp->dbase); printk(KERN_ERR "jsfd: bad base %x\n", (int)jdp->dbase);
__blk_end_request_cur(req, -EIO); goto end;
continue;
} }
jsfd_read(req->buffer, jdp->dbase + offset, len); jsfd_read(req->buffer, jdp->dbase + offset, len);
err = 0;
__blk_end_request_cur(req, 0); end:
if (!__blk_end_request_cur(req, err)) {
req = elv_next_request(q);
if (req)
blkdev_dequeue_request(req);
}
} }
} }
......
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