Fix several buffer cache issues related to B_NOCACHE.
authorMatthew Dillon <dillon@dragonflybsd.org>
Thu, 25 May 2006 19:31:15 +0000 (19:31 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Thu, 25 May 2006 19:31:15 +0000 (19:31 +0000)
commit135bd6a8646913fa6067387fb8ce34a79af8514b
tree8c079f7470c848ae5a089de05f380e1655a75230
parent8fa762378a6a238beeecb5a2225e1b593482db0b
Fix several buffer cache issues related to B_NOCACHE.

* Do not set B_NOCACHE when calling vinvalbuf(... V_SAVE).  This will
  destroy dirty VM backing store associated with clean buffers before
  the VM system has a chance to check for and flush them.

  Taken-from: FreeBSD

* Properly set B_NOCACHE when destroying buffers related to truncated data.

* Fix a bug in vnode_pager_setsize() that was recently introduced.
  v_filesize was being set before a new/old size comparison, causing a
  file truncation to not destroy related VM pages past the new EOF.

* Remove a bogus B_NOCACHE|B_DIRTY test in brelse().  This was originally
  intended to be a B_NOCACHE|B_DELWRITE test which then cleared B_NOCACHE,
  but now that B_NOCACHE operation has been fixed it really does indicate that
  the buffer, its contents, and its backing store are to be destroyed, even
  if the buffer is marked B_DELWRI.

  Instead of clearing B_NOCACHE when B_DELWRITE is found to be set, clear
  B_DELWRITE when B_NOCACHE is found to be set.

  Note that B_NOCACHE is still cleared when bdirty() is called in order to
  ensure that data is not lost when softupdates and other code do a
  'B_NOCACHE + bwrite' sequence.  Softupdates can redirty a buffer in its
  io completion hook and a write error can also redirty a buffer.

* The VMIO buffer rundown seems to have mophed into a state where the
  distinction between NFS and non-NFS buffers can be removed.  Remove
  the test.
sys/kern/vfs_bio.c
sys/kern/vfs_subr.c
sys/sys/buf.h
sys/vm/vnode_pager.c