Subject: Re: Overlapping bread(9) behaviour
To: None <rumble@ephemeral.org>
From: Thor Lancelot Simon <tls@rek.tjls.com>
List: tech-kern
Date: 07/01/2007 15:01:44
On Sun, Jul 01, 2007 at 12:53:37PM -0400, Stephen M. Rumble wrote:
> Hi all,
> 
> I'm running into a strange behaviour while using bread(9) and am  
> unsure whether I misunderstand how it's supposed to behave, am running  
> into some sort of bug, or have otherwise misused the subsystem.
> 
> The problem is that if I read one block from offset X, and then later  
> read more than one block from the same offset X, the overlapping block  
> contents are fine, but the rest is garbage. Here's a short code example:

This is not how the buffer cache has ever worked.  The code basically
assumes that, from the point of view of the caller of the buffer cache
routines, the disk is divided into a fixed number of buffers of fixed size;
so all I/Os to/from a given offset from the front of the disk must be done
with the same size.  When clustered filesystem I/O was done through the
buffer cache, this was worked around in a fairly nasty way.

I would not be displeased if you changed the buffer cache code so that
this were no longer the case, and I doubt anyone else would either.

Thor