summaryrefslogtreecommitdiff
path: root/sys/kern/vfs_subr.c
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2008-06-10 20:14:38 +0000
committerBob Beck <beck@cvs.openbsd.org>2008-06-10 20:14:38 +0000
commitb24b61b32a9fedc5de53427f16b7eb72e27e858d (patch)
tree7fb0535d861bd759c5fd3ec6d937d5aa85b4aeda /sys/kern/vfs_subr.c
parentcb3bb3cecc1d0474c3e63d1cdf36ba8c39fdf873 (diff)
Buffer cache revamp
1) remove multiple size queues, introduced as a stopgap. 2) decouple pages containing data from their mappings 3) only keep buffers mapped when they actually have to be mapped (right now, this is when buffers are B_BUSY) 4) New functions to make a buffer busy, and release the busy flag (buf_acquire and buf_release) 5) Move high/low water marks and statistics counters into a structure 6) Add a sysctl to retrieve buffer cache statistics Tested in several variants and beat upon by bob and art for a year. run accidentally on henning's nfs server for a few months... ok deraadt@, krw@, art@ - who promises to be around to deal with any fallout
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r--sys/kern/vfs_subr.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 3ac320e5bc1..65153b0cdfc 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.167 2008/06/09 23:38:37 millert Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.168 2008/06/10 20:14:36 beck Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -120,7 +120,7 @@ void
vntblinit(void)
{
/* buffer cache may need a vnode for each buffer */
- maxvnodes = desiredvnodes;
+ maxvnodes = bufpages;
pool_init(&vnode_pool, sizeof(struct vnode), 0, 0, 0, "vnodes",
&pool_allocator_nointr);
TAILQ_INIT(&vnode_hold_list);
@@ -1256,8 +1256,12 @@ vfs_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
free(tmpvfsp, M_TEMP);
return (ret);
- }
+ case VFS_BCACHESTAT: /* buffer cache statistics */
+ ret = sysctl_rdstruct(oldp, oldlenp, newp, &bcstats,
+ sizeof(struct bcachestats));
+ return(ret);
+ }
return (EOPNOTSUPP);
}
@@ -1664,7 +1668,7 @@ vfs_syncwait(int verbose)
if (bp->b_flags & B_DELWRI) {
s = splbio();
bremfree(bp);
- bp->b_flags |= B_BUSY;
+ buf_acquire(bp);
splx(s);
nbusy++;
bawrite(bp);
@@ -1835,7 +1839,7 @@ loop:
break;
}
bremfree(bp);
- bp->b_flags |= B_BUSY;
+ buf_acquire(bp);
/*
* XXX Since there are no node locks for NFS, I believe
* there is a slight chance that a delayed write will
@@ -1873,7 +1877,7 @@ loop:
if ((bp->b_flags & B_DELWRI) == 0)
panic("vflushbuf: not dirty");
bremfree(bp);
- bp->b_flags |= B_BUSY;
+ buf_acquire(bp);
splx(s);
/*
* Wait for I/O associated with indirect blocks to complete,