Subject: Re: ext2fs is in the tree
To: Chris G. Demetriou <cgd@pa.dec.com>
From: Paul Kranenburg <pk@cs.few.eur.nl>
List: current-users
Date: 06/13/1997 01:07:01
> 
> According to a recent PR, with a fix to vfs_bio.c, LFS at least gets
> to the point where you can copy a source tree to it, etc.
> 
> Of course, Charles vehemently pointed out that that fix was
> unnecessary and incorrect, when I asked him to look at the PR.
> (Before one of his mods to the bio code, it had code that did the same
> thing that the fix does...)

I looked at the patch briefly last week and thought it didn't handle
the read-ahead case correctly.

Today I found myself puzzling once again over relationship between
several B_* flags. Clearly, not all individual flags can be used
independently of each other, but it seems that evidence on
"correct" B_* flag usage can be had only by browsing through 
pieces of filesystem code.  A buf(9) is much wanted...

In particular, a test for `(B_DONE|B_DELWRI)' is apparently the way
to tell that a buffer is "incore" and no I/O is in progress.
I'd argue that B_DELWRI should imply the B_DONE bit, since the buffer
contents is valid and its I/O "completed" the moment the data were
copied into it. bdwrite() takes care of this, but LFS apparently
violates this invariant (that I just invented..); see lfs_bio.c:119.

Also, it seems that in all cases where getblk() is used the test for
`(B_DONE|B_DELWRI)' can be replaced a test for B_CACHE (which suddenly
makes such code look much "friendlier"..), at least when every user
of getblk() promises to fill the buffer before releasing it. If I'm
not mistaken, vfs_cluster is assuming this.

-pk