Module Name:    src
Committed By:   hannken
Date:           Sun Jul 12 08:11:28 UTC 2015

Modified Files:
        src/distrib/sets/lists/comp: mi
        src/share/man/man9: Makefile vfsops.9 vnode.9
        src/sys/kern: vfs_vnode.c
        src/sys/sys: param.h vnode.h

Log Message:
Operations getnewvnode() and ungetnewvnode() have been replaced with vcache.
- Remove now obsolete functions getnewvnode() and ungetnewvnode().
- Document vcache operations.

Welcome to 7.99.20


To generate a diff of this commit:
cvs rdiff -u -r1.1969 -r1.1970 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.387 -r1.388 src/share/man/man9/Makefile
cvs rdiff -u -r1.46 -r1.47 src/share/man/man9/vfsops.9
cvs rdiff -u -r1.68 -r1.69 src/share/man/man9/vnode.9
cvs rdiff -u -r1.44 -r1.45 src/sys/kern/vfs_vnode.c
cvs rdiff -u -r1.481 -r1.482 src/sys/sys/param.h
cvs rdiff -u -r1.255 -r1.256 src/sys/sys/vnode.h

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1969 src/distrib/sets/lists/comp/mi:1.1970
--- src/distrib/sets/lists/comp/mi:1.1969	Sat Jun 27 15:47:29 2015
+++ src/distrib/sets/lists/comp/mi	Sun Jul 12 08:11:27 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1969 2015/06/27 15:47:29 matt Exp $
+#	$NetBSD: mi,v 1.1970 2015/07/12 08:11:27 hannken Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -9790,7 +9790,9 @@
 ./usr/share/man/cat9/VATTR_NULL.0		comp-obsolete		obsolete
 ./usr/share/man/cat9/VFS_CHECKEXP.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/VFS_FHTOVP.0		comp-sys-catman		.cat
+./usr/share/man/cat9/VFS_LOADVNODE.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/VFS_MOUNT.0		comp-sys-catman		.cat
+./usr/share/man/cat9/VFS_NEWVNODE.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/VFS_QUOTACTL.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/VFS_ROOT.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/VFS_SNAPSHOT.0		comp-sys-catman		.cat
@@ -10311,7 +10313,7 @@
 ./usr/share/man/cat9/getmicrouptime.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/getnanotime.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/getnanouptime.0		comp-sys-catman		.cat
-./usr/share/man/cat9/getnewvnode.0		comp-sys-catman		.cat
+./usr/share/man/cat9/getnewvnode.0		comp-obsolete		obsolete
 ./usr/share/man/cat9/gsignal.0			comp-obsolete		obsolete
 ./usr/share/man/cat9/hardclock.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/hash.0			comp-sys-catman		.cat
@@ -11048,7 +11050,7 @@
 ./usr/share/man/cat9/ucas.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/ucom.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/uiomove.0			comp-sys-catman		.cat
-./usr/share/man/cat9/ungetnewvnode.0		comp-sys-catman		.cat
+./usr/share/man/cat9/ungetnewvnode.0		comp-obsolete		obsolete
 ./usr/share/man/cat9/untimeout.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/uprintf.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/usbd_status.0		comp-sys-catman		.cat
@@ -11113,6 +11115,11 @@
 ./usr/share/man/cat9/vaccess.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/vattr.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/vattr_null.0		comp-sys-catman		.cat
+./usr/share/man/cat9/vcache_get.0		comp-sys-catman		.cat
+./usr/share/man/cat9/vcache_new.0		comp-sys-catman		.cat
+./usr/share/man/cat9/vcache_rekey_enter.0	comp-sys-catman		.cat
+./usr/share/man/cat9/vcache_rekey_exit.0	comp-sys-catman		.cat
+./usr/share/man/cat9/vcache_remove.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/vcons.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/vcount.0			comp-obsolete		obsolete
 ./usr/share/man/cat9/vdead_check.0		comp-sys-catman		.cat
@@ -16624,7 +16631,9 @@
 ./usr/share/man/html9/VATTR_NULL.html		comp-obsolete	obsolete
 ./usr/share/man/html9/VFS_CHECKEXP.html		comp-sys-htmlman	html
 ./usr/share/man/html9/VFS_FHTOVP.html		comp-sys-htmlman	html
+./usr/share/man/html9/VFS_LOADVNODE.html	comp-sys-htmlman	html
 ./usr/share/man/html9/VFS_MOUNT.html		comp-sys-htmlman	html
+./usr/share/man/html9/VFS_NEWVNODE.html		comp-sys-htmlman	html
 ./usr/share/man/html9/VFS_QUOTACTL.html		comp-sys-htmlman	html
 ./usr/share/man/html9/VFS_ROOT.html		comp-sys-htmlman	html
 ./usr/share/man/html9/VFS_SNAPSHOT.html		comp-sys-htmlman	html
@@ -17114,7 +17123,7 @@
 ./usr/share/man/html9/getmicrouptime.html	comp-sys-htmlman	html
 ./usr/share/man/html9/getnanotime.html		comp-sys-htmlman	html
 ./usr/share/man/html9/getnanouptime.html	comp-sys-htmlman	html
-./usr/share/man/html9/getnewvnode.html		comp-sys-htmlman	html
+./usr/share/man/html9/getnewvnode.html		comp-obsolete		obsolete
 ./usr/share/man/html9/gsignal.html		comp-obsolete		obsolete
 ./usr/share/man/html9/hardclock.html		comp-sys-htmlman	html
 ./usr/share/man/html9/hash.html			comp-sys-htmlman	html
@@ -17821,7 +17830,7 @@
 ./usr/share/man/html9/ucas.html			comp-sys-htmlman	html
 ./usr/share/man/html9/ucom.html			comp-sys-htmlman	html
 ./usr/share/man/html9/uiomove.html		comp-sys-htmlman	html
-./usr/share/man/html9/ungetnewvnode.html	comp-sys-htmlman	html
+./usr/share/man/html9/ungetnewvnode.html	comp-obsolete		obsolete
 ./usr/share/man/html9/untimeout.html		comp-sys-htmlman	html
 ./usr/share/man/html9/uprintf.html		comp-sys-htmlman	html
 ./usr/share/man/html9/usbd_status.html		comp-sys-htmlman	html
@@ -17873,6 +17882,11 @@
 ./usr/share/man/html9/vaccess.html		comp-sys-htmlman	html
 ./usr/share/man/html9/vattr.html		comp-sys-htmlman	html
 ./usr/share/man/html9/vattr_null.html		comp-sys-htmlman	html
+./usr/share/man/html9/vcache_get.html		comp-sys-htmlman	html
+./usr/share/man/html9/vcache_new.html		comp-sys-htmlman	html
+./usr/share/man/html9/vcache_rekey_enter.html	comp-sys-htmlman	html
+./usr/share/man/html9/vcache_rekey_exit.html	comp-sys-htmlman	html
+./usr/share/man/html9/vcache_remove.html	comp-sys-htmlman	html
 ./usr/share/man/html9/vcons.html		comp-sys-htmlman	html
 ./usr/share/man/html9/vcount.html		comp-obsolete	obsolete
 ./usr/share/man/html9/vdead_check.html		comp-sys-htmlman	html
@@ -23549,7 +23563,9 @@
 ./usr/share/man/man9/VATTR_NULL.9		comp-obsolete		obsolete
 ./usr/share/man/man9/VFS_CHECKEXP.9		comp-sys-man		.man
 ./usr/share/man/man9/VFS_FHTOVP.9		comp-sys-man		.man
+./usr/share/man/man9/VFS_LOADVNODE.9		comp-sys-man		.man
 ./usr/share/man/man9/VFS_MOUNT.9		comp-sys-man		.man
+./usr/share/man/man9/VFS_NEWVNODE.9		comp-sys-man		.man
 ./usr/share/man/man9/VFS_QUOTACTL.9		comp-sys-man		.man
 ./usr/share/man/man9/VFS_ROOT.9			comp-sys-man		.man
 ./usr/share/man/man9/VFS_SNAPSHOT.9		comp-sys-man		.man
@@ -24070,7 +24086,7 @@
 ./usr/share/man/man9/getmicrouptime.9		comp-sys-man		.man
 ./usr/share/man/man9/getnanotime.9		comp-sys-man		.man
 ./usr/share/man/man9/getnanouptime.9		comp-sys-man		.man
-./usr/share/man/man9/getnewvnode.9		comp-sys-man		.man
+./usr/share/man/man9/getnewvnode.9		comp-obsolete		obsolete
 ./usr/share/man/man9/gsignal.9			comp-obsolete		obsolete
 ./usr/share/man/man9/hardclock.9		comp-sys-man		.man
 ./usr/share/man/man9/hash.9			comp-sys-man		.man
@@ -24807,7 +24823,7 @@
 ./usr/share/man/man9/ucas.9			comp-sys-man		.man
 ./usr/share/man/man9/ucom.9			comp-sys-man		.man
 ./usr/share/man/man9/uiomove.9			comp-sys-man		.man
-./usr/share/man/man9/ungetnewvnode.9		comp-sys-man		.man
+./usr/share/man/man9/ungetnewvnode.9		comp-obsolete		obsolete
 ./usr/share/man/man9/untimeout.9		comp-sys-man		.man
 ./usr/share/man/man9/uprintf.9			comp-sys-man		.man
 ./usr/share/man/man9/usbd_status.9		comp-sys-man		.man
@@ -24872,6 +24888,11 @@
 ./usr/share/man/man9/vaccess.9			comp-sys-man		.man
 ./usr/share/man/man9/vattr.9			comp-sys-man		.man
 ./usr/share/man/man9/vattr_null.9		comp-sys-man		.man
+./usr/share/man/man9/vcache_get.9		comp-sys-man		.man
+./usr/share/man/man9/vcache_new.9		comp-sys-man		.man
+./usr/share/man/man9/vcache_rekey_enter.9	comp-sys-man		.man
+./usr/share/man/man9/vcache_rekey_exit.9	comp-sys-man		.man
+./usr/share/man/man9/vcache_remove.9		comp-sys-man		.man
 ./usr/share/man/man9/vcons.9			comp-sys-man		.man
 ./usr/share/man/man9/vcount.9			comp-obsolete		obsolete
 ./usr/share/man/man9/vdead_check.9		comp-sys-man		.man

Index: src/share/man/man9/Makefile
diff -u src/share/man/man9/Makefile:1.387 src/share/man/man9/Makefile:1.388
--- src/share/man/man9/Makefile:1.387	Thu May 14 00:08:44 2015
+++ src/share/man/man9/Makefile	Sun Jul 12 08:11:27 2015
@@ -1,4 +1,4 @@
-#       $NetBSD: Makefile,v 1.387 2015/05/14 00:08:44 pgoyette Exp $
+#       $NetBSD: Makefile,v 1.388 2015/07/12 08:11:27 hannken Exp $
 
 #	Makefile for section 9 (kernel function and variable) manual pages.
 
@@ -879,6 +879,8 @@ MLINKS+=vfsops.9 VFS_MOUNT.9 \
 	vfsops.9 VFS_STATVFS.9 \
 	vfsops.9 VFS_SYNC.9 \
 	vfsops.9 VFS_VGET.9 \
+	vfsops.9 VFS_LOADVNODE.9 \
+	vfsops.9 VFS_NEWVNODE.9 \
 	vfsops.9 VFS_FHTOVP.9 \
 	vfsops.9 VFS_VPTOFH.9 \
 	vfsops.9 VFS_CHECKEXP.9 \
@@ -920,8 +922,11 @@ MLINKS+=vnode.9 vref.9 \
 	vnode.9 vput.9 \
 	vnode.9 vhold.9 \
 	vnode.9 holdrele.9 \
-	vnode.9 getnewvnode.9 \
-	vnode.9 ungetnewvnode.9 \
+	vnode.9 vcache_get.9 \
+	vnode.9 vcache_new.9 \
+	vnode.9 vcache_rekey_enter.9 \
+	vnode.9 vcache_rekey_exit.9 \
+	vnode.9 vcache_remove.9 \
 	vnode.9 vrecycle.9 \
 	vnode.9 vgone.9 \
 	vnode.9 vgonel.9 \

Index: src/share/man/man9/vfsops.9
diff -u src/share/man/man9/vfsops.9:1.46 src/share/man/man9/vfsops.9:1.47
--- src/share/man/man9/vfsops.9:1.46	Mon Feb 13 13:24:18 2012
+++ src/share/man/man9/vfsops.9	Sun Jul 12 08:11:27 2015
@@ -1,4 +1,4 @@
-.\"     $NetBSD: vfsops.9,v 1.46 2012/02/13 13:24:18 wiz Exp $
+.\"     $NetBSD: vfsops.9,v 1.47 2015/07/12 08:11:27 hannken Exp $
 .\"
 .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 13, 2012
+.Dd July 12, 2015
 .Dt VFSOPS 9
 .Os
 .Sh NAME
@@ -40,6 +40,8 @@
 .Nm VFS_STATVFS ,
 .Nm VFS_SYNC ,
 .Nm VFS_VGET ,
+.Nm VFS_LOADVNODE ,
+.Nm VFS_NEWVNODE ,
 .Nm VFS_FHTOVP ,
 .Nm VFS_VPTOFH ,
 .Nm VFS_SNAPSHOT ,
@@ -68,6 +70,10 @@
 .Ft int
 .Fn VFS_VGET "struct mount *mp" "ino_t ino" "struct vnode **vpp"
 .Ft int
+.Fn VFS_LOADVNODE "struct mount *mp" "struct vnode *vp" "const void *key" "size_t key_len" "const void **new_key"
+.Ft int
+.Fn VFS_NEWVNODE "struct mount *mp" "struct vnode *dvp" "struct vnode *vp" "struct vattr *vap" "kauth_cred_t cred" "size_t *key_len" "const void **new_key"
+.Ft int
 .Fn VFS_FHTOVP "struct mount *mp" "struct fid *fhp" "struct vnode **vpp"
 .Ft int
 .Fn VFS_VPTOFH "struct vnode *vp" "struct fid *fhp" "size_t *fh_size"
@@ -132,6 +138,14 @@ Ta Flush file system buffers
 Ta Dv VFS_VGET \
 Ta Get vnode from file id
 .\"
+.It int (*vfs_loadvnode)() \
+Ta Dv VFS_LOADVNODE \
+Ta Initialze vnode with file
+.\"
+.It int (*vfs_loadvnode)() \
+Ta Dv VFS_NEWVNODE \
+Ta Initialze vnode with new file
+.\"
 .It int (*vfs_fhtovp)() \
 Ta Dv VFS_FHTOVP \
 Ta NFS file handle to vnode lookup
@@ -332,6 +346,42 @@ It is used internally by the UFS file sy
 server to implement the READDIRPLUS NFS call.
 If the file system does not support this function, it should return
 .Er EOPNOTSUPP .
+.It Fn VFS_LOADVNODE "mp" "vp" "key" "key_len" "new_key"
+Initialise the vnode
+.Fa vp
+with the file identified by the arguments
+.Fa key
+and
+.Fa key_len
+for the file system specified by the mount structure
+.Fa mp .
+.Pp
+The new key is returned in the address specified by
+.Fa new_key .
+.Pp
+Caller of this function assures no other thread will try to load this file.
+.It Fn VFS_NEWVNODE "mp" "dvp" "vp" "vap" "cred" "key_len" "new_key"
+Initialise the vnode
+.Fa vp
+with a new file for the file system specified by the mount structure
+.Fa mp .
+.Pp
+The argument
+.Fa dvp
+points to the directory to create the file in.
+.Pp
+The argument
+.Fa vap
+points to the attributes for the file to create.
+.Pp
+The argument
+.Fa cred
+holds the credentials for the file to create.
+.Pp
+The key for the file is returned in the addresses specified by
+.Fa key_len
+and
+.Fa new_key .
 .It Fn VFS_FHTOVP "mp" "fhp" "vpp"
 Get the vnode for the file handle
 .Fa fhp

Index: src/share/man/man9/vnode.9
diff -u src/share/man/man9/vnode.9:1.68 src/share/man/man9/vnode.9:1.69
--- src/share/man/man9/vnode.9:1.68	Mon Apr 20 19:36:55 2015
+++ src/share/man/man9/vnode.9	Sun Jul 12 08:11:27 2015
@@ -1,4 +1,4 @@
-.\"     $NetBSD: vnode.9,v 1.68 2015/04/20 19:36:55 riastradh Exp $
+.\"     $NetBSD: vnode.9,v 1.69 2015/07/12 08:11:27 hannken Exp $
 .\"
 .\" Copyright (c) 2001, 2005, 2006 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 20, 2015
+.Dd July 12, 2015
 .Dt VNODE 9
 .Os
 .Sh NAME
@@ -39,8 +39,11 @@
 .Nm vput ,
 .Nm vhold ,
 .Nm holdrele ,
-.Nm getnewvnode ,
-.Nm ungetnewvnode ,
+.Nm vcache_get ,
+.Nm vcache_new ,
+.Nm vcache_rekey_enter ,
+.Nm vcache_rekey_exit ,
+.Nm vcache_remove ,
 .Nm vrecycle ,
 .Nm vgone ,
 .Nm vgonel ,
@@ -75,10 +78,15 @@
 .Ft void
 .Fn holdrele "struct vnode *vp"
 .Ft int
-.Fn getnewvnode "enum vtagtype tag" "struct mount *mp" "int (**vops)(void *)" \
-"kmutex_t *slock" "struct vnode **vpp"
+.Fn vcache_get "struct mount *mp" "const void *key" "size_t key_len" "struct vnode **vpp"
+.Ft int
+.Fn vcache_new "struct mount *mp" "struct vnode *dvp" "struct vattr *vap" "kauth_cred_t cred" "struct vnode **vpp"
+.Ft int
+.Fn vcache_rekey_enter "struct mount *mp" "struct vnode *vp" "const void *old_key" "size_t old_key_len" "const void *new_key" "size_t new_key_len"
 .Ft void
-.Fn ungetnewvnode "struct vnode *vp"
+.Fn vcache_rekey_exit "struct mount *mp" "struct vnode *vp" "const void *old_key" "size_t old_key_len" "const void *new_key" "size_t new_key_len"
+.Ft void
+.Fn vcache_remove "struct mount *mp" "const void *key" "size_t key_len"
 .Ft int
 .Fn vrecycle "struct vnode *vp"
 .Ft void
@@ -358,7 +366,9 @@ must call
 .Fn vget
 to increment the reference count and retrieve it from the freelist.
 When a user wants a new vnode for another file,
-.Fn getnewvnode
+.Fn vcache_get
+or
+.Fn vcache_new
 is invoked to allocate a vnode and initialize it for the new file.
 .Pp
 The type of object the vnode represents is recorded by
@@ -632,51 +642,86 @@ Mark the vnode
 as inactive by decrementing
 .Em vp-\*[Gt]v_holdcnt
 and moving the vnode from the holdlist to the freelist.
-.It Fn getnewvnode "tag" "mp" "vops" "slock" "vpp"
-Retrieve the next vnode from the freelist.
-.Fn getnewvnode
-allocates a new vnode.
-The new vnode is returned in the address specified by
+.It Fn vcache_get "mp" "key" "key_len" "vpp"
+Allocate a new vnode.
+The new vnode is returned referenced in the address specified by
 .Fa vpp .
 .Pp
 The argument
 .Fa mp
-is the mount point for the file system requested the new vnode.
-Before retrieving the new vnode, the file system is checked if it is
-busy (such as currently unmounting).
-An error is returned if the file system is unmounted.
+is the mount point for the file system to lookup the file in.
+.Pp
+The arguments
+.Fa key
+and
+.Fa key_len
+uniquely identify the file in the file system.
+.Pp
+If a vnode is successfully retrieved zero is returned, otherwise an
+appropriate error code is returned.
+.It Fn vcache_new "mp" "dvp" "vap" "cred" "vpp"
+Allocate a new vnode with a new file.
+The new vnode is returned referenced in the address specified by
+.Fa vpp .
 .Pp
 The argument
-.Fa tag
-is the vnode tag assigned to
-.Fa *vpp-\*[Gt]v_tag .
+.Fa mp
+is the mount point for the file system to create the file in.
+.Pp
 The argument
-.Fa vops
-is the vnode operations vector of the file system requesting the new
-vnode.
-If a vnode is successfully retrieved zero is returned, otherwise an
+.Fa dvp
+points to the directory to create the file in.
+.Pp
+The argument
+.Fa vap
+points to the attributes for the file to create.
+.Pp
+The argument
+.Fa cred
+holds the credentials for the file to create.
+.Pp
+If a vnode is successfully created zero is returned, otherwise an
 appropriate error code is returned.
-If
-.Fa slock
-is not
-.Dv NULL ,
-it specifies the lock to share for
-.Em v_interlock .
-The reference will be held on the lock and sharing noted.
-Reference will be released and lock unshared when the vnode gets recycled.
-If
-.Dv NULL
-(regular case), vnode will use its own interlock.
-.It Fn ungetnewvnode "vp"
-Undo the operation of
-.Fn getnewvnode .
+.It Fn vcache_rekey_enter "mp" "vp" "old_key" "old_key_len" "new_key" "new_key_len"
+Prepare to change the key of a cached vnode.
+.Pp
 The argument
+.Fa mp
+is the mount point for the file system the vnode
 .Fa vp
-is the vnode to return to the freelist.
-This function is needed for
-.Xr VFS_VGET 9
-which may need to push back a vnode in case of a locking race
-condition.
+resides in.
+.Pp
+The arguments
+.Fa old_key 
+and 
+.Fa old_key_len
+identify the cached vnode.
+.Pp
+The arguments
+.Fa new_key
+and
+.Fa new_key_len
+will identify the vnode after rename.
+.Pp
+If the new key already exists
+.Er EEXIST
+is returned, otherwise zero is returned.
+.It Fn vcache_rekey_exit "mp" "vp" "old_key" "old_key_len" "new_key" "new_key_len"
+Finish rename after calling
+.Fn vcache_rekey_enter .
+.It Fn vcache_remove "mp" "key" "key_len"
+Remove a vnode from the cache.
+Must be called when a file system reclaims a vnode.
+.Pp
+The argument
+.Fa mp
+is the mount point for the file system this file resides in.
+.Pp
+The arguments
+.Fa key 
+and 
+.Fa key_len
+uniquely identify the file in the file system.
 .It Fn vrecycle "vp"
 Recycle the referenced vnode
 .Fa vp

Index: src/sys/kern/vfs_vnode.c
diff -u src/sys/kern/vfs_vnode.c:1.44 src/sys/kern/vfs_vnode.c:1.45
--- src/sys/kern/vfs_vnode.c:1.44	Tue Jun 23 10:41:59 2015
+++ src/sys/kern/vfs_vnode.c	Sun Jul 12 08:11:28 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnode.c,v 1.44 2015/06/23 10:41:59 hannken Exp $	*/
+/*	$NetBSD: vfs_vnode.c,v 1.45 2015/07/12 08:11:28 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  *	VOP_CREATE(9) and VOP_LOOKUP(9).  The life-cycle of a vnode
  *	starts in one of the following ways:
  *
- *	- Allocation, via getnewvnode(9) and/or vnalloc(9).
+ *	- Allocation, via vcache_get(9) or vcache_new(9).
  *	- Reclamation of inactive vnode, via vget(9).
  *
  *	Recycle from a free list, via getnewvnode(9) -> getcleanvnode(9)
@@ -116,7 +116,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.44 2015/06/23 10:41:59 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.45 2015/07/12 08:11:28 hannken Exp $");
 
 #define _VFS_VNODE_PRIVATE
 
@@ -371,89 +371,6 @@ try_nextlist:
 }
 
 /*
- * getnewvnode: return a fresh vnode.
- *
- * => Returns referenced vnode, moved into the mount queue.
- * => Shares the interlock specified by 'slock', if it is not NULL.
- */
-int
-getnewvnode(enum vtagtype tag, struct mount *mp, int (**vops)(void *),
-    kmutex_t *slock, vnode_t **vpp)
-{
-	struct uvm_object *uobj __diagused;
-	vnode_t *vp;
-	int error = 0;
-
-	if (mp != NULL) {
-		/*
-		 * Mark filesystem busy while we are creating a vnode.
-		 * If unmount is in progress, this will fail.
-		 */
-		error = vfs_busy(mp, NULL);
-		if (error)
-			return error;
-	}
-
-	vp = NULL;
-
-	/* Allocate a new vnode. */
-	vp = vnalloc(NULL);
-
-	KASSERT(vp->v_freelisthd == NULL);
-	KASSERT(LIST_EMPTY(&vp->v_nclist));
-	KASSERT(LIST_EMPTY(&vp->v_dnclist));
-	KASSERT(vp->v_data == NULL);
-
-	/* Initialize vnode. */
-	vp->v_tag = tag;
-	vp->v_op = vops;
-
-	uobj = &vp->v_uobj;
-	KASSERT(uobj->pgops == &uvm_vnodeops);
-	KASSERT(uobj->uo_npages == 0);
-	KASSERT(TAILQ_FIRST(&uobj->memq) == NULL);
-
-	/* Share the vnode_t::v_interlock, if requested. */
-	if (slock) {
-		/* Set the interlock and mark that it is shared. */
-		KASSERT(vp->v_mount == NULL);
-		mutex_obj_hold(slock);
-		uvm_obj_setlock(&vp->v_uobj, slock);
-		KASSERT(vp->v_interlock == slock);
-	}
-
-	/* Finally, move vnode into the mount queue. */
-	vfs_insmntque(vp, mp);
-
-	if (mp != NULL) {
-		if ((mp->mnt_iflag & IMNT_MPSAFE) != 0)
-			vp->v_vflag |= VV_MPSAFE;
-		vfs_unbusy(mp, true, NULL);
-	}
-
-	*vpp = vp;
-	return 0;
-}
-
-/*
- * This is really just the reverse of getnewvnode(). Needed for
- * VFS_VGET functions who may need to push back a vnode in case
- * of a locking race.
- */
-void
-ungetnewvnode(vnode_t *vp)
-{
-
-	KASSERT(vp->v_usecount == 1);
-	KASSERT(vp->v_data == NULL);
-	KASSERT(vp->v_freelisthd == NULL);
-
-	mutex_enter(vp->v_interlock);
-	vp->v_iflag |= VI_CLEAN;
-	vrelel(vp, 0);
-}
-
-/*
  * Helper thread to keep the number of vnodes below desiredvnodes.
  */
 static void

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.481 src/sys/sys/param.h:1.482
--- src/sys/sys/param.h:1.481	Sat Jun 20 14:44:56 2015
+++ src/sys/sys/param.h	Sun Jul 12 08:11:28 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.481 2015/06/20 14:44:56 martin Exp $	*/
+/*	$NetBSD: param.h,v 1.482 2015/07/12 08:11:28 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -63,7 +63,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	799001900	/* NetBSD 7.99.19 */
+#define	__NetBSD_Version__	799002000	/* NetBSD 7.99.20 */
 
 #define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \
     (m) * 1000000) + (p) * 100) <= __NetBSD_Version__)

Index: src/sys/sys/vnode.h
diff -u src/sys/sys/vnode.h:1.255 src/sys/sys/vnode.h:1.256
--- src/sys/sys/vnode.h:1.255	Wed May  6 15:57:08 2015
+++ src/sys/sys/vnode.h	Sun Jul 12 08:11:28 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnode.h,v 1.255 2015/05/06 15:57:08 hannken Exp $	*/
+/*	$NetBSD: vnode.h,v 1.256 2015/07/12 08:11:28 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -522,9 +522,6 @@ struct vnode;
 void	vfs_vnode_sysinit(void);
 int 	bdevvp(dev_t, struct vnode **);
 int 	cdevvp(dev_t, struct vnode **);
-int 	getnewvnode(enum vtagtype, struct mount *, int (**)(void *),
-	    kmutex_t *, struct vnode **);
-void	ungetnewvnode(struct vnode *);
 int	vaccess(enum vtype, mode_t, uid_t, gid_t, mode_t, kauth_cred_t);
 void 	vattr_null(struct vattr *);
 void	vdevgone(int, int, int, enum vtype);

Reply via email to