- Use vrefcnt() instead of directly accessing v_usecount.

This commit is contained in:
Jeff Roberson 2002-09-25 02:33:29 +00:00
parent 4d93c0be1f
commit 9026179755
6 changed files with 42 additions and 38 deletions

View File

@ -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;
}

View File

@ -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));

View File

@ -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");

View File

@ -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;
}

View File

@ -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));

View File

@ -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");