Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Convert namei pathname buffer allocation to use the pool...
details: https://anonhg.NetBSD.org/src/rev/beabdd35c21e
branches: trunk
changeset: 495733:beabdd35c21e
user: thorpej <thorpej%NetBSD.org@localhost>
date: Thu Aug 03 20:41:05 2000 +0000
description:
Convert namei pathname buffer allocation to use the pool allocator.
diffstat:
sys/coda/coda_vnops.c | 16 ++++++------
sys/compat/netbsd32/netbsd32_netbsd.c | 8 +++---
sys/compat/svr4/svr4_misc.c | 4 +-
sys/kern/exec_script.c | 6 ++--
sys/kern/kern_exec.c | 12 ++++----
sys/kern/vfs_init.c | 10 ++++++-
sys/kern/vfs_lookup.c | 20 ++++++++-------
sys/kern/vfs_syscalls.c | 10 +++---
sys/miscfs/genfs/genfs_vnops.c | 4 +-
sys/miscfs/union/union_subr.c | 14 +++++++---
sys/msdosfs/msdosfs_vnops.c | 12 ++++----
sys/nfs/nfs_serv.c | 44 +++++++++++++++++-----------------
sys/nfs/nfs_subs.c | 20 +++++++++------
sys/nfs/nfs_vnops.c | 18 +++++++-------
sys/sys/namei.h | 10 ++++++-
sys/ufs/ext2fs/ext2fs_vnops.c | 12 ++++----
sys/ufs/ufs/ufs_vnops.c | 21 +++++++--------
17 files changed, 131 insertions(+), 110 deletions(-)
diffs (truncated from 999 to 300 lines):
diff -r ef9300fed501 -r beabdd35c21e sys/coda/coda_vnops.c
--- a/sys/coda/coda_vnops.c Thu Aug 03 20:35:40 2000 +0000
+++ b/sys/coda/coda_vnops.c Thu Aug 03 20:41:05 2000 +0000
@@ -6,7 +6,7 @@
rmdir
symlink
*/
-/* $NetBSD: coda_vnops.c,v 1.19 2000/06/27 17:53:44 mrg Exp $ */
+/* $NetBSD: coda_vnops.c,v 1.20 2000/08/03 20:41:05 thorpej Exp $ */
/*
*
@@ -720,7 +720,7 @@
/* locals */
if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
- FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
+ PNBUF_PUT(ap->a_cnp->cn_pnbuf);
return (0);
}
@@ -1169,7 +1169,7 @@
* why it's here, but what the hey...
*/
if ((cnp->cn_flags & SAVESTART) == 0) {
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ PNBUF_PUT(cnp->cn_pnbuf);
}
return(error);
}
@@ -1244,7 +1244,7 @@
vput(dvp);
if ((cnp->cn_flags & SAVESTART) == 0) {
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ PNBUF_PUT(cnp->cn_pnbuf);
}
return(error);
}
@@ -1323,7 +1323,7 @@
/* Drop the name buffer if we don't need to SAVESTART */
if ((cnp->cn_flags & SAVESTART) == 0) {
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ PNBUF_PUT(cnp->cn_pnbuf);
}
return(error);
}
@@ -1511,7 +1511,7 @@
* follow their lead, but this seems like it is probably
* incorrect.
*/
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ PNBUF_PUT(cnp->cn_pnbuf);
return(error);
}
@@ -1573,7 +1573,7 @@
vput(dvp);
if ((cnp->cn_flags & SAVESTART) == 0) {
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ PNBUF_PUT(cnp->cn_pnbuf);
}
return(error);
}
@@ -1672,7 +1672,7 @@
* Free the name buffer
*/
if ((cnp->cn_flags & SAVESTART) == 0) {
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ PNBUF_PUT(cnp->cn_pnbuf);
}
exit:
diff -r ef9300fed501 -r beabdd35c21e sys/compat/netbsd32/netbsd32_netbsd.c
--- a/sys/compat/netbsd32/netbsd32_netbsd.c Thu Aug 03 20:35:40 2000 +0000
+++ b/sys/compat/netbsd32/netbsd32_netbsd.c Thu Aug 03 20:41:05 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_netbsd.c,v 1.34 2000/07/14 07:21:21 thorpej Exp $ */
+/* $NetBSD: netbsd32_netbsd.c,v 1.35 2000/08/03 20:41:14 thorpej Exp $ */
/*
* Copyright (c) 1998 Matthew R. Green
@@ -2021,7 +2021,7 @@
uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS);
- FREE(nid.ni_cnd.cn_pnbuf, M_NAMEI);
+ PNBUF_PUT(nid.ni_cnd.cn_pnbuf);
vn_lock(pack.ep_vp, LK_EXCLUSIVE | LK_RETRY);
VOP_CLOSE(pack.ep_vp, FREAD, cred, p);
vput(pack.ep_vp);
@@ -2054,7 +2054,7 @@
vn_lock(pack.ep_vp, LK_EXCLUSIVE | LK_RETRY);
VOP_CLOSE(pack.ep_vp, FREAD, cred, p);
vput(pack.ep_vp);
- FREE(nid.ni_cnd.cn_pnbuf, M_NAMEI);
+ PNBUF_PUT(nid.ni_cnd.cn_pnbuf);
uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS);
freehdr:
@@ -2071,7 +2071,7 @@
VM_MAXUSER_ADDRESS - VM_MIN_ADDRESS);
if (pack.ep_emul_arg)
FREE(pack.ep_emul_arg, M_TEMP);
- FREE(nid.ni_cnd.cn_pnbuf, M_NAMEI);
+ PNBUF_PUT(nid.ni_cnd.cn_pnbuf);
vn_lock(pack.ep_vp, LK_EXCLUSIVE | LK_RETRY);
VOP_CLOSE(pack.ep_vp, FREAD, cred, p);
vput(pack.ep_vp);
diff -r ef9300fed501 -r beabdd35c21e sys/compat/svr4/svr4_misc.c
--- a/sys/compat/svr4/svr4_misc.c Thu Aug 03 20:35:40 2000 +0000
+++ b/sys/compat/svr4/svr4_misc.c Thu Aug 03 20:41:05 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: svr4_misc.c,v 1.85 2000/07/27 14:00:56 mrg Exp $ */
+/* $NetBSD: svr4_misc.c,v 1.86 2000/08/03 20:41:20 thorpej Exp $ */
/*-
* Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -1659,6 +1659,6 @@
*retval = len;
bad:
vput(nd.ni_vp);
- FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
+ PNBUF_PUT(nd.ni_cnd.cn_pnbuf);
return error;
}
diff -r ef9300fed501 -r beabdd35c21e sys/kern/exec_script.c
--- a/sys/kern/exec_script.c Thu Aug 03 20:35:40 2000 +0000
+++ b/sys/kern/exec_script.c Thu Aug 03 20:41:05 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_script.c,v 1.25 2000/08/01 04:57:29 thorpej Exp $ */
+/* $NetBSD: exec_script.c,v 1.26 2000/08/03 20:41:21 thorpej Exp $ */
/*
* Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou
@@ -252,7 +252,7 @@
}
/* free the old pathname buffer */
- FREE(oldpnbuf, M_NAMEI);
+ PNBUF_PUT(oldpnbuf);
epp->ep_flags |= (EXEC_HASARGL | EXEC_SKIPARG);
epp->ep_fa = shellargp;
@@ -288,7 +288,7 @@
vput(scriptvp);
}
- FREE(epp->ep_ndp->ni_cnd.cn_pnbuf, M_NAMEI);
+ PNBUF_PUT(epp->ep_ndp->ni_cnd.cn_pnbuf);
/* free the fake arg list, because we're not returning it */
if ((tmpsap = shellargp) != NULL) {
diff -r ef9300fed501 -r beabdd35c21e sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c Thu Aug 03 20:35:40 2000 +0000
+++ b/sys/kern/kern_exec.c Thu Aug 03 20:41:05 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_exec.c,v 1.119 2000/08/02 20:36:33 thorpej Exp $ */
+/* $NetBSD: kern_exec.c,v 1.120 2000/08/03 20:41:22 thorpej Exp $ */
/*-
* Copyright (C) 1993, 1994, 1996 Christopher G. Demetriou
@@ -181,7 +181,7 @@
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
VOP_CLOSE(vp, FREAD, p->p_ucred, p);
vput(vp);
- FREE(ndp->ni_cnd.cn_pnbuf, M_NAMEI);
+ PNBUF_PUT(ndp->ni_cnd.cn_pnbuf);
return error;
bad1:
@@ -190,7 +190,7 @@
* (which we don't yet have open).
*/
vput(vp); /* was still locked */
- FREE(ndp->ni_cnd.cn_pnbuf, M_NAMEI);
+ PNBUF_PUT(ndp->ni_cnd.cn_pnbuf);
return error;
}
@@ -513,7 +513,7 @@
uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS);
- FREE(nid.ni_cnd.cn_pnbuf, M_NAMEI);
+ PNBUF_PUT(nid.ni_cnd.cn_pnbuf);
vn_lock(pack.ep_vp, LK_EXCLUSIVE | LK_RETRY);
VOP_CLOSE(pack.ep_vp, FREAD, cred, p);
vput(pack.ep_vp);
@@ -546,7 +546,7 @@
vn_lock(pack.ep_vp, LK_EXCLUSIVE | LK_RETRY);
VOP_CLOSE(pack.ep_vp, FREAD, cred, p);
vput(pack.ep_vp);
- FREE(nid.ni_cnd.cn_pnbuf, M_NAMEI);
+ PNBUF_PUT(nid.ni_cnd.cn_pnbuf);
uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS);
freehdr:
@@ -563,7 +563,7 @@
VM_MAXUSER_ADDRESS - VM_MIN_ADDRESS);
if (pack.ep_emul_arg)
free(pack.ep_emul_arg, M_TEMP);
- FREE(nid.ni_cnd.cn_pnbuf, M_NAMEI);
+ PNBUF_PUT(nid.ni_cnd.cn_pnbuf);
vn_lock(pack.ep_vp, LK_EXCLUSIVE | LK_RETRY);
VOP_CLOSE(pack.ep_vp, FREAD, cred, p);
vput(pack.ep_vp);
diff -r ef9300fed501 -r beabdd35c21e sys/kern/vfs_init.c
--- a/sys/kern/vfs_init.c Thu Aug 03 20:35:40 2000 +0000
+++ b/sys/kern/vfs_init.c Thu Aug 03 20:41:05 2000 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: vfs_init.c,v 1.15 1999/11/15 18:49:09 fvdl Exp $ */
+/* $NetBSD: vfs_init.c,v 1.16 2000/08/03 20:41:23 thorpej Exp $ */
/*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -316,6 +316,12 @@
int i;
/*
+ * Initialize the namei pathname buffer pool.
+ */
+ pool_init(&pnbuf_pool, MAXPATHLEN, 0, 0, 0, "pnbufpl",
+ 0, pool_page_alloc_nointr, pool_page_free_nointr, M_NAMEI);
+
+ /*
* Initialize the vnode table
*/
vntblinit();
diff -r ef9300fed501 -r beabdd35c21e sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c Thu Aug 03 20:35:40 2000 +0000
+++ b/sys/kern/vfs_lookup.c Thu Aug 03 20:41:05 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_lookup.c,v 1.34 2000/05/27 00:40:47 sommerfeld Exp $ */
+/* $NetBSD: vfs_lookup.c,v 1.35 2000/08/03 20:41:23 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -58,6 +58,8 @@
#include <sys/ktrace.h>
#endif
+struct pool pnbuf_pool; /* pathname buffer pool */
+
/*
* Convert a pathname into a pointer to a locked inode.
*
@@ -106,7 +108,7 @@
* name into the buffer.
*/
if ((cnp->cn_flags & HASBUF) == 0)
- MALLOC(cnp->cn_pnbuf, caddr_t, MAXPATHLEN, M_NAMEI, M_WAITOK);
+ cnp->cn_pnbuf = PNBUF_GET();
if (ndp->ni_segflg == UIO_SYSSPACE)
error = copystr(ndp->ni_dirp, cnp->cn_pnbuf,
MAXPATHLEN, &ndp->ni_pathlen);
@@ -121,7 +123,7 @@
error = ENOENT;
if (error) {
- free(cnp->cn_pnbuf, M_NAMEI);
+ PNBUF_PUT(cnp->cn_pnbuf);
ndp->ni_vp = NULL;
return (error);
}
@@ -151,7 +153,7 @@
cnp->cn_nameptr = cnp->cn_pnbuf;
ndp->ni_startdir = dp;
if ((error = lookup(ndp)) != 0) {
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ PNBUF_PUT(cnp->cn_pnbuf);
return (error);
}
/*
@@ -159,7 +161,7 @@
*/
if ((cnp->cn_flags & ISSYMLINK) == 0) {
if ((cnp->cn_flags & (SAVENAME | SAVESTART)) == 0)
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ PNBUF_PUT(cnp->cn_pnbuf);
else
cnp->cn_flags |= HASBUF;
return (0);
@@ -177,7 +179,7 @@
break;
}
if (ndp->ni_pathlen > 1)
- MALLOC(cp, char *, MAXPATHLEN, M_NAMEI, M_WAITOK);
+ cp = PNBUF_GET();
else
cp = cnp->cn_pnbuf;
aiov.iov_base = cp;
@@ -193,7 +195,7 @@
if (error) {
Home |
Main Index |
Thread Index |
Old Index