Jens Axboe wrote:

On Tue, Aug 02 2005, Steven Scholz wrote:

Jens Axboe wrote:


On Tue, Aug 02 2005, Steven Scholz wrote:


Jens Axboe wrote:



It's not the right way, it only solves a little part of the problem.
Killing a request with an error usually looks like this:

        blkdev_dequeue_request(rq);
        end_that_request_first(rq, 0, rq->hard_nr_sectors);
        end_that_request_last(rq);

How do I get the request? do_ide_request() only get the complete request_queue_t *q. Shell I use elv_next_request() ?

Yes.

So my workaround for now would be

--- linux-2.6.13-rc5/drivers/ide/ide-io.c
+++ linux-2.6.13-rc4-at91-multiIO/drivers/ide/ide-io.c
@@ -1230,7 +1264,18 @@ void do_ide_request(request_queue_t *q)
{
       ide_drive_t *drive = q->queuedata;

-       ide_do_request(HWGROUP(drive), IDE_NO_IRQ);
+       if (drive->present)
+               ide_do_request(HWGROUP(drive), IDE_NO_IRQ);
+       else {
+               struct request  *rq;
+ printk("%s() drive is not present anymore! Kill request.\n", __FUNCTION__);
+               rq = elv_next_request(q);
+               if (rq) {
+                       blkdev_dequeue_request(rq);
+                       end_that_request_first(rq, 0, rq->hard_nr_sectors);
+                       end_that_request_last(rq);
+               }
+       }


Pretty close. Make the killing a loop:

...

[PATCH] ide: kill requests when drive is not present anymore

Signed-off-by: Steven Scholz <[EMAIL PROTECTED]>

Ok?

Change the CHANGELOG at your will.

--
Steven
--- linux-2.6.13-rc5/drivers/ide/ide-io.c       2005-06-17 21:48:29.000000000 
+0200
+++ linux-2.6.13-rc4-at91-multiIO/drivers/ide/ide-io.c  2005-08-02 
15:46:53.000000000 +0200
@@ -1230,7 +1257,17 @@ void do_ide_request(request_queue_t *q)
 {
        ide_drive_t *drive = q->queuedata;
 
-       ide_do_request(HWGROUP(drive), IDE_NO_IRQ);
+       if (drive->present)
+               ide_do_request(HWGROUP(drive), IDE_NO_IRQ);
+       else {
+               struct request  *rq;
+               printk(KERN_WARNING "%s: not present, killing requests\n", 
drive->name);
+               while ((rq = elv_next_request(q)) != NULL) {
+                       blkdev_dequeue_request(rq);
+                       end_that_request_first(rq, 0, rq->hard_nr_sectors);
+                       end_that_request_last(rq);
+               }
+       }
 }
 
 /*

Reply via email to