ide: ensure that we re-run the queue handler
authorJens Axboe <jaxboe@fusionio.com>
Sat, 26 Mar 2011 18:49:54 +0000 (19:49 +0100)
committerJens Axboe <jaxboe@fusionio.com>
Sat, 26 Mar 2011 18:49:54 +0000 (19:49 +0100)
The conversion to blk_delay_queue() missed parts of IDE.
Add a blk_delay_queue() to ensure that the request handler
gets reinvoked when it needs to.

Note that in all but one place the old plug re-run delay of
3 msecs is used, even though it probably could be shorter
for performance reasons in some of those cases.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
drivers/ide/ide-io.c

index f4077840d3abdbc027585617b8379304865dae81..0e406d73b2c8226da821bd3b2b7fb480354ed2cc 100644 (file)
@@ -440,6 +440,7 @@ void do_ide_request(struct request_queue *q)
        struct ide_host *host = hwif->host;
        struct request  *rq = NULL;
        ide_startstop_t startstop;
+       unsigned long queue_run_ms = 3; /* old plug delay */
 
        spin_unlock_irq(q->queue_lock);
 
@@ -459,6 +460,9 @@ repeat:
                prev_port = hwif->host->cur_port;
                if (drive->dev_flags & IDE_DFLAG_SLEEPING &&
                    time_after(drive->sleep, jiffies)) {
+                       unsigned long left = jiffies - drive->sleep;
+
+                       queue_run_ms = jiffies_to_msecs(left + 1);
                        ide_unlock_port(hwif);
                        goto plug_device;
                }
@@ -547,8 +551,10 @@ plug_device:
 plug_device_2:
        spin_lock_irq(q->queue_lock);
 
-       if (rq)
+       if (rq) {
                blk_requeue_request(q, rq);
+               blk_delay_queue(q, queue_run_ms);
+       }
 }
 
 void ide_requeue_and_plug(ide_drive_t *drive, struct request *rq)
@@ -562,6 +568,10 @@ void ide_requeue_and_plug(ide_drive_t *drive, struct request *rq)
                blk_requeue_request(q, rq);
 
        spin_unlock_irqrestore(q->queue_lock, flags);
+
+       /* Use 3ms as that was the old plug delay */
+       if (rq)
+               blk_delay_queue(q, 3);
 }
 
 static int drive_is_ready(ide_drive_t *drive)