Use a pool cache for namei buffers -- it's faster to allocate from

a pool cache than a pool.
This commit is contained in:
thorpej 2001-10-17 23:33:29 +00:00
parent be3168ab71
commit 9b2f51421c
3 changed files with 9 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_init.c,v 1.18 2001/01/22 12:17:41 jdolecek Exp $ */ /* $NetBSD: vfs_init.c,v 1.19 2001/10/17 23:33:29 thorpej Exp $ */
/*- /*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -324,10 +324,11 @@ vfsinit()
int i; int i;
/* /*
* Initialize the namei pathname buffer pool. * Initialize the namei pathname buffer pool and cache.
*/ */
pool_init(&pnbuf_pool, MAXPATHLEN, 0, 0, 0, "pnbufpl", pool_init(&pnbuf_pool, MAXPATHLEN, 0, 0, 0, "pnbufpl",
0, pool_page_alloc_nointr, pool_page_free_nointr, M_NAMEI); 0, pool_page_alloc_nointr, pool_page_free_nointr, M_NAMEI);
pool_cache_init(&pnbuf_cache, &pnbuf_pool, NULL, NULL, NULL);
/* /*
* Initialize the vnode table * Initialize the vnode table

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_lookup.c,v 1.36 2001/09/08 02:02:04 christos Exp $ */ /* $NetBSD: vfs_lookup.c,v 1.37 2001/10/17 23:33:29 thorpej Exp $ */
/* /*
* Copyright (c) 1982, 1986, 1989, 1993 * Copyright (c) 1982, 1986, 1989, 1993
@ -59,6 +59,7 @@
#endif #endif
struct pool pnbuf_pool; /* pathname buffer pool */ struct pool pnbuf_pool; /* pathname buffer pool */
struct pool_cache pnbuf_cache; /* pathname buffer cache */
/* /*
* Convert a pathname into a pointer to a locked inode. * Convert a pathname into a pointer to a locked inode.

View File

@ -1,4 +1,4 @@
/* $NetBSD: namei.h,v 1.22 2001/09/24 06:01:13 chs Exp $ */ /* $NetBSD: namei.h,v 1.23 2001/10/17 23:33:29 thorpej Exp $ */
/* /*
* Copyright (c) 1985, 1989, 1991, 1993 * Copyright (c) 1985, 1989, 1991, 1993
@ -178,9 +178,10 @@ struct namecache {
#include <sys/pool.h> #include <sys/pool.h>
extern struct pool pnbuf_pool; /* pathname buffer pool */ extern struct pool pnbuf_pool; /* pathname buffer pool */
extern struct pool_cache pnbuf_cache; /* pathname buffer cache */
#define PNBUF_GET() pool_get(&pnbuf_pool, PR_WAITOK) #define PNBUF_GET() pool_cache_get(&pnbuf_cache, PR_WAITOK)
#define PNBUF_PUT(pnb) pool_put(&pnbuf_pool, (pnb)) #define PNBUF_PUT(pnb) pool_cache_put(&pnbuf_cache, (pnb))
int namei __P((struct nameidata *ndp)); int namei __P((struct nameidata *ndp));
int lookup __P((struct nameidata *ndp)); int lookup __P((struct nameidata *ndp));