Commit 23430468 authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe

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: default avatarTejun Heo <tj@kernel.org>
Cc: Adrian McMenamin <adrian@mcmen.demon.co.uk>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 296b2f6a
...@@ -638,33 +638,31 @@ static void gdrom_readdisk_dma(struct work_struct *work) ...@@ -638,33 +638,31 @@ static void gdrom_readdisk_dma(struct work_struct *work)
kfree(read_command); 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) static void gdrom_request(struct request_queue *rq)
{ {
struct request *req; struct request *req;
while ((req = elv_next_request(rq)) != NULL) { while ((req = elv_next_request(rq)) != NULL) {
blkdev_dequeue_request(req);
if (!blk_fs_request(req)) { if (!blk_fs_request(req)) {
printk(KERN_DEBUG "GDROM: Non-fs request ignored\n"); 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) { if (rq_data_dir(req) != READ) {
printk(KERN_NOTICE "GDROM: Read only device -"); printk(KERN_NOTICE "GDROM: Read only device -");
printk(" write request ignored\n"); 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 * Add to list of deferred work and then schedule
__blk_end_request_cur(req, -EIO); * workqueue.
*/
list_add_tail(&req->queuelist, &gdrom_deferred);
schedule_work(&work);
} }
} }
......
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