summaryrefslogtreecommitdiffstats
path: root/drivers/sbus
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-05-08 11:54:12 +0900
committerJens Axboe <jens.axboe@oracle.com>2009-05-11 09:52:17 +0200
commit6b0bf407b586b6ba8e060ad9979cb2bc3370b7eb (patch)
tree1c2c5a103d36298662b6af056f2a8fc2aa28e987 /drivers/sbus
parent1498ada7a8e80afe324f2b8d86158925d0096ec9 (diff)
downloadlinux-stable-6b0bf407b586b6ba8e060ad9979cb2bc3370b7eb.tar.gz
linux-stable-6b0bf407b586b6ba8e060ad9979cb2bc3370b7eb.tar.bz2
linux-stable-6b0bf407b586b6ba8e060ad9979cb2bc3370b7eb.zip
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: Tejun Heo <tj@kernel.org> Cc: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/sbus')
-rw-r--r--drivers/sbus/char/jsflash.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/sbus/char/jsflash.c b/drivers/sbus/char/jsflash.c
index d56ddaa77036..f572a4a1d141 100644
--- a/drivers/sbus/char/jsflash.c
+++ b/drivers/sbus/char/jsflash.c
@@ -186,31 +186,37 @@ static void jsfd_do_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) {
struct jsfd_part *jdp = req->rq_disk->private_data;
unsigned long offset = blk_rq_pos(req) << 9;
size_t len = blk_rq_cur_bytes(req);
+ int err = -EIO;
- if ((offset + len) > jdp->dsize) {
- __blk_end_request_cur(req, -EIO);
- continue;
- }
+ if ((offset + len) > jdp->dsize)
+ goto end;
if (rq_data_dir(req) != READ) {
printk(KERN_ERR "jsfd: write\n");
- __blk_end_request_cur(req, -EIO);
- continue;
+ goto end;
}
if ((jdp->dbase & 0xff000000) != 0x20000000) {
printk(KERN_ERR "jsfd: bad base %x\n", (int)jdp->dbase);
- __blk_end_request_cur(req, -EIO);
- continue;
+ goto end;
}
jsfd_read(req->buffer, jdp->dbase + offset, len);
-
- __blk_end_request_cur(req, 0);
+ err = 0;
+ end:
+ if (!__blk_end_request_cur(req, err)) {
+ req = elv_next_request(q);
+ if (req)
+ blkdev_dequeue_request(req);
+ }
}
}