Re: Question about ll_rw_blk.c, add_request()

Ulrich Windl (Ulrich.Windl@rz.uni-regensburg.de)
Thu, 18 Apr 1996 10:14:48 +0200


On 17 Apr 96 at 13:23, Stephen C. Tweedie wrote:

> Hi,
>
> On Tue, 16 Apr 1996 13:05:19 +0200 (MESZ), Bernd Schmidt
> <crux@pool.informatik.rwth-aachen.de> said:
>
> > Just one short question to make sure I understand the code: In
> > add_request(), new requests for the hardware are put in a queue. I
> > think that there are not supposed to be several requests for the
> > same sector in the queue at the same time, e.g. one reading the
> > sector and one writing it.
>
> Actually, the low level device code will work perfectly happily with
> multiple IO requests for a single sector. The request list is just a
> list of independent outstanding requests, and there are no particular
> restrictions on what the requests may be. The only special case is of
> strictly adjacent requests, which get merged to improve performance;
> overlapping requests do not get merged.

I'm afraid you missed the point. When a write and a read request for
the same sector are on a request queue, the kernel reorders the reads
before writes (or I'm wrong)...

>
> > I think that the buffer and page caches try to avoid this
> > situation. Is this correct?
>
> Yes. Obviously, there is scope for much confusion if you submit
> two simultaneous IO requests for one sector, so it is best to avoid
> that, but it's up to the higher layers to make sure it doesn't
> happen.
>
> Cheers,
> Stephen.
> --
> Stephen Tweedie <sct@dcs.ed.ac.uk>
> Department of Computer Science, Edinburgh University, Scotland.

Ulrich