Subject: CVS commit: [vmlocking] src/sys/kern
To: None <source-changes@NetBSD.org>
From: Andrew Doran <ad@netbsd.org>
List: source-changes
Date: 09/16/2007 19:01:20
Module Name:	src
Committed By:	ad
Date:		Sun Sep 16 19:01:20 UTC 2007

Modified Files:
	src/sys/kern [vmlocking]: vfs_subr.c vfs_subr2.c

Log Message:
Checkpoint work in progress on the vnode lifecycle and reference counting
stuff. This makes it work properly without kernel_lock and fixes a few
quite old bugs.

- When traversing a mountpoint vnode list, use a dummy marker vnode to track
  our current position. The old code relied on the assumption that vnodes
  are never freed from the system, which hasn't been true for a while.

- Call VOP_INACTIVE() while we hold a reference to the vnode to avoid racing
  with other threads. Add a 'recycle' parameter to VOP_INACTIVE that's used
  to hint to vrele() that the vnode is no longer used and should be recycled
  immediatley.

- Remove VI_FREEING which was used to by UFS to prevent an on-disk inode
  freed in ufs_inactive() from being reused before the vnode describing it
  was reclaimed. Instead, don't call UFS_VFREE() until we have removed the
  the node from the inode hash in ufs_reclaim().

- Track whether or not vnodes are clean. vrele() becomes the final resting
  place for vnodes; if the refcount drops to zero, free the vnode back to
  the pool. If it's dirty, put it back onto a freelist as before. As a
  result eliminate the vunwait() crap which was intended to prevent vnodes
  from disappearing while they were being waited on.

- Always hold a reference to the vnode across calls to vgone() and vclean().
  vgone() now automatically does a vrele() when complete, potentially
  freeing the vnode back to the pool.

- Handle races where vnodes gain a reference while being cleaned out,
  inactivated and/or recycled.

- Now that vnodes get released on a regular basis, allocate vnodes from a
  pool_cache.

- Add more assertions.


To generate a diff of this commit:
cvs rdiff -r1.283.2.16 -r1.283.2.17 src/sys/kern/vfs_subr.c
cvs rdiff -r1.4.4.5 -r1.4.4.6 src/sys/kern/vfs_subr2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.