diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2009-03-23 15:10:45 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2009-03-23 15:10:45 +0000 |
commit | 1c540fe9f9c1d6901ed3bf00697404d3ec0346ec (patch) | |
tree | 1f22d4f67ca3c19e843cc725d535ee40fc69dd1a /sys/kern | |
parent | 1b15c28e76b3163f5b9992bbe4ff4051a1b6092a (diff) |
fix buffer cache pending writs statistic so it does not go negative.
this ensures we ignore counting any buffers returning through biodone()
for which B_PHYS has been set - which should be set on all transfers
that manually do raw io bypassing the buffer cache by setting up their
own buffer and calling strategy..
ok thib@, todd@, and now that he is a buffer cache and nfs hacker oga@
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_bio.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 6892c6a560e..a2ed79f97f4 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_bio.c,v 1.110 2009/01/11 17:40:00 oga Exp $ */ +/* $OpenBSD: vfs_bio.c,v 1.111 2009/03/23 15:10:44 beck Exp $ */ /* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */ /*- @@ -1156,12 +1156,15 @@ biodone(struct buf *bp) if (!ISSET(bp->b_flags, B_READ)) { CLR(bp->b_flags, B_WRITEINPROG); - bcstats.pendingwrites--; vwakeup(bp->b_vp); - } else if (bcstats.numbufs && - (!(ISSET(bp->b_flags, B_RAW) || ISSET(bp->b_flags, B_PHYS)))) - bcstats.pendingreads--; - + } + if (bcstats.numbufs && + (!(ISSET(bp->b_flags, B_RAW) || ISSET(bp->b_flags, B_PHYS)))) { + if (!ISSET(bp->b_flags, B_READ)) + bcstats.pendingwrites--; + else + bcstats.pendingreads--; + } if (ISSET(bp->b_flags, B_CALL)) { /* if necessary, call out */ CLR(bp->b_flags, B_CALL); /* but note callout done */ (*bp->b_iodone)(bp); |