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:
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);
}
and it looks ok to me. Change the printk to something a little more
appropriate as well, ala
printk(KERN_WARNING "%s: not present, killing requests\n", drive->name);
--
Jens Axboe
-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html