Re: bio_chain: proposed solution for bio_alloc failure and large IO simplification

From: Jens Axboe (
Date: Sat Jun 15 2002 - 03:50:11 EST

On Sat, Jun 15 2002, Adam J. Richter wrote:
> >> At any time, there could be only one "hinted" bio in a
> >> request: the last bio in the request. So you only have to
> >> clear the hint when:
> >>
> >> 1. you merge bio's,
> >> 2. elv_next_request is called,
> >> 3. newbio is submitted.
> >>
> >> In all three cases q->queue_lock gets taken, so we should
> >> not need to add any additional spin_lock_irq's, and the two lines
> >> to clear the hint pointers should be trivial.
> >This logic is flawed. As I said, once you pass the bio to submit_bio,
> >you can't maintain a pointer to it for these purposes. Grabbing the
> >queue_lock guarentees absolutely nothing in this regard. Consider loop,
> >for instance. I/O could be completed by the time bio_submit returns.
> So, I need a fourth location at in generic_make_request
> just before the call to q->make_request_fn, like so:
> if (q->make_request_fn != __make_request) {
> int flags;
> spin_lock_irqsave(q->lock, flags);
> clear_hint(bio);
> spin_unlock_irqrestore(q->lock, flags);
> }
> ret = q->make_request_fn(q, bio);

Irk, this is ugly. But how you are moving away from the initial goal (or
maybe this was your goal the whole time, just a single merge hint?) of
passing back the hint instead of maintaing it in the queue. So let me
ask, are you aware of the last_merge I/O scheduler hint? Which does
exactly this already...

Jens Axboe

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to More majordomo info at Please read the FAQ at

This archive was generated by hypermail 2b29 : Sat Jun 15 2002 - 22:00:33 EST