Module Name:    src
Committed By:   hannken
Date:           Sun May 25 13:51:26 UTC 2014

Modified Files:
        src/sys/miscfs/genfs: layer.h layer_extern.h layer_subr.c
            layer_vfsops.c layer_vnops.c
        src/sys/miscfs/nullfs: null_vfsops.c
        src/sys/miscfs/overlay: overlay_vfsops.c
        src/sys/miscfs/umapfs: umap_vfsops.c
        src/sys/sys: vnode.h

Log Message:
Change layerfs from hashlist to vcache.
Make VI_LOCKSHARE public again.

Ride 6.99.43


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/miscfs/genfs/layer.h
cvs rdiff -u -r1.35 -r1.36 src/sys/miscfs/genfs/layer_extern.h \
    src/sys/miscfs/genfs/layer_subr.c
cvs rdiff -u -r1.43 -r1.44 src/sys/miscfs/genfs/layer_vfsops.c
cvs rdiff -u -r1.57 -r1.58 src/sys/miscfs/genfs/layer_vnops.c
cvs rdiff -u -r1.88 -r1.89 src/sys/miscfs/nullfs/null_vfsops.c
cvs rdiff -u -r1.61 -r1.62 src/sys/miscfs/overlay/overlay_vfsops.c
cvs rdiff -u -r1.92 -r1.93 src/sys/miscfs/umapfs/umap_vfsops.c
cvs rdiff -u -r1.247 -r1.248 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/sys/miscfs/genfs/layer.h
diff -u src/sys/miscfs/genfs/layer.h:1.14 src/sys/miscfs/genfs/layer.h:1.15
--- src/sys/miscfs/genfs/layer.h:1.14	Sun Jun  6 08:01:31 2010
+++ src/sys/miscfs/genfs/layer.h	Sun May 25 13:51:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: layer.h,v 1.14 2010/06/06 08:01:31 hannken Exp $	*/
+/*	$NetBSD: layer.h,v 1.15 2014/05/25 13:51:25 hannken Exp $	*/
 
 /*
  * Copyright (c) 1999 National Aeronautics & Space Administration
@@ -78,10 +78,6 @@ struct layer_args {
 
 #ifdef _KERNEL
 
-struct layer_node;
-
-LIST_HEAD(layer_node_hashhead, layer_node);
-
 struct layer_mount {
 	struct mount		*layerm_vfs;
 	struct vnode		*layerm_rootvp;	/* Ref to root layer_node */
@@ -90,15 +86,8 @@ struct layer_mount {
 	enum vtype		layerm_tag;	/* vtag of our vnodes */
 	int				/* bypass routine for this mount */
 				(*layerm_bypass)(void *);
-	int			(*layerm_alloc)	/* alloc a new layer node */
-				(struct mount *, struct vnode *,
-						struct vnode **);
 	int			(**layerm_vnodeop_p)	/* ops for our nodes */
 				(void *);
-	struct layer_node_hashhead	/* head of hash list for layer_nodes */
-				*layerm_node_hashtbl;
-	u_long			layerm_node_hash; /* hash mask for hash chain */
-	kmutex_t		layerm_hashlock; /* interlock for hash chain. */
 };
 
 #define	LAYERFS_MFLAGS		0x00000fff	/* reserved layer mount flags */
@@ -108,7 +97,6 @@ struct layer_mount {
  * A cache of vnode references
  */
 struct layer_node {
-	LIST_ENTRY(layer_node)	layer_hash;	/* Hash list */
 	struct vnode	        *layer_lowervp;	/* VREFed once */
 	struct vnode		*layer_vnode;	/* Back pointer */
 	unsigned int		layer_flags;	/* locking, etc. */

Index: src/sys/miscfs/genfs/layer_extern.h
diff -u src/sys/miscfs/genfs/layer_extern.h:1.35 src/sys/miscfs/genfs/layer_extern.h:1.36
--- src/sys/miscfs/genfs/layer_extern.h:1.35	Thu Feb 27 16:51:38 2014
+++ src/sys/miscfs/genfs/layer_extern.h	Sun May 25 13:51:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: layer_extern.h,v 1.35 2014/02/27 16:51:38 hannken Exp $	*/
+/*	$NetBSD: layer_extern.h,v 1.36 2014/05/25 13:51:25 hannken Exp $	*/
 
 /*
  * Copyright (c) 1999 National Aeronautics & Space Administration
@@ -76,14 +76,7 @@
 /* Routines to manage nodes. */
 void	layerfs_init(void);
 void	layerfs_done(void);
-int	layer_node_alloc(struct mount *, struct vnode *, struct vnode **);
 int	layer_node_create(struct mount *, struct vnode *, struct vnode **);
-struct vnode *layer_node_find(struct mount *, struct vnode *);
-
-#define LOG2_SIZEVNODE	7		/* log2(sizeof struct vnode) */
-#define LAYER_NHASH(lmp, vp) \
-	(&((lmp)->layerm_node_hashtbl[(((u_long)vp)>>LOG2_SIZEVNODE) & \
-		(lmp)->layerm_node_hash]))
 
 /* VFS routines */
 int	layerfs_start(struct mount *, int);
@@ -91,6 +84,8 @@ int	layerfs_root(struct mount *, struct 
 int	layerfs_quotactl(struct mount *, struct quotactl_args *);
 int	layerfs_statvfs(struct mount *, struct statvfs *);
 int	layerfs_sync(struct mount *, int, struct kauth_cred *);
+int	layerfs_loadvnode(struct mount *,  struct vnode *,
+	    const void *, size_t, const void **);
 int	layerfs_vget(struct mount *, ino_t, struct vnode **);
 int	layerfs_fhtovp(struct mount *, struct fid *, struct vnode **);
 int	layerfs_vptofh(struct vnode *, struct fid *, size_t *);
Index: src/sys/miscfs/genfs/layer_subr.c
diff -u src/sys/miscfs/genfs/layer_subr.c:1.35 src/sys/miscfs/genfs/layer_subr.c:1.36
--- src/sys/miscfs/genfs/layer_subr.c:1.35	Mon Feb 10 11:23:14 2014
+++ src/sys/miscfs/genfs/layer_subr.c	Sun May 25 13:51:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: layer_subr.c,v 1.35 2014/02/10 11:23:14 hannken Exp $	*/
+/*	$NetBSD: layer_subr.c,v 1.36 2014/05/25 13:51:25 hannken Exp $	*/
 
 /*
  * Copyright (c) 1999 National Aeronautics & Space Administration
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: layer_subr.c,v 1.35 2014/02/10 11:23:14 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: layer_subr.c,v 1.36 2014/05/25 13:51:25 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -81,7 +81,6 @@ __KERNEL_RCSID(0, "$NetBSD: layer_subr.c
 #include <sys/kmem.h>
 #include <sys/malloc.h>
 
-#include <miscfs/specfs/specdev.h>
 #include <miscfs/genfs/layer.h>
 #include <miscfs/genfs/layer_extern.h>
 
@@ -110,156 +109,18 @@ layerfs_done(void)
 }
 
 /*
- * layer_node_find: find and return alias for lower vnode or NULL.
- *
- * => Return alias vnode referenced. if already exists.
- * => The layermp's hashlock must be held on entry, we will unlock on success.
- */
-struct vnode *
-layer_node_find(struct mount *mp, struct vnode *lowervp)
-{
-	struct layer_mount *lmp = MOUNTTOLAYERMOUNT(mp);
-	struct layer_node_hashhead *hd;
-	struct layer_node *a;
-	struct vnode *vp;
-	int error;
-
-	/*
-	 * Find hash bucket and search the (two-way) linked list looking
-	 * for a layerfs node structure which is referencing the lower vnode.
-	 * If found, the increment the layer_node reference count, but NOT
-	 * the lower vnode's reference counter.
-	 */
-	KASSERT(mutex_owned(&lmp->layerm_hashlock));
-	hd = LAYER_NHASH(lmp, lowervp);
-loop:
-	LIST_FOREACH(a, hd, layer_hash) {
-		if (a->layer_lowervp != lowervp) {
-			continue;
-		}
-		vp = LAYERTOV(a);
-		if (vp->v_mount != mp) {
-			continue;
-		}
-		mutex_enter(vp->v_interlock);
-		mutex_exit(&lmp->layerm_hashlock);
-		error = vget(vp, 0);
-		if (error) {
-			mutex_enter(&lmp->layerm_hashlock);
-			goto loop;
-		}
-		return vp;
-	}
-	return NULL;
-}
-
-/*
- * layer_node_alloc: make a new layerfs vnode.
- *
- * => vp is the alias vnode, lowervp is the lower vnode.
- * => We will hold a reference to lowervp.
- */
-int
-layer_node_alloc(struct mount *mp, struct vnode *lowervp, struct vnode **vpp)
-{
-	struct layer_mount *lmp = MOUNTTOLAYERMOUNT(mp);
-	struct layer_node_hashhead *hd;
-	struct layer_node *xp;
-	struct vnode *vp, *nvp;
-	int error;
-
-	/* Get a new vnode and share its interlock with underlying vnode. */
-	error = getnewvnode(lmp->layerm_tag, mp, lmp->layerm_vnodeop_p,
-	    lowervp->v_interlock, &vp);
-	if (error) {
-		return error;
-	}
-	vp->v_type = lowervp->v_type;
-	mutex_enter(vp->v_interlock);
-	vp->v_iflag |= VI_LAYER;
-	mutex_exit(vp->v_interlock);
-
-	xp = kmem_alloc(lmp->layerm_size, KM_SLEEP);
-	if (xp == NULL) {
-		ungetnewvnode(vp);
-		return ENOMEM;
-	}
-	if (vp->v_type == VBLK || vp->v_type == VCHR) {
-		spec_node_init(vp, lowervp->v_rdev);
-	}
-
-	/*
-	 * Before inserting the node into the hash, check if other thread
-	 * did not race with us.  If so - return that node, destroy ours.
-	 */
-	mutex_enter(&lmp->layerm_hashlock);
-	if ((nvp = layer_node_find(mp, lowervp)) != NULL) {
-		ungetnewvnode(vp);
-		kmem_free(xp, lmp->layerm_size);
-		*vpp = nvp;
-		return 0;
-	}
-
-	vp->v_data = xp;
-	vp->v_vflag = (vp->v_vflag & ~VV_MPSAFE) |
-	    (lowervp->v_vflag & VV_MPSAFE);
-	xp->layer_vnode = vp;
-	xp->layer_lowervp = lowervp;
-	xp->layer_flags = 0;
-
-	/*
-	 * Insert the new node into the hash.
-	 * Add a reference to the lower node.
-	 */
-	vref(lowervp);
-	hd = LAYER_NHASH(lmp, lowervp);
-	LIST_INSERT_HEAD(hd, xp, layer_hash);
-	uvm_vnp_setsize(vp, 0);
-	mutex_exit(&lmp->layerm_hashlock);
-
-	*vpp = vp;
-	return 0;
-}
-
-/*
  * layer_node_create: try to find an existing layerfs vnode refering to it,
  * otherwise make a new vnode which contains a reference to the lower vnode.
- *
- * => Caller should lock the lower node.
  */
 int
 layer_node_create(struct mount *mp, struct vnode *lowervp, struct vnode **nvpp)
 {
+	int error;
 	struct vnode *aliasvp;
-	struct layer_mount *lmp = MOUNTTOLAYERMOUNT(mp);
 
-	mutex_enter(&lmp->layerm_hashlock);
-	aliasvp = layer_node_find(mp, lowervp);
-	if (aliasvp != NULL) {
-		/*
-		 * Note: layer_node_find() has taken another reference to
-		 * the alias vnode and moved the lock holding to aliasvp.
-		 */
-#ifdef LAYERFS_DIAGNOSTIC
-		if (layerfs_debug)
-			vprint("layer_node_create: exists", aliasvp);
-#endif
-	} else {
-		int error;
-
-		mutex_exit(&lmp->layerm_hashlock);
-		/*
-		 * Get a new vnode.  Make it to reference the layer_node.
-		 * Note: aliasvp will be return with the reference held.
-		 */
-		error = (lmp->layerm_alloc)(mp, lowervp, &aliasvp);
-		if (error)
-			return error;
-#ifdef LAYERFS_DIAGNOSTIC
-		if (layerfs_debug)
-			printf("layer_node_create: create new alias vnode\n");
-#endif
-	}
+	error = vcache_get(mp, &lowervp, sizeof(lowervp), &aliasvp);
+	if (error)
+		return error;
 
 	/*
 	 * Now that we acquired a reference on the upper vnode, release one

Index: src/sys/miscfs/genfs/layer_vfsops.c
diff -u src/sys/miscfs/genfs/layer_vfsops.c:1.43 src/sys/miscfs/genfs/layer_vfsops.c:1.44
--- src/sys/miscfs/genfs/layer_vfsops.c:1.43	Tue Feb 25 18:30:11 2014
+++ src/sys/miscfs/genfs/layer_vfsops.c	Sun May 25 13:51:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: layer_vfsops.c,v 1.43 2014/02/25 18:30:11 pooka Exp $	*/
+/*	$NetBSD: layer_vfsops.c,v 1.44 2014/05/25 13:51:25 hannken Exp $	*/
 
 /*
  * Copyright (c) 1999 National Aeronautics & Space Administration
@@ -74,7 +74,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: layer_vfsops.c,v 1.43 2014/02/25 18:30:11 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: layer_vfsops.c,v 1.44 2014/05/25 13:51:25 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/sysctl.h>
@@ -86,6 +86,7 @@ __KERNEL_RCSID(0, "$NetBSD: layer_vfsops
 #include <sys/kauth.h>
 #include <sys/module.h>
 
+#include <miscfs/specfs/specdev.h>
 #include <miscfs/genfs/layer.h>
 #include <miscfs/genfs/layer_extern.h>
 
@@ -204,6 +205,43 @@ layerfs_sync(struct mount *mp, int waitf
 }
 
 int
+layerfs_loadvnode(struct mount *mp, struct vnode *vp,
+    const void *key, size_t key_len, const void **new_key)
+{
+	struct layer_mount *lmp = MOUNTTOLAYERMOUNT(mp);
+	struct vnode *lowervp;
+	struct layer_node *xp;
+
+	KASSERT(key_len == sizeof(struct vnode *));
+	memcpy(&lowervp, key, key_len);
+
+	xp = kmem_alloc(lmp->layerm_size, KM_SLEEP);
+	if (xp == NULL)
+		return ENOMEM;
+
+	/* Share the interlock with the lower node. */
+	mutex_obj_hold(lowervp->v_interlock);
+	uvm_obj_setlock(&vp->v_uobj, lowervp->v_interlock);
+	vp->v_iflag |= VI_LAYER | VI_LOCKSHARE;
+
+	vp->v_tag = lmp->layerm_tag;
+	vp->v_type = lowervp->v_type;
+	vp->v_op = lmp->layerm_vnodeop_p;
+	if (vp->v_type == VBLK || vp->v_type == VCHR)
+		spec_node_init(vp, lowervp->v_rdev);
+	vp->v_data = xp;
+	xp->layer_vnode = vp;
+	xp->layer_lowervp = lowervp;
+	xp->layer_flags = 0;
+	uvm_vnp_setsize(vp, 0);
+
+	/*  Add a reference to the lower node. */
+	vref(lowervp);
+	*new_key = &xp->layer_lowervp;
+	return 0;
+}
+
+int
 layerfs_vget(struct mount *mp, ino_t ino, struct vnode **vpp)
 {
 	struct vnode *vp;

Index: src/sys/miscfs/genfs/layer_vnops.c
diff -u src/sys/miscfs/genfs/layer_vnops.c:1.57 src/sys/miscfs/genfs/layer_vnops.c:1.58
--- src/sys/miscfs/genfs/layer_vnops.c:1.57	Mon Mar 24 13:42:40 2014
+++ src/sys/miscfs/genfs/layer_vnops.c	Sun May 25 13:51:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: layer_vnops.c,v 1.57 2014/03/24 13:42:40 hannken Exp $	*/
+/*	$NetBSD: layer_vnops.c,v 1.58 2014/05/25 13:51:25 hannken Exp $	*/
 
 /*
  * Copyright (c) 1999 National Aeronautics & Space Administration
@@ -170,7 +170,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.57 2014/03/24 13:42:40 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.58 2014/05/25 13:51:25 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -694,11 +694,9 @@ layer_reclaim(void *v)
 		 */
 		lmp->layerm_rootvp = NULL;
 	}
+	vcache_remove(vp->v_mount, &lowervp, sizeof(lowervp));
 	/* After this assignment, this node will not be re-used. */
 	xp->layer_lowervp = NULL;
-	mutex_enter(&lmp->layerm_hashlock);
-	LIST_REMOVE(xp, layer_hash);
-	mutex_exit(&lmp->layerm_hashlock);
 	kmem_free(vp->v_data, lmp->layerm_size);
 	vp->v_data = NULL;
 	vrele(lowervp);

Index: src/sys/miscfs/nullfs/null_vfsops.c
diff -u src/sys/miscfs/nullfs/null_vfsops.c:1.88 src/sys/miscfs/nullfs/null_vfsops.c:1.89
--- src/sys/miscfs/nullfs/null_vfsops.c:1.88	Wed Apr 16 18:55:19 2014
+++ src/sys/miscfs/nullfs/null_vfsops.c	Sun May 25 13:51:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: null_vfsops.c,v 1.88 2014/04/16 18:55:19 maxv Exp $	*/
+/*	$NetBSD: null_vfsops.c,v 1.89 2014/05/25 13:51:25 hannken Exp $	*/
 
 /*
  * Copyright (c) 1999 National Aeronautics & Space Administration
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: null_vfsops.c,v 1.88 2014/04/16 18:55:19 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: null_vfsops.c,v 1.89 2014/05/25 13:51:25 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -154,19 +154,13 @@ nullfs_mount(struct mount *mp, const cha
 	nmp->nullm_size = sizeof(struct null_node);
 	nmp->nullm_tag = VT_NULL;
 	nmp->nullm_bypass = layer_bypass;
-	nmp->nullm_alloc = layer_node_alloc;	/* the default alloc is fine */
 	nmp->nullm_vnodeop_p = null_vnodeop_p;
-	mutex_init(&nmp->nullm_hashlock, MUTEX_DEFAULT, IPL_NONE);
-	nmp->nullm_node_hashtbl = hashinit(desiredvnodes, HASH_LIST, true,
-	    &nmp->nullm_node_hash);
 
 	/* Setup a null node for root vnode. */
 	VOP_UNLOCK(lowerrootvp);
 	error = layer_node_create(mp, lowerrootvp, &vp);
 	if (error) {
 		vrele(lowerrootvp);
-		hashdone(nmp->nullm_node_hashtbl, HASH_LIST,
-		    nmp->nullm_node_hash);
 		kmem_free(nmp, sizeof(struct null_mount));
 		return error;
 	}
@@ -205,8 +199,6 @@ nullfs_unmount(struct mount *mp, int mnt
 	vgone(null_rootvp);
 
 	/* Finally, destroy the mount point structures. */
-	hashdone(nmp->nullm_node_hashtbl, HASH_LIST, nmp->nullm_node_hash);
-	mutex_destroy(&nmp->nullm_hashlock);
 	kmem_free(mp->mnt_data, sizeof(struct null_mount));
 	mp->mnt_data = NULL;
 	return 0;
@@ -229,6 +221,7 @@ struct vfsops nullfs_vfsops = {
 	.vfs_quotactl = layerfs_quotactl,
 	.vfs_statvfs = layerfs_statvfs,
 	.vfs_sync = layerfs_sync,
+	.vfs_loadvnode = layerfs_loadvnode,
 	.vfs_vget = layerfs_vget,
 	.vfs_fhtovp = layerfs_fhtovp,
 	.vfs_vptofh = layerfs_vptofh,

Index: src/sys/miscfs/overlay/overlay_vfsops.c
diff -u src/sys/miscfs/overlay/overlay_vfsops.c:1.61 src/sys/miscfs/overlay/overlay_vfsops.c:1.62
--- src/sys/miscfs/overlay/overlay_vfsops.c:1.61	Wed Apr 16 18:55:19 2014
+++ src/sys/miscfs/overlay/overlay_vfsops.c	Sun May 25 13:51:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: overlay_vfsops.c,v 1.61 2014/04/16 18:55:19 maxv Exp $	*/
+/*	$NetBSD: overlay_vfsops.c,v 1.62 2014/05/25 13:51:25 hannken Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 National Aeronautics & Space Administration
@@ -74,7 +74,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: overlay_vfsops.c,v 1.61 2014/04/16 18:55:19 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: overlay_vfsops.c,v 1.62 2014/05/25 13:51:25 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -163,11 +163,7 @@ ov_mount(struct mount *mp, const char *p
 	nmp->ovm_size = sizeof (struct overlay_node);
 	nmp->ovm_tag = VT_OVERLAY;
 	nmp->ovm_bypass = layer_bypass;
-	nmp->ovm_alloc = layer_node_alloc;	/* the default alloc is fine */
 	nmp->ovm_vnodeop_p = overlay_vnodeop_p;
-	mutex_init(&nmp->ovm_hashlock, MUTEX_DEFAULT, IPL_NONE);
-	nmp->ovm_node_hashtbl = hashinit(NOVERLAYNODECACHE, HASH_LIST, true,
-	     &nmp->ovm_node_hash);
 
 	/*
 	 * Fix up overlay node for root vnode
@@ -179,7 +175,6 @@ ov_mount(struct mount *mp, const char *p
 	 */
 	if (error) {
 		vrele(lowerrootvp);
-		hashdone(nmp->ovm_node_hashtbl, HASH_LIST, nmp->ovm_node_hash);
 		kmem_free(nmp, sizeof(struct overlay_mount));
 		return error;
 	}
@@ -236,8 +231,6 @@ ov_unmount(struct mount *mp, int mntflag
 	 * Finally, throw away the overlay_mount structure
 	 */
 	omp = mp->mnt_data;
-	mutex_destroy(&omp->ovm_hashlock);
-	hashdone(omp->ovm_node_hashtbl, HASH_LIST, omp->ovm_node_hash);
 	kmem_free(omp, sizeof(struct overlay_mount));
 	mp->mnt_data = NULL;
 	return 0;
@@ -260,6 +253,7 @@ struct vfsops overlay_vfsops = {
 	.vfs_quotactl = layerfs_quotactl,
 	.vfs_statvfs = layerfs_statvfs,
 	.vfs_sync = layerfs_sync,
+	.vfs_loadvnode = layerfs_loadvnode,
 	.vfs_vget = layerfs_vget,
 	.vfs_fhtovp = layerfs_fhtovp,
 	.vfs_vptofh = layerfs_vptofh,

Index: src/sys/miscfs/umapfs/umap_vfsops.c
diff -u src/sys/miscfs/umapfs/umap_vfsops.c:1.92 src/sys/miscfs/umapfs/umap_vfsops.c:1.93
--- src/sys/miscfs/umapfs/umap_vfsops.c:1.92	Wed Apr 16 18:55:19 2014
+++ src/sys/miscfs/umapfs/umap_vfsops.c	Sun May 25 13:51:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: umap_vfsops.c,v 1.92 2014/04/16 18:55:19 maxv Exp $	*/
+/*	$NetBSD: umap_vfsops.c,v 1.93 2014/05/25 13:51:25 hannken Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umap_vfsops.c,v 1.92 2014/04/16 18:55:19 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umap_vfsops.c,v 1.93 2014/05/25 13:51:25 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -197,12 +197,7 @@ umapfs_mount(struct mount *mp, const cha
 	amp->umapm_size = sizeof(struct umap_node);
 	amp->umapm_tag = VT_UMAP;
 	amp->umapm_bypass = umap_bypass;
-	amp->umapm_alloc = layer_node_alloc;	/* the default alloc is fine */
 	amp->umapm_vnodeop_p = umap_vnodeop_p;
-	mutex_init(&amp->umapm_hashlock, MUTEX_DEFAULT, IPL_NONE);
-	amp->umapm_node_hashtbl = hashinit(NUMAPNODECACHE, HASH_LIST, true,
-	    &amp->umapm_node_hash);
-
 
 	/*
 	 * fix up umap node for root vnode.
@@ -214,8 +209,6 @@ umapfs_mount(struct mount *mp, const cha
 	 */
 	if (error) {
 		vrele(lowerrootvp);
-		hashdone(amp->umapm_node_hashtbl, HASH_LIST,
-		    amp->umapm_node_hash);
 		kmem_free(amp, sizeof(struct umap_mount));
 		return error;
 	}
@@ -271,8 +264,6 @@ umapfs_unmount(struct mount *mp, int mnt
 	/*
 	 * Finally, throw away the umap_mount structure
 	 */
-	mutex_destroy(&amp->umapm_hashlock);
-	hashdone(amp->umapm_node_hashtbl, HASH_LIST, amp->umapm_node_hash);
 	kmem_free(amp, sizeof(struct umap_mount));
 	mp->mnt_data = NULL;
 	return 0;
@@ -295,6 +286,7 @@ struct vfsops umapfs_vfsops = {
 	.vfs_quotactl = layerfs_quotactl,
 	.vfs_statvfs = layerfs_statvfs,
 	.vfs_sync = layerfs_sync,
+	.vfs_loadvnode = layerfs_loadvnode,
 	.vfs_vget = layerfs_vget,
 	.vfs_fhtovp = layerfs_fhtovp,
 	.vfs_vptofh = layerfs_vptofh,

Index: src/sys/sys/vnode.h
diff -u src/sys/sys/vnode.h:1.247 src/sys/sys/vnode.h:1.248
--- src/sys/sys/vnode.h:1.247	Thu May  8 08:21:53 2014
+++ src/sys/sys/vnode.h	Sun May 25 13:51:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnode.h,v 1.247 2014/05/08 08:21:53 hannken Exp $	*/
+/*	$NetBSD: vnode.h,v 1.248 2014/05/25 13:51:26 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -207,8 +207,8 @@ typedef struct vnode vnode_t;
 #define	VI_MARKER	0x00008000	/* Dummy marker vnode */
 #endif	/* _VFS_VNODE_PRIVATE */
 #define	VI_LAYER	0x00020000	/* vnode is on a layer filesystem */
-#ifdef _VFS_VNODE_PRIVATE
 #define	VI_LOCKSHARE	0x00040000	/* v_interlock is shared */
+#ifdef _VFS_VNODE_PRIVATE
 #define	VI_CLEAN	0x00080000	/* has been reclaimed */
 #define	VI_CHANGING	0x00100000	/* vnode changes state */
 #endif	/* _VFS_VNODE_PRIVATE */

Reply via email to