Re: [PATCH] [MEMSTICK] Initial commit for Sony MemoryStick support
From: Jens Axboe
Date: Fri Jan 11 2008 - 07:14:35 EST
On Thu, Jan 10 2008, Andrew Morton wrote:
> > +static void mspro_block_request(struct request_queue *q)
> > +{
> > + struct memstick_dev *card = q->queuedata;
> > + struct mspro_block_data *msb = memstick_get_drvdata(card);
> > + struct request *req = NULL;
> > +
> > + if (!msb->q_thread) {
> > + for (req = elv_next_request(q); req;
> > + req = elv_next_request(q)) {
> > + while (end_that_request_chunk(req, -ENODEV,
> > + req->current_nr_sectors
> > + << 9)) {}
> > + end_that_request_last(req, -ENODEV);
> > + }
> > + } else {
> > + msb->has_request = 1;
> > + wake_up_all(&msb->q_wait);
> > + }
> > +}
>
> Suggest that you cc Jens on this, see if he can check it all over.
It's suboptimal and doesn't work for non-fs request. Just use
end_queued_request() instead:
if (msb->q_thread) {
msb->has_request = 1;
wake_up(&msb->q_wait);
} else {
while ((req = elv_next_request(q)) != NULL)
end_queued_request(req, -ENODEV);
}
which is simpler and gets all cases correct. Reordering for normal case
as well.
--
Jens Axboe
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/