aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cdrom
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-05-07 22:54:14 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-05-11 03:52:17 -0400
commit2343046826a8ca426b07601d9593ee046c298b68 (patch)
treee7250f784a3168506b70d7e8b3f1bbcf9f733953 /drivers/cdrom
parent296b2f6ae654581adc27f0d6f0af454c7f3d06ee (diff)
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)
638 kfree(read_command); 638 kfree(read_command);
639} 639}
640 640
641static void gdrom_request_handler_dma(struct request *req)
642{
643 /* dequeue, add to list of deferred work
644 * and then schedule workqueue */
645 blkdev_dequeue_request(req);
646 list_add_tail(&req->queuelist, &gdrom_deferred);
647 schedule_work(&work);
648}
649
650static void gdrom_request(struct request_queue *rq) 641static void gdrom_request(struct request_queue *rq)
651{ 642{
652 struct request *req; 643 struct request *req;
653 644
654 while ((req = elv_next_request(rq)) != NULL) { 645 while ((req = elv_next_request(rq)) != NULL) {
646 blkdev_dequeue_request(req);
647
655 if (!blk_fs_request(req)) { 648 if (!blk_fs_request(req)) {
656 printk(KERN_DEBUG "GDROM: Non-fs request ignored\n"); 649 printk(KERN_DEBUG "GDROM: Non-fs request ignored\n");
657 __blk_end_request_cur(req, -EIO); 650 __blk_end_request_all(req, -EIO);
651 continue;
658 } 652 }
659 if (rq_data_dir(req) != READ) { 653 if (rq_data_dir(req) != READ) {
660 printk(KERN_NOTICE "GDROM: Read only device -"); 654 printk(KERN_NOTICE "GDROM: Read only device -");
661 printk(" write request ignored\n"); 655 printk(" write request ignored\n");
662 __blk_end_request_cur(req, -EIO); 656 __blk_end_request_all(req, -EIO);
657 continue;
663 } 658 }
664 if (blk_rq_sectors(req)) 659
665 gdrom_request_handler_dma(req); 660 /*
666 else 661 * Add to list of deferred work and then schedule
667 __blk_end_request_cur(req, -EIO); 662 * workqueue.
663 */
664 list_add_tail(&req->queuelist, &gdrom_deferred);
665 schedule_work(&work);
668 } 666 }
669} 667}
670 668