* Change the usage of B_DONE so that it is only set when a buffer is in sync
with the data on disk.
* If a buffer is being waited for, don't put it on the age queue.
* Make sure to clear B_DONE when pages are stolen from a buffer.
* Make sure to clear B_CACHE after each use.
* If we find a buffer for the block we want with valid data, but it is too
small, panic. (This isn't supposed to happen.)
Fixes potential file corruption problems with clustering.
`b_dev' value of NODEV happens and is normal if the buffer is on its way
to the underlying device strategy function for the first time.
Also, MFS sillily uses a major device number (255) which cannot be used
to index bdevsw[]. Check marked with XXXs.
call biowait() but return `success' immediately. We can return `success'
because buffers with recorded errors are not returned by getblk().
(Takes care of PR#3694).
* When a delayed write buffer falls off the LRU queue, arrange for it to go on
the AGE queue after being flushed out to disk.
* When a delayed write buffer is synced, leave it in its relative position in
the LRU queue.
of using it directly, use a local, and set that local to be curproc
if curproc is not NULL else a pointer to process 0's proc struct.
If syncing disks while handling a panic that occurred while 'curproc'
was NULL, the old code would dereference NULL and die.
delayed write is logically converted to a sync write, mirroring the async case.
In bdwrite(), move the tape case earlier to avoid needless reassignbuf()s.
bawrite(). it's logically more correct (doesn't return an error code,
because it's async; bdwrite is also async), it still writes things
in-order, it makes sure the proper accountins is done (see the
wasdelayed cases in bwrite()), and it allows writes to vnodes on volumes
mountd with the MNT_ASYNC to be converted into delayed writes the way
God, err, Kirk intended. Convert synchronous bwrite()s on MNT_ASYNC
file systems to delayed writes.
explained in comments), which can cause a race condition. amazingly,
the _only_ time i've ever seen or heard of this problem was in some
comments and sources by Rick Macklem, and when running against the
a DEC OSF/1 NFS server running on an Alpha.