Re: device plugging

Jens Axboe (axboe@suse.de)
Sat, 7 Jul 2001 12:27:00 +0200


On Sat, Jul 07 2001, gopi krishna wrote:
> Why do we need a dummy req for plugging.
> As i understood only thing plugging does is to, on arrival of new req if
> the dev queue is empty, puts a dummy req on the queue, and schedules the
> unplug routine on tq_disk, which on being scheduled calls the strategy
> routine.

You are reading 2.2 sources, maybe try the 2.4 sources as they are
easier to follow in this regard IMHO.

What happens is that we assign dev->current_request &dev->plug, so that
the front request is recognizable as the 'plug' and not a valid request.
You seem to completely misunderstand plugging -- if we just put the new
request on the queue and scheduled tq_disk, then there would be no
plugging going on at all. What we do instead is add this specific 'plug
request' and queue lots of stuff behind that. Not until someone needs
the data on the queue is the 'plug request' removed and the request_fn
run. This happens for instance if _someone else_ calls tq_disk,
typically __wait_on_buffer.

> So we can as well put the new req on the queue without dummy req.

Wrong

> If i'm incorrect please explain what's exact process and the reason

See?

-- 
Jens Axboe

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/