[Midnightbsd-cvs] src [8642] trunk/sys/fs/nullfs/null_subr.c: size the nullfs hashtbl based on the current value of desiredvnodes.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Sep 25 14:19:08 EDT 2016


Revision: 8642
          http://svnweb.midnightbsd.org/src/?rev=8642
Author:   laffer1
Date:     2016-09-25 14:19:08 -0400 (Sun, 25 Sep 2016)
Log Message:
-----------
size the nullfs hashtbl based on the current value of desiredvnodes.

Modified Paths:
--------------
    trunk/sys/fs/nullfs/null_subr.c

Modified: trunk/sys/fs/nullfs/null_subr.c
===================================================================
--- trunk/sys/fs/nullfs/null_subr.c	2016-09-25 18:18:47 UTC (rev 8641)
+++ trunk/sys/fs/nullfs/null_subr.c	2016-09-25 18:19:08 UTC (rev 8642)
@@ -46,9 +46,6 @@
 
 #include <fs/nullfs/null.h>
 
-#define LOG2_SIZEVNODE 8		/* log2(sizeof struct vnode) */
-#define	NNULLNODECACHE 16
-
 /*
  * Null layer cache:
  * Each cache entry holds a reference to the lower vnode
@@ -57,12 +54,11 @@
  * alias is removed the lower vnode is vrele'd.
  */
 
-#define	NULL_NHASH(vp) \
-	(&null_node_hashtbl[(((uintptr_t)vp)>>LOG2_SIZEVNODE) & null_node_hash])
+#define	NULL_NHASH(vp) (&null_node_hashtbl[vfs_hash_index(vp) & null_hash_mask])
 
 static LIST_HEAD(null_node_hashhead, null_node) *null_node_hashtbl;
-static u_long null_node_hash;
-struct mtx null_hashmtx;
+static struct mtx null_hashmtx;
+static u_long null_hash_mask;
 
 static MALLOC_DEFINE(M_NULLFSHASH, "nullfs_hash", "NULLFS hash table");
 MALLOC_DEFINE(M_NULLFSNODE, "nullfs_node", "NULLFS vnode private part");
@@ -77,8 +73,8 @@
 	struct vfsconf *vfsp;
 {
 
-	NULLFSDEBUG("nullfs_init\n");		/* printed during system boot */
-	null_node_hashtbl = hashinit(NNULLNODECACHE, M_NULLFSHASH, &null_node_hash);
+	null_node_hashtbl = hashinit(desiredvnodes, M_NULLFSHASH,
+	    &null_hash_mask);
 	mtx_init(&null_hashmtx, "nullhs", NULL, MTX_DEF);
 	return (0);
 }
@@ -89,7 +85,7 @@
 {
 
 	mtx_destroy(&null_hashmtx);
-	free(null_node_hashtbl, M_NULLFSHASH);
+	hashdestroy(null_node_hashtbl, M_NULLFSHASH, null_hash_mask);
 	return (0);
 }
 



More information about the Midnightbsd-cvs mailing list