diff options
author | jeff <jeff@FreeBSD.org> | 2002-09-25 02:33:29 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2002-09-25 02:33:29 +0000 |
commit | d168f755f99bb0772204d5a6106672c073805d5d (patch) | |
tree | 0e05a08d55d1536f0fe052fae64ff4e828b5c555 /sys | |
parent | f7e588347b3192f4351b4e27c498cc085021b6e4 (diff) | |
download | FreeBSD-src-d168f755f99bb0772204d5a6106672c073805d5d.zip FreeBSD-src-d168f755f99bb0772204d5a6106672c073805d5d.tar.gz |
- Use vrefcnt() instead of directly accessing v_usecount.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/coda/coda_namecache.c | 8 | ||||
-rw-r--r-- | sys/coda/coda_subr.c | 16 | ||||
-rw-r--r-- | sys/coda/coda_vnops.c | 16 | ||||
-rw-r--r-- | sys/fs/coda/coda_namecache.c | 8 | ||||
-rw-r--r-- | sys/fs/coda/coda_subr.c | 16 | ||||
-rw-r--r-- | sys/fs/coda/coda_vnops.c | 16 |
6 files changed, 42 insertions, 38 deletions
diff --git a/sys/coda/coda_namecache.c b/sys/coda/coda_namecache.c index 8637237..f9bf03f 100644 --- a/sys/coda/coda_namecache.c +++ b/sys/coda/coda_namecache.c @@ -362,12 +362,12 @@ coda_nc_remove(cncp, dcstat) CODA_NC_HSHREM(cncp); CODA_NC_HSHNUL(cncp); /* have it be a null chain */ - if ((dcstat == IS_DOWNCALL) && (CTOV(cncp->dcp)->v_usecount == 1)) { + if ((dcstat == IS_DOWNCALL) && (vrefcnt(CTOV(cncp->dcp)) == 1)) { cncp->dcp->c_flags |= C_PURGING; } vrele(CTOV(cncp->dcp)); - if ((dcstat == IS_DOWNCALL) && (CTOV(cncp->cp)->v_usecount == 1)) { + if ((dcstat == IS_DOWNCALL) && (vrefcnt(CTOV(cncp->cp)) == 1)) { cncp->cp->c_flags |= C_PURGING; } vrele(CTOV(cncp->cp)); @@ -607,7 +607,7 @@ coda_nc_flush(dcstat) CODA_NC_HSHREM(cncp); /* only zero valid nodes */ CODA_NC_HSHNUL(cncp); if ((dcstat == IS_DOWNCALL) - && (CTOV(cncp->dcp)->v_usecount == 1)) + && (vrefcnt(CTOV(cncp->dcp)) == 1)) { cncp->dcp->c_flags |= C_PURGING; } @@ -621,7 +621,7 @@ coda_nc_flush(dcstat) } if ((dcstat == IS_DOWNCALL) - && (CTOV(cncp->cp)->v_usecount == 1)) + && (vrefcnt(CTOV(cncp->cp)) == 1)) { cncp->cp->c_flags |= C_PURGING; } diff --git a/sys/coda/coda_subr.c b/sys/coda/coda_subr.c index 8afe57d..53c4346 100644 --- a/sys/coda/coda_subr.c +++ b/sys/coda/coda_subr.c @@ -224,7 +224,7 @@ coda_kill(whoIam, dcstat) (cp->c_fid).Vnode, (cp->c_fid).Unique, cp->c_flags, - CTOV(cp)->v_usecount)); ); + vrefcnt(CTOV(cp)))); ); } } } @@ -271,7 +271,7 @@ coda_testflush(void) cp = CNODE_NEXT(cp)) { myprintf(("Live cnode fid %lx.%lx.%lx count %d\n", (cp->c_fid).Volume,(cp->c_fid).Vnode, - (cp->c_fid).Unique, CTOV(cp)->v_usecount)); + (cp->c_fid).Unique, vrefcnt(CTOV(cp)))); } } } @@ -419,8 +419,8 @@ int handleDownCall(opcode, out) CODADEBUG(CODA_ZAPFILE, myprintf(( "zapfile: fid = (%lx.%lx.%lx), refcnt = %d, error = %d\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, - CTOV(cp)->v_usecount - 1, error));); - if (CTOV(cp)->v_usecount == 1) { + vrefcnt(CTOV(cp)) - 1, error));); + if (vrefcnt(CTOV(cp)) == 1) { cp->c_flags |= C_PURGING; } vrele(CTOV(cp)); @@ -445,8 +445,8 @@ int handleDownCall(opcode, out) CODADEBUG(CODA_ZAPDIR, myprintf(( "zapdir: fid = (%lx.%lx.%lx), refcnt = %d\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, - CTOV(cp)->v_usecount - 1));); - if (CTOV(cp)->v_usecount == 1) { + vrefcnt(CTOV(cp)) - 1));); + if (vrefcnt(CTOV(cp)) == 1) { cp->c_flags |= C_PURGING; } vrele(CTOV(cp)); @@ -480,8 +480,8 @@ int handleDownCall(opcode, out) CODADEBUG(CODA_PURGEFID, myprintf(("purgefid: fid = (%lx.%lx.%lx), refcnt = %d, error = %d\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, - CTOV(cp)->v_usecount - 1, error));); - if (CTOV(cp)->v_usecount == 1) { + vrefcnt(CTOV(cp)) - 1, error));); + if (vrefcnt(CTOV(cp)) == 1) { cp->c_flags |= C_PURGING; } vrele(CTOV(cp)); diff --git a/sys/coda/coda_vnops.c b/sys/coda/coda_vnops.c index 5416147..8fdcdbf 100644 --- a/sys/coda/coda_vnops.c +++ b/sys/coda/coda_vnops.c @@ -343,7 +343,7 @@ coda_close(v) if (cp->c_ovp) { #ifdef CODA_VERBOSE printf("coda_close: destroying container ref %d, ufs vp %p of vp %p/cp %p\n", - vp->v_usecount, cp->c_ovp, vp, cp); + vrefcnt(vp), cp->c_ovp, vp, cp); #endif #ifdef hmm vgone(cp->c_ovp); @@ -492,7 +492,7 @@ printf("coda_rdwr: Internally Opening %p\n", vp); /* Have UFS handle the call. */ CODADEBUG(CODA_RDWR, myprintf(("indirect rdwr: fid = (%lx.%lx.%lx), refcnt = %d\n", cp->c_fid.Volume, cp->c_fid.Vnode, - cp->c_fid.Unique, CTOV(cp)->v_usecount)); ) + cp->c_fid.Unique, vrefcnt(CTOV(cp)))); ) if (rw == UIO_READ) { error = VOP_READ(cfvp, uiop, ioflag, cred); @@ -855,10 +855,12 @@ coda_fsync(v) * For now we ignore them. */ /* + VI_LOCK(vp); if (!vp->v_usecount) { printf("coda_fsync on vnode %p with %d usecount. c_flags = %x (%x)\n", vp, vp->v_usecount, cp->c_flags, cp->c_flags&C_PURGING); } + VI_UNLOCK(vp); */ /* @@ -926,15 +928,15 @@ coda_inactive(v) if (IS_UNMOUNTING(cp)) { #ifdef DEBUG - printf("coda_inactive: IS_UNMOUNTING use %d: vp %p, cp %p\n", vp->v_usecount, vp, cp); + printf("coda_inactive: IS_UNMOUNTING use %d: vp %p, cp %p\n", vrefcnt(vp), vp, cp); if (cp->c_ovp != NULL) printf("coda_inactive: cp->ovp != NULL use %d: vp %p, cp %p\n", - vp->v_usecount, vp, cp); + vrefcnt(vp), vp, cp); #endif lockmgr(&cp->c_lock, LK_RELEASE, &vp->v_interlock, td); } else { #ifdef OLD_DIAGNOSTIC - if (CTOV(cp)->v_usecount) { + if (vrefcnt(CTOV(cp))) { panic("coda_inactive: nonzero reference count"); } if (cp->c_ovp != NULL) { @@ -1661,7 +1663,7 @@ printf("coda_readdir: Internally Opening %p\n", vp); } /* Have UFS handle the call. */ - CODADEBUG(CODA_READDIR, myprintf(("indirect readdir: fid = (%lx.%lx.%lx), refcnt = %d\n",cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vp->v_usecount)); ) + CODADEBUG(CODA_READDIR, myprintf(("indirect readdir: fid = (%lx.%lx.%lx), refcnt = %d\n",cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vrefcnt(vp))); ) error = VOP_READDIR(cp->c_ovp, uiop, cred, eofflag, ncookies, cookies); @@ -1765,7 +1767,7 @@ coda_reclaim(v) #endif } else { #ifdef OLD_DIAGNOSTIC - if (vp->v_usecount != 0) + if (vrefcnt(vp) != 0) print("coda_reclaim: pushing active %p\n", vp); if (VTOC(vp)->c_ovp) { panic("coda_reclaim: c_ovp not void"); diff --git a/sys/fs/coda/coda_namecache.c b/sys/fs/coda/coda_namecache.c index 8637237..f9bf03f 100644 --- a/sys/fs/coda/coda_namecache.c +++ b/sys/fs/coda/coda_namecache.c @@ -362,12 +362,12 @@ coda_nc_remove(cncp, dcstat) CODA_NC_HSHREM(cncp); CODA_NC_HSHNUL(cncp); /* have it be a null chain */ - if ((dcstat == IS_DOWNCALL) && (CTOV(cncp->dcp)->v_usecount == 1)) { + if ((dcstat == IS_DOWNCALL) && (vrefcnt(CTOV(cncp->dcp)) == 1)) { cncp->dcp->c_flags |= C_PURGING; } vrele(CTOV(cncp->dcp)); - if ((dcstat == IS_DOWNCALL) && (CTOV(cncp->cp)->v_usecount == 1)) { + if ((dcstat == IS_DOWNCALL) && (vrefcnt(CTOV(cncp->cp)) == 1)) { cncp->cp->c_flags |= C_PURGING; } vrele(CTOV(cncp->cp)); @@ -607,7 +607,7 @@ coda_nc_flush(dcstat) CODA_NC_HSHREM(cncp); /* only zero valid nodes */ CODA_NC_HSHNUL(cncp); if ((dcstat == IS_DOWNCALL) - && (CTOV(cncp->dcp)->v_usecount == 1)) + && (vrefcnt(CTOV(cncp->dcp)) == 1)) { cncp->dcp->c_flags |= C_PURGING; } @@ -621,7 +621,7 @@ coda_nc_flush(dcstat) } if ((dcstat == IS_DOWNCALL) - && (CTOV(cncp->cp)->v_usecount == 1)) + && (vrefcnt(CTOV(cncp->cp)) == 1)) { cncp->cp->c_flags |= C_PURGING; } diff --git a/sys/fs/coda/coda_subr.c b/sys/fs/coda/coda_subr.c index 8afe57d..53c4346 100644 --- a/sys/fs/coda/coda_subr.c +++ b/sys/fs/coda/coda_subr.c @@ -224,7 +224,7 @@ coda_kill(whoIam, dcstat) (cp->c_fid).Vnode, (cp->c_fid).Unique, cp->c_flags, - CTOV(cp)->v_usecount)); ); + vrefcnt(CTOV(cp)))); ); } } } @@ -271,7 +271,7 @@ coda_testflush(void) cp = CNODE_NEXT(cp)) { myprintf(("Live cnode fid %lx.%lx.%lx count %d\n", (cp->c_fid).Volume,(cp->c_fid).Vnode, - (cp->c_fid).Unique, CTOV(cp)->v_usecount)); + (cp->c_fid).Unique, vrefcnt(CTOV(cp)))); } } } @@ -419,8 +419,8 @@ int handleDownCall(opcode, out) CODADEBUG(CODA_ZAPFILE, myprintf(( "zapfile: fid = (%lx.%lx.%lx), refcnt = %d, error = %d\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, - CTOV(cp)->v_usecount - 1, error));); - if (CTOV(cp)->v_usecount == 1) { + vrefcnt(CTOV(cp)) - 1, error));); + if (vrefcnt(CTOV(cp)) == 1) { cp->c_flags |= C_PURGING; } vrele(CTOV(cp)); @@ -445,8 +445,8 @@ int handleDownCall(opcode, out) CODADEBUG(CODA_ZAPDIR, myprintf(( "zapdir: fid = (%lx.%lx.%lx), refcnt = %d\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, - CTOV(cp)->v_usecount - 1));); - if (CTOV(cp)->v_usecount == 1) { + vrefcnt(CTOV(cp)) - 1));); + if (vrefcnt(CTOV(cp)) == 1) { cp->c_flags |= C_PURGING; } vrele(CTOV(cp)); @@ -480,8 +480,8 @@ int handleDownCall(opcode, out) CODADEBUG(CODA_PURGEFID, myprintf(("purgefid: fid = (%lx.%lx.%lx), refcnt = %d, error = %d\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, - CTOV(cp)->v_usecount - 1, error));); - if (CTOV(cp)->v_usecount == 1) { + vrefcnt(CTOV(cp)) - 1, error));); + if (vrefcnt(CTOV(cp)) == 1) { cp->c_flags |= C_PURGING; } vrele(CTOV(cp)); diff --git a/sys/fs/coda/coda_vnops.c b/sys/fs/coda/coda_vnops.c index 5416147..8fdcdbf 100644 --- a/sys/fs/coda/coda_vnops.c +++ b/sys/fs/coda/coda_vnops.c @@ -343,7 +343,7 @@ coda_close(v) if (cp->c_ovp) { #ifdef CODA_VERBOSE printf("coda_close: destroying container ref %d, ufs vp %p of vp %p/cp %p\n", - vp->v_usecount, cp->c_ovp, vp, cp); + vrefcnt(vp), cp->c_ovp, vp, cp); #endif #ifdef hmm vgone(cp->c_ovp); @@ -492,7 +492,7 @@ printf("coda_rdwr: Internally Opening %p\n", vp); /* Have UFS handle the call. */ CODADEBUG(CODA_RDWR, myprintf(("indirect rdwr: fid = (%lx.%lx.%lx), refcnt = %d\n", cp->c_fid.Volume, cp->c_fid.Vnode, - cp->c_fid.Unique, CTOV(cp)->v_usecount)); ) + cp->c_fid.Unique, vrefcnt(CTOV(cp)))); ) if (rw == UIO_READ) { error = VOP_READ(cfvp, uiop, ioflag, cred); @@ -855,10 +855,12 @@ coda_fsync(v) * For now we ignore them. */ /* + VI_LOCK(vp); if (!vp->v_usecount) { printf("coda_fsync on vnode %p with %d usecount. c_flags = %x (%x)\n", vp, vp->v_usecount, cp->c_flags, cp->c_flags&C_PURGING); } + VI_UNLOCK(vp); */ /* @@ -926,15 +928,15 @@ coda_inactive(v) if (IS_UNMOUNTING(cp)) { #ifdef DEBUG - printf("coda_inactive: IS_UNMOUNTING use %d: vp %p, cp %p\n", vp->v_usecount, vp, cp); + printf("coda_inactive: IS_UNMOUNTING use %d: vp %p, cp %p\n", vrefcnt(vp), vp, cp); if (cp->c_ovp != NULL) printf("coda_inactive: cp->ovp != NULL use %d: vp %p, cp %p\n", - vp->v_usecount, vp, cp); + vrefcnt(vp), vp, cp); #endif lockmgr(&cp->c_lock, LK_RELEASE, &vp->v_interlock, td); } else { #ifdef OLD_DIAGNOSTIC - if (CTOV(cp)->v_usecount) { + if (vrefcnt(CTOV(cp))) { panic("coda_inactive: nonzero reference count"); } if (cp->c_ovp != NULL) { @@ -1661,7 +1663,7 @@ printf("coda_readdir: Internally Opening %p\n", vp); } /* Have UFS handle the call. */ - CODADEBUG(CODA_READDIR, myprintf(("indirect readdir: fid = (%lx.%lx.%lx), refcnt = %d\n",cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vp->v_usecount)); ) + CODADEBUG(CODA_READDIR, myprintf(("indirect readdir: fid = (%lx.%lx.%lx), refcnt = %d\n",cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vrefcnt(vp))); ) error = VOP_READDIR(cp->c_ovp, uiop, cred, eofflag, ncookies, cookies); @@ -1765,7 +1767,7 @@ coda_reclaim(v) #endif } else { #ifdef OLD_DIAGNOSTIC - if (vp->v_usecount != 0) + if (vrefcnt(vp) != 0) print("coda_reclaim: pushing active %p\n", vp); if (VTOC(vp)->c_ovp) { panic("coda_reclaim: c_ovp not void"); |