summaryrefslogtreecommitdiff
path: root/drivers/cdrom
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-05-08 11:54:14 +0900
committerJens Axboe <jens.axboe@oracle.com>2009-05-11 09:52:17 +0200
commit2343046826a8ca426b07601d9593ee046c298b68 (patch)
treee7250f784a3168506b70d7e8b3f1bbcf9f733953 /drivers/cdrom
parent296b2f6ae654581adc27f0d6f0af454c7f3d06ee (diff)
downloadlwn-2343046826a8ca426b07601d9593ee046c298b68.tar.gz
lwn-2343046826a8ca426b07601d9593ee046c298b68.zip
gdrom: dequeue in-flight request
gdrom already dequeues and fully completes requests on normal path and the error paths can be easily converted to do so too. Clean it up and dequeue requests on error paths too. While at it remove superflous blk_fs_request() && !blk_rq_sectors() condition check. [ Impact: dequeue in-flight request, cleanup ] Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Adrian McMenamin <adrian@mcmen.demon.co.uk> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/cdrom')
-rw-r--r--drivers/cdrom/gdrom.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
index 488423cab51a..3cc02bfe828d 100644
--- a/drivers/cdrom/gdrom.c
+++ b/drivers/cdrom/gdrom.c
@@ -638,33 +638,31 @@ static void gdrom_readdisk_dma(struct work_struct *work)
kfree(read_command);
}
-static void gdrom_request_handler_dma(struct request *req)
-{
- /* dequeue, add to list of deferred work
- * and then schedule workqueue */
- blkdev_dequeue_request(req);
- list_add_tail(&req->queuelist, &gdrom_deferred);
- schedule_work(&work);
-}
-
static void gdrom_request(struct request_queue *rq)
{
struct request *req;
while ((req = elv_next_request(rq)) != NULL) {
+ blkdev_dequeue_request(req);
+
if (!blk_fs_request(req)) {
printk(KERN_DEBUG "GDROM: Non-fs request ignored\n");
- __blk_end_request_cur(req, -EIO);
+ __blk_end_request_all(req, -EIO);
+ continue;
}
if (rq_data_dir(req) != READ) {
printk(KERN_NOTICE "GDROM: Read only device -");
printk(" write request ignored\n");
- __blk_end_request_cur(req, -EIO);
+ __blk_end_request_all(req, -EIO);
+ continue;
}
- if (blk_rq_sectors(req))
- gdrom_request_handler_dma(req);
- else
- __blk_end_request_cur(req, -EIO);
+
+ /*
+ * Add to list of deferred work and then schedule
+ * workqueue.
+ */
+ list_add_tail(&req->queuelist, &gdrom_deferred);
+ schedule_work(&work);
}
}