Re: PostgreSQL, NetBSD and NFS

From: Thor Lancelot Simon <tls(at)rek(dot)tjls(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, current-users(at)netbsd(dot)org, darcy(at)druid(dot)net
Subject: Re: PostgreSQL, NetBSD and NFS
Date: 2003-02-05 21:06:02
Message-ID: 20030205210602.GA15717@rek.tjls.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Feb 05, 2003 at 03:45:11PM -0500, Tom Lane wrote:
> Thor Lancelot Simon <tls(at)rek(dot)tjls(dot)com> 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 tls(at)rek(dot)tjls(dot)com
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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Oliver Elphick 2003-02-05 21:07:23 Re: [HACKERS] [ANNOUNCE] PostgreSQL v7.3.2 Released
Previous Message Michael Hertrick 2003-02-05 20:48:59 Re: PostgreSQL, NetBSD and NFS