aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-atapi.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-05-07 22:53:59 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-05-11 03:52:14 -0400
commit8f6205cd572fece673da0255d74843680f67f879 (patch)
treebb89c1c5fe4436f5a0ec27f0d96074c7031a83ae /drivers/ide/ide-atapi.c
parent1011c1b9f2e45ce7c6e38888d2b83936aec38771 (diff)
ide: dequeue in-flight request
ide generally has single request in flight and tracks it using hwif->rq and all state handlers follow the following convention. * ide_started is returned if the request is in flight. * ide_stopped is returned if the queue needs to be restarted. The request might or might not have been processed fully or partially. * hwif->rq is set to NULL, when an issued request completes. So, dequeueing model can be implemented by dequeueing after fetch, requeueing if hwif->rq isn't NULL on ide_stopped return and doing about the same thing on completion / port unlock paths. These changes can be made in ide-io proper. In addition to the above main changes, the following updates are necessary. * ide-cd shouldn't dequeue a request when issuing REQUEST SENSE for it as the request is already dequeued. * ide-atapi uses request queue as stack when issuing REQUEST SENSE to put the REQUEST SENSE in front of the failed request. This now needs to be done using requeueing. [ Impact: dequeue in-flight request ] Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Cc: Borislav Petkov <petkovbb@googlemail.com> Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/ide/ide-atapi.c')
-rw-r--r--drivers/ide/ide-atapi.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index 792534db8f85..2874c3d703a9 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -246,6 +246,7 @@ EXPORT_SYMBOL_GPL(ide_queue_sense_rq);
246 */ 246 */
247void ide_retry_pc(ide_drive_t *drive) 247void ide_retry_pc(ide_drive_t *drive)
248{ 248{
249 struct request *failed_rq = drive->hwif->rq;
249 struct request *sense_rq = &drive->sense_rq; 250 struct request *sense_rq = &drive->sense_rq;
250 struct ide_atapi_pc *pc = &drive->request_sense_pc; 251 struct ide_atapi_pc *pc = &drive->request_sense_pc;
251 252
@@ -260,8 +261,17 @@ void ide_retry_pc(ide_drive_t *drive)
260 if (drive->media == ide_tape) 261 if (drive->media == ide_tape)
261 set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags); 262 set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags);
262 263
263 if (ide_queue_sense_rq(drive, pc)) 264 /*
264 ide_complete_rq(drive, -EIO, blk_rq_bytes(drive->hwif->rq)); 265 * Push back the failed request and put request sense on top
266 * of it. The failed command will be retried after sense data
267 * is acquired.
268 */
269 blk_requeue_request(failed_rq->q, failed_rq);
270 drive->hwif->rq = NULL;
271 if (ide_queue_sense_rq(drive, pc)) {
272 blkdev_dequeue_request(failed_rq);
273 ide_complete_rq(drive, -EIO, blk_rq_bytes(failed_rq));
274 }
265} 275}
266EXPORT_SYMBOL_GPL(ide_retry_pc); 276EXPORT_SYMBOL_GPL(ide_retry_pc);
267 277