summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/kern_sysctl.c4
-rw-r--r--sys/kern/vfs_subr.c14
-rw-r--r--sys/sys/vnode.h5
3 files changed, 16 insertions, 7 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 794d1d853c6..7e2475ddfae 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.153 2007/05/29 00:17:32 thib Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.154 2007/06/01 17:29:10 beck Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -289,7 +289,7 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
case KERN_VERSION:
return (sysctl_rdstring(oldp, oldlenp, newp, version));
case KERN_MAXVNODES:
- return(sysctl_int(oldp, oldlenp, newp, newlen, &desiredvnodes));
+ return(sysctl_int(oldp, oldlenp, newp, newlen, &maxvnodes));
case KERN_MAXPROC:
return (sysctl_int(oldp, oldlenp, newp, newlen, &maxproc));
case KERN_MAXFILES:
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index dac428b9d51..a8b6aba5047 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.153 2007/05/31 17:00:51 tedu Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.154 2007/06/01 17:29:10 beck Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -105,6 +105,7 @@ void vfs_free_addrlist(struct netexport *);
void vputonfreelist(struct vnode *);
int vflush_vnode(struct vnode *, void *);
+int maxvnodes;
#ifdef DEBUG
void printlockedvnodes(void);
@@ -118,6 +119,13 @@ struct pool vnode_pool;
void
vntblinit(void)
{
+ /* buffer cache may need a vnode for each buffer */
+ /*
+ * XXX note this is different from desiredvnodes, which is
+ * XXX the old static value computed from MAXUSERS which is
+ * XXX used for sizing may other subsystems (namecache, softdeps, etc)
+ */
+ maxvnodes = bufpages;
pool_init(&vnode_pool, sizeof(struct vnode), 0, 0, 0, "vnodes",
&pool_allocator_nointr);
TAILQ_INIT(&vnode_hold_list);
@@ -356,11 +364,11 @@ getnewvnode(enum vtagtype tag, struct mount *mp, int (**vops)(void *),
* referencing buffers.
*/
toggle ^= 1;
- if (numvnodes > 2 * desiredvnodes)
+ if (numvnodes > 2 * maxvnodes)
toggle = 0;
s = splbio();
- if ((numvnodes < desiredvnodes) ||
+ if ((numvnodes < maxvnodes) ||
((TAILQ_FIRST(listhd = &vnode_free_list) == NULL) &&
((TAILQ_FIRST(listhd = &vnode_hold_list) == NULL) || toggle))) {
splx(s);
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index b4ad6836094..46c17791109 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnode.h,v 1.86 2007/05/31 18:22:25 thib Exp $ */
+/* $OpenBSD: vnode.h,v 1.87 2007/06/01 17:29:10 beck Exp $ */
/* $NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $ */
/*
@@ -238,7 +238,8 @@ extern struct freelst vnode_free_list; /* vnode free list */
* Global vnode data.
*/
extern struct vnode *rootvnode; /* root (i.e. "/") vnode */
-extern int desiredvnodes; /* number of vnodes desired */
+extern int desiredvnodes; /* XXX number of vnodes desired */
+extern int maxvnodes; /* XXX number of vnodes to allocate */
extern time_t syncdelay; /* time to delay syncing vnodes */
extern int rushjob; /* # of slots syncer should run ASAP */
#endif /* _KERNEL */