summaryrefslogtreecommitdiff
path: root/sys/nfs/nfs_vnops.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/nfs/nfs_vnops.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/nfs/nfs_vnops.c')
-rw-r--r--sys/nfs/nfs_vnops.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c
index be30de9f5f4..d26824f8b0e 100644
--- a/sys/nfs/nfs_vnops.c
+++ b/sys/nfs/nfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vnops.c,v 1.84 2008/06/09 23:38:37 millert Exp $ */
+/* $OpenBSD: nfs_vnops.c,v 1.85 2008/06/10 20:14:37 beck Exp $ */
/* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */
/*
@@ -2675,7 +2675,8 @@ again:
!= (B_DELWRI | B_NEEDCOMMIT))
continue;
bremfree(bp);
- bp->b_flags |= (B_BUSY | B_WRITEINPROG);
+ bp->b_flags |= B_WRITEINPROG;
+ buf_acquire(bp);
/*
* A list of these buffers is kept so that the
* second loop knows which buffers have actually
@@ -2753,10 +2754,12 @@ loop:
if ((passone || !commit) && (bp->b_flags & B_NEEDCOMMIT))
continue;
bremfree(bp);
- if (passone || !commit)
- bp->b_flags |= (B_BUSY|B_ASYNC);
- else
- bp->b_flags |= (B_BUSY|B_ASYNC|B_WRITEINPROG|B_NEEDCOMMIT);
+ if (passone || !commit) {
+ bp->b_flags |= B_ASYNC;
+ } else {
+ bp->b_flags |= (B_ASYNC|B_WRITEINPROG|B_NEEDCOMMIT);
+ }
+ buf_acquire(bp);
splx(s);
VOP_BWRITE(bp);
goto loop;
@@ -2952,6 +2955,8 @@ nfs_writebp(bp, force)
if (retv) {
if (force)
bp->b_flags |= B_WRITEINPROG;
+ bcstats.pendingwrites++;
+ bcstats.numwrites++;
VOP_STRATEGY(bp);
}