Subject: Re: [HACKERS] PostgreSQL, NetBSD and NFS
To: Tom Lane <>
From: Thor Lancelot Simon <>
List: current-users
Date: 02/05/2003 16:06:02
On Wed, Feb 05, 2003 at 03:45:11PM -0500, Tom Lane wrote:
> Thor Lancelot Simon <> writes:
> >> Unless NetBSD has changed from its heritage, the kernel disk cache
> >> buffers are 8K, and so an 8K NFS read or write would never cross a
> >> cache buffer boundary.  But 32K would.
> > I don't know what "heritage" you're referring to, but it has never been
> > the case that NetBSD's buffer cache has used fixed-size 8K disk buffers,
> > and I don't believe that it was ever the case for any Net2 or 4.4-derived
> > system.
> Could be.  By "heritage" I meant BSD-without-any-adjective.  It is
> perfectly clear from Leffler, McKusick et al. (_The Design and
> Implementation of the 4.3BSD UNIX Operating System_) that back then,
> 8K was the standard filesystem block size.

FWIW, the fact that the default block size for one particular on-disk
filesystem happens to be 8K doesn't really imply anything about the
design or implementation of the buffer cache, certainly not that it
uses fixed-size buffers that are each 8K in size.  This is particularly
evident in this case, since there's not even any on-disk filesystem
involved, and NFS doesn't really have a "block size" in the sense in
which you seem to be using that term.

I don't have my copy of the 4.3 book here for comparison, but the 4.4
book makes the data structures associated with the old-style buffer
cache pretty clear: buffers of fixed virtual but variable physical size, 
each with memory pages attached as necessary, so a single buffer may
cache anywhere from a single page to MAXPHYS (usually 64K) of data.  This
code isn't used for ordinary file data in NetBSD any longer, but it is
in fact the way the Berkeley code works and it's how things worked in its
various descendants for a long time.

Of course, the way the 4.4BSD NFS code interfaces to the buffer cache is
pretty strange, twisty, and horrible and there have been and probably
still are bugs there.  The one you suggest seems pretty odd, however,
since there are no physical disk blocks involved as this system is an
NFS *client*.

 Thor Lancelot Simon	                            
   But as he knew no bad language, he had called him all the names of common
 objects that he could think of, and had screamed: "You lamp!  You towel!  You
 plate!" and so on.              --Sigmund Freud