summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-04-29 20:58:38 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-04-29 20:58:38 +0000
commit9d8d7df6dfe12eb56f66e6ec3d3ae75c9e2c9067 (patch)
tree7463aa95a4a409b7d95510ae095787330df68e6a
parent55742a9a9f979540e3dffaaf49c3768862acd85a (diff)
use pool for vfs cache.
(We should really put that info into the vnode).
-rw-r--r--sys/kern/vfs_cache.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index 34a983afb61..b8a38a6a935 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_cache.c,v 1.3 1999/04/28 09:28:15 art Exp $ */
+/* $OpenBSD: vfs_cache.c,v 1.4 2001/04/29 20:58:37 art Exp $ */
/* $NetBSD: vfs_cache.c,v 1.13 1996/02/04 02:18:09 christos Exp $ */
/*
@@ -44,6 +44,7 @@
#include <sys/namei.h>
#include <sys/errno.h>
#include <sys/malloc.h>
+#include <sys/pool.h>
/*
* Name caching works as follows:
@@ -74,6 +75,8 @@ struct nchstats nchstats; /* cache effectiveness statistics */
int doingcache = 1; /* 1 => enable the cache */
+struct pool nch_pool;
+
/*
* Look for a the name in the cache. We don't do this
* if the segment name is long, simply so the cache can avoid
@@ -186,8 +189,7 @@ cache_enter(dvp, vp, cnp)
* Free the cache slot at head of lru chain.
*/
if (numcache < desiredvnodes) {
- ncp = (struct namecache *)
- malloc((u_long)sizeof *ncp, M_CACHE, M_WAITOK);
+ ncp = pool_get(&nch_pool, PR_WAITOK);
bzero((char *)ncp, sizeof *ncp);
numcache++;
} else if ((ncp = nclruhead.tqh_first) != NULL) {
@@ -228,6 +230,8 @@ nchinit()
TAILQ_INIT(&nclruhead);
nchashtbl = hashinit(desiredvnodes, M_CACHE, M_WAITOK, &nchash);
+ pool_init(&nch_pool, sizeof(struct namecache), 0, 0, 0, "nchpl",
+ 0, pool_page_alloc_nointr, pool_page_free_nointr, M_PROC);
}
/*