summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2003-11-05 04:30:08 +0000
committerkan <kan@FreeBSD.org>2003-11-05 04:30:08 +0000
commit36d60f3bb735f38bbec69f4cc40ef27a24629c54 (patch)
treed6d549e791dd7c4a627af5beb25ec44a2fcdd02d /sys/nfsclient
parent932794c27cf2ec2241eadf3b4891463fa9eb2432 (diff)
downloadFreeBSD-src-36d60f3bb735f38bbec69f4cc40ef27a24629c54.zip
FreeBSD-src-36d60f3bb735f38bbec69f4cc40ef27a24629c54.tar.gz
Remove mntvnode_mtx and replace it with per-mountpoint mutex.
Introduce two new macros MNT_ILOCK(mp)/MNT_IUNLOCK(mp) to operate on this mutex transparently. Eventually new mutex will be protecting more fields in struct mount, not only vnode list. Discussed with: jeff
Diffstat (limited to 'sys/nfsclient')
-rw-r--r--sys/nfsclient/nfs_subs.c8
-rw-r--r--sys/nfsclient/nfs_vfsops.c13
2 files changed, 11 insertions, 10 deletions
diff --git a/sys/nfsclient/nfs_subs.c b/sys/nfsclient/nfs_subs.c
index e43bd92..7b8866e 100644
--- a/sys/nfsclient/nfs_subs.c
+++ b/sys/nfsclient/nfs_subs.c
@@ -788,7 +788,7 @@ nfs_clearcommit(struct mount *mp)
GIANT_REQUIRED;
s = splbio();
- mtx_lock(&mntvnode_mtx);
+ MNT_ILOCK(mp);
loop:
for (vp = TAILQ_FIRST(&mp->mnt_nvnodelist); vp; vp = nvp) {
if (vp->v_mount != mp) /* Paranoia */
@@ -799,7 +799,7 @@ loop:
VI_UNLOCK(vp);
continue;
}
- mtx_unlock(&mntvnode_mtx);
+ MNT_IUNLOCK(mp);
for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) {
nbp = TAILQ_NEXT(bp, b_vnbufs);
if (BUF_REFCNT(bp) == 0 &&
@@ -808,9 +808,9 @@ loop:
bp->b_flags &= ~(B_NEEDCOMMIT | B_CLUSTEROK);
}
VI_UNLOCK(vp);
- mtx_lock(&mntvnode_mtx);
+ MNT_ILOCK(mp);
}
- mtx_unlock(&mntvnode_mtx);
+ MNT_IUNLOCK(mp);
splx(s);
}
diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c
index 3df0fa3..49980cf 100644
--- a/sys/nfsclient/nfs_vfsops.c
+++ b/sys/nfsclient/nfs_vfsops.c
@@ -931,7 +931,7 @@ nfs_sync(struct mount *mp, int waitfor, struct ucred *cred, struct thread *td)
/*
* Force stale buffer cache information to be flushed.
*/
- mtx_lock(&mntvnode_mtx);
+ MNT_ILOCK(mp);
loop:
for (vp = TAILQ_FIRST(&mp->mnt_nvnodelist);
vp != NULL;
@@ -944,15 +944,15 @@ loop:
goto loop;
vnp = TAILQ_NEXT(vp, v_nmntvnodes);
VI_LOCK(vp);
- mtx_unlock(&mntvnode_mtx);
+ MNT_IUNLOCK(mp);
if (VOP_ISLOCKED(vp, NULL) || TAILQ_EMPTY(&vp->v_dirtyblkhd) ||
waitfor == MNT_LAZY) {
VI_UNLOCK(vp);
- mtx_lock(&mntvnode_mtx);
+ MNT_ILOCK(mp);
continue;
}
if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td)) {
- mtx_lock(&mntvnode_mtx);
+ MNT_ILOCK(mp);
goto loop;
}
error = VOP_FSYNC(vp, cred, waitfor, td);
@@ -960,8 +960,9 @@ loop:
allerror = error;
VOP_UNLOCK(vp, 0, td);
vrele(vp);
- mtx_lock(&mntvnode_mtx);
+
+ MNT_ILOCK(mp);
}
- mtx_unlock(&mntvnode_mtx);
+ MNT_IUNLOCK(mp);
return (allerror);
}
OpenPOWER on IntegriCloud