summaryrefslogtreecommitdiff
path: root/sys/kern/vfs_subr.c
diff options
context:
space:
mode:
authorConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2001-02-26 00:18:34 +0000
committerConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2001-02-26 00:18:34 +0000
commit67f94148be8b705e072f1d8e7b5463bbf9c96967 (patch)
treee1df6bd31077319ef9e637c61a5e24ea27d0cdc6 /sys/kern/vfs_subr.c
parentf2fb02a073f870c5a2512bcdde76d90c60b0452b (diff)
Make ref counts 32-bit unsigned ints as opposed to a potpourri of longs and
ints.
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r--sys/kern/vfs_subr.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 5b6ca33f3c9..c1702e63ab4 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.51 2001/02/24 19:07:08 csapuntz Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.52 2001/02/26 00:18:33 csapuntz Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -705,7 +705,7 @@ vref(vp)
struct vnode *vp;
{
simple_lock(&vp->v_interlock);
- if (vp->v_usecount <= 0)
+ if (vp->v_usecount == 0)
panic("vref used where vget required");
vp->v_usecount++;
simple_unlock(&vp->v_interlock);
@@ -766,18 +766,19 @@ vput(vp)
panic("vput: null vp");
#endif
simple_lock(&vp->v_interlock);
+
+#ifdef DIAGNOSTIC
+ if (vp->v_usecount == 0 || vp->v_writecount != 0) {
+ vprint("vput: bad ref count", vp);
+ panic("vput: ref cnt");
+ }
+#endif
vp->v_usecount--;
if (vp->v_usecount > 0) {
simple_unlock(&vp->v_interlock);
VOP_UNLOCK(vp, 0, p);
return;
}
-#ifdef DIAGNOSTIC
- if (vp->v_usecount < 0 || vp->v_writecount != 0) {
- vprint("vput: bad ref count", vp);
- panic("vput: ref cnt");
- }
-#endif
vputonfreelist(vp);
@@ -801,17 +802,17 @@ vrele(vp)
panic("vrele: null vp");
#endif
simple_lock(&vp->v_interlock);
- vp->v_usecount--;
- if (vp->v_usecount > 0) {
- simple_unlock(&vp->v_interlock);
- return;
- }
#ifdef DIAGNOSTIC
- if (vp->v_usecount < 0 || vp->v_writecount != 0) {
+ if (vp->v_usecount == 0 || vp->v_writecount != 0) {
vprint("vrele: bad ref count", vp);
panic("vrele: ref cnt");
}
#endif
+ vp->v_usecount--;
+ if (vp->v_usecount > 0) {
+ simple_unlock(&vp->v_interlock);
+ return;
+ }
vputonfreelist(vp);
@@ -1265,7 +1266,7 @@ vprint(label, vp)
if (label != NULL)
printf("%s: ", label);
- printf("type %s, usecount %d, writecount %d, holdcount %ld,",
+ printf("type %s, usecount %u, writecount %u, holdcount %u,",
typename[vp->v_type], vp->v_usecount, vp->v_writecount,
vp->v_holdcnt);
buf[0] = '\0';
@@ -1874,17 +1875,17 @@ fs_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
* Manipulates v_numoutput. Must be called at splbio()
*/
int
-vwaitforio(vp, slpflag, wchan, timeo)
+vwaitforio(vp, slpflag, wmesg, timeo)
struct vnode *vp;
int slpflag, timeo;
- char *wchan;
+ char *wmesg;
{
int error = 0;
while (vp->v_numoutput) {
vp->v_bioflag |= VBIOWAIT;
error = tsleep((caddr_t)&vp->v_numoutput,
- slpflag | (PRIBIO + 1), wchan, timeo);
+ slpflag | (PRIBIO + 1), wmesg, timeo);
if (error)
break;
}
@@ -1903,9 +1904,9 @@ vwakeup(vp)
struct vnode *vp;
{
if (vp != NULL) {
- if (--vp->v_numoutput < 0)
+ if (vp->v_numoutput-- == 0)
panic("vwakeup: neg numoutput");
- if ((vp->v_bioflag & VBIOWAIT) && vp->v_numoutput <= 0) {
+ if ((vp->v_bioflag & VBIOWAIT) && vp->v_numoutput == 0) {
vp->v_bioflag &= ~VBIOWAIT;
wakeup((caddr_t)&vp->v_numoutput);
}
@@ -2086,10 +2087,9 @@ brelvp(bp)
simple_lock(&vp->v_interlock);
#ifdef DIAGNOSTIC
- if (vp->v_holdcnt <= 0)
+ if (vp->v_holdcnt == 0)
panic("brelvp: holdcnt");
#endif
-
vp->v_holdcnt--;
/*