kernel - Add new bufcache/VM consolidated API, fsx fixes for NFS
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 19 Jan 2010 22:45:46 +0000 (14:45 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 19 Jan 2010 23:00:13 +0000 (15:00 -0800)
commit8452310f570a350179c13d0f8bf1d1e2e4bb2199
treeafbceb831d7714a4f0132df3b56303681b5d3105
parente31a849e1df1a0a372825859f8a962dbe4b47764
kernel - Add new bufcache/VM consolidated API, fsx fixes for NFS

* Add kern/vfs_vm.c with a new API for vtruncbuf() and vnode_pager_setsize()
  called nvtruncbuf(), nvextendbuf(), and nvnode_pager_setsize().  This
  API solves numerous problems with data coherency between the VM and
  buffer cache subsystems.

  Generally speaking what this API does is allow the VM pages backing the
  buffer straddling EOF in a file to remain valid instead of invalidating
  them.  Take NFS for example with 32K buffers and, say, a 16385 byte
  file.  The NFS buffer cache buffer is backed by 8 x 4K VM pages but
  the actual file only requires 5 x 4K pages.  This API keeps all 8 VM
  pages valid.

  This API also handles zeroing out portions of the buffer after truncation
  and zero-extending portions of the buffer after a file extension.

  NFS has been migrated to the new API.  HAMMER will soon follow.  UFS and
  EXT2FS are harder due to their far more complex buffer cache sizing
  operations (due to their fragment vs full-sized block handling).

* Remodel the NFS client to use the new API.  This allows NFS to consolidate
  all truncation and extension operations into nfs_meta_setsize(), including
  all code which previously had to deal with special buffer cache / VM
  cases related to truncation and extension.

* Fix a bug in kern/vfs_bio.c where NFS buffers requiring the clearing
  of B_NEEDCOMMIT failed to also clear B_CLUSTEROK, leading to occassional
  attempts by NFS to issue RPCs larger than the NFS I/O block size (resulting
  in a panic).

* NFS now uses vop_stdgetpages() and vop_stdputpages().  The NFS-specific
  nfs_getpages() and nfs_putpages() has been removed.  Remove a vinvalbuf()
  in the nfs_bioread() code on remote-directory modification which was
  deadlocking getpages.  This needs more work.

* Simplify the local-vs-remote modification tests in NFS.  This needs more
  work.  What was happening, generally, was that the larger number of
  RPCs inflight allowed by the NFS client was creating too much confusion
  in the attribute feedback in the RPC replies, causing the NFS client to
  lose track of the file's actual size during heavy modifying operations
  (aka fsx tests).
sys/conf/files
sys/kern/vfs_bio.c
sys/kern/vfs_vm.c [new file with mode: 0644]
sys/sys/vnode.h
sys/vfs/nfs/nfs.h
sys/vfs/nfs/nfs_bio.c
sys/vfs/nfs/nfs_subs.c
sys/vfs/nfs/nfs_vnops.c
sys/vfs/nfs/nfsnode.h
sys/vm/vm_extern.h