Messages in this thread | | | Date | Fri, 11 Jan 2008 13:14:21 +0100 | From | Jens Axboe <> | Subject | Re: [PATCH] [MEMSTICK] Initial commit for Sony MemoryStick support |
| |
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
| |