From 1c540fe9f9c1d6901ed3bf00697404d3ec0346ec Mon Sep 17 00:00:00 2001 From: Bob Beck Date: Mon, 23 Mar 2009 15:10:45 +0000 Subject: 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@ --- sys/kern/vfs_bio.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'sys') 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); -- cgit v1.2.3