summaryrefslogtreecommitdiffstats
path: root/sys/fs/nwfs
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2002-09-25 02:32:42 +0000
committerjeff <jeff@FreeBSD.org>2002-09-25 02:32:42 +0000
commitf7e588347b3192f4351b4e27c498cc085021b6e4 (patch)
tree8197cc22dc1ce7991152741f8cdeab9111066188 /sys/fs/nwfs
parent55a297392dfe0205c2d76aca3bd3de47ea4877b3 (diff)
downloadFreeBSD-src-f7e588347b3192f4351b4e27c498cc085021b6e4.zip
FreeBSD-src-f7e588347b3192f4351b4e27c498cc085021b6e4.tar.gz
- Use vrefcnt() where it is safe to do so instead of doing direct and
unlocked accesses to v_usecount. - Lock access to the buf lists in the various sync routines. interlock locking could be avoided almost entirely in leaf filesystems if the fsync function had a generic helper.
Diffstat (limited to 'sys/fs/nwfs')
-rw-r--r--sys/fs/nwfs/nwfs_node.c8
-rw-r--r--sys/fs/nwfs/nwfs_vfsops.c6
-rw-r--r--sys/fs/nwfs/nwfs_vnops.c4
3 files changed, 9 insertions, 9 deletions
diff --git a/sys/fs/nwfs/nwfs_node.c b/sys/fs/nwfs/nwfs_node.c
index 7a85d55..1d599fc 100644
--- a/sys/fs/nwfs/nwfs_node.c
+++ b/sys/fs/nwfs/nwfs_node.c
@@ -103,8 +103,8 @@ nwfs_sysctl_vnprint(SYSCTL_HANDLER_ARGS) {
LIST_FOREACH(np, nhpp, n_hash) {
vp = NWTOV(np);
vprint(NULL, vp);
- printf("%s:%d:%d:%d:%d\n",np->n_name,vp->v_usecount,vp->v_holdcnt,
- np->n_fid.f_id, np->n_fid.f_parent);
+ printf("%s:%d:%d:%d:%d\n",np->n_name,vrefcnt(vp),
+ vp->v_holdcnt,np->n_fid.f_id, np->n_fid.f_parent);
}
}
return 0;
@@ -256,7 +256,7 @@ nwfs_reclaim(ap)
struct nwmount *nmp = VTONWFS(vp);
struct thread *td = ap->a_td;
- NCPVNDEBUG("%s,%d\n", np->n_name, vp->v_usecount);
+ NCPVNDEBUG("%s,%d\n", np->n_name, vrefcnt(vp));
if (np->n_flag & NREFPARENT) {
np->n_flag &= ~NREFPARENT;
if (nwfs_lookupnp(nmp, np->n_parent, td, &dnp) == 0) {
@@ -293,7 +293,7 @@ nwfs_inactive(ap)
struct nwnode *np = VTONW(vp);
int error;
- NCPVNDEBUG("%s: %d\n", VTONW(vp)->n_name, vp->v_usecount);
+ NCPVNDEBUG("%s: %d\n", VTONW(vp)->n_name, vrefcnt(vp));
if (np->opened) {
error = nwfs_vinvalbuf(vp, V_SAVE, cred, td, 1);
error = ncp_close_file(NWFSTOCONN(VTONWFS(vp)), &np->n_fh, td, cred);
diff --git a/sys/fs/nwfs/nwfs_vfsops.c b/sys/fs/nwfs/nwfs_vfsops.c
index 76776d9..f097b3e 100644
--- a/sys/fs/nwfs/nwfs_vfsops.c
+++ b/sys/fs/nwfs/nwfs_vfsops.c
@@ -221,7 +221,7 @@ static int nwfs_mount(struct mount *mp, char *path, caddr_t data,
* Lose the lock but keep the ref.
*/
VOP_UNLOCK(vp, 0, curthread);
- NCPVODEBUG("rootvp.vrefcnt=%d\n",vp->v_usecount);
+ NCPVODEBUG("rootvp.vrefcnt=%d\n",vrefcnt(vp));
return error;
bad:
if (nmp)
@@ -490,10 +490,10 @@ loop:
goto loop;
nvp = TAILQ_NEXT(vp, v_nmntvnodes);
mtx_unlock(&mntvnode_mtx);
- mtx_lock(&vp->v_interlock);
+ VI_LOCK(vp);
if (VOP_ISLOCKED(vp, NULL) || TAILQ_EMPTY(&vp->v_dirtyblkhd) ||
waitfor == MNT_LAZY) {
- mtx_unlock(&vp->v_interlock);
+ VI_UNLOCK(vp);
mtx_lock(&mntvnode_mtx);
continue;
}
diff --git a/sys/fs/nwfs/nwfs_vnops.c b/sys/fs/nwfs/nwfs_vnops.c
index b62f4f8..d1ecd32 100644
--- a/sys/fs/nwfs/nwfs_vnops.c
+++ b/sys/fs/nwfs/nwfs_vnops.c
@@ -490,7 +490,7 @@ nwfs_remove(ap)
struct nwmount *nmp = VTONWFS(vp);
int error;
- if (vp->v_type == VDIR || np->opened || vp->v_usecount != 1)
+ if (vp->v_type == VDIR || np->opened || vrefcnt(vp) != 1)
return EPERM;
cache_purge(vp);
error = ncp_DeleteNSEntry(nmp, VTONW(dvp)->n_fid.f_id,
@@ -533,7 +533,7 @@ nwfs_rename(ap)
goto out;
}
- if (tvp && tvp->v_usecount > 1) {
+ if (tvp && vrefcnt(tvp) > 1) {
error = EBUSY;
goto out;
}
OpenPOWER on IntegriCloud