summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2012-04-17 16:28:22 +0000
committermckusick <mckusick@FreeBSD.org>2012-04-17 16:28:22 +0000
commitffee40eeff5500634fb5111e387f11dee781d197 (patch)
tree0e74691cb191897ed22ab84b20109f1b4147b16d /sys/nfsclient
parent7f09aee7a12feb487299902e6c6ec4c3ae44cdf3 (diff)
downloadFreeBSD-src-ffee40eeff5500634fb5111e387f11dee781d197.zip
FreeBSD-src-ffee40eeff5500634fb5111e387f11dee781d197.tar.gz
Replace the MNT_VNODE_FOREACH interface with MNT_VNODE_FOREACH_ALL.
The primary changes are that the user of the interface no longer needs to manage the mount-mutex locking and that the vnode that is returned has its mutex locked (thus avoiding the need to check to see if its is DOOMED or other possible end of life senarios). To minimize compatibility issues for third-party developers, the old MNT_VNODE_FOREACH interface will remain available so that this change can be MFC'ed to 9. Following the MFC to 9, MNT_VNODE_FOREACH will be removed in head. The reason for this update is to prepare for the addition of the MNT_VNODE_FOREACH_ACTIVE interface that will loop over just the active vnodes associated with a mount point (typically less than 1% of the vnodes associated with the mount point). Reviewed by: kib Tested by: Peter Holm MFC after: 2 weeks
Diffstat (limited to 'sys/nfsclient')
-rw-r--r--sys/nfsclient/nfs_subs.c10
-rw-r--r--sys/nfsclient/nfs_vfsops.c11
2 files changed, 3 insertions, 18 deletions
diff --git a/sys/nfsclient/nfs_subs.c b/sys/nfsclient/nfs_subs.c
index d00a025..0d306c0 100644
--- a/sys/nfsclient/nfs_subs.c
+++ b/sys/nfsclient/nfs_subs.c
@@ -866,16 +866,10 @@ nfs_clearcommit(struct mount *mp)
struct bufobj *bo;
MNT_ILOCK(mp);
- MNT_VNODE_FOREACH(vp, mp, nvp) {
+ MNT_VNODE_FOREACH_ALL(vp, mp, nvp) {
bo = &vp->v_bufobj;
- VI_LOCK(vp);
- if (vp->v_iflag & VI_DOOMED) {
- VI_UNLOCK(vp);
- continue;
- }
vholdl(vp);
VI_UNLOCK(vp);
- MNT_IUNLOCK(mp);
BO_LOCK(bo);
TAILQ_FOREACH_SAFE(bp, &bo->bo_dirty.bv_hd, b_bobufs, nbp) {
if (!BUF_ISLOCKED(bp) &&
@@ -885,9 +879,7 @@ nfs_clearcommit(struct mount *mp)
}
BO_UNLOCK(bo);
vdrop(vp);
- MNT_ILOCK(mp);
}
- MNT_IUNLOCK(mp);
}
/*
diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c
index 8f1be3a..b2586c3 100644
--- a/sys/nfsclient/nfs_vfsops.c
+++ b/sys/nfsclient/nfs_vfsops.c
@@ -1457,19 +1457,15 @@ nfs_sync(struct mount *mp, int waitfor)
* Force stale buffer cache information to be flushed.
*/
loop:
- MNT_VNODE_FOREACH(vp, mp, mvp) {
- VI_LOCK(vp);
- MNT_IUNLOCK(mp);
+ MNT_VNODE_FOREACH_ALL(vp, mp, mvp) {
/* XXX Racy bv_cnt check. */
if (VOP_ISLOCKED(vp) || vp->v_bufobj.bo_dirty.bv_cnt == 0 ||
waitfor == MNT_LAZY) {
VI_UNLOCK(vp);
- MNT_ILOCK(mp);
continue;
}
if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td)) {
- MNT_ILOCK(mp);
- MNT_VNODE_FOREACH_ABORT_ILOCKED(mp, mvp);
+ MNT_VNODE_FOREACH_ALL_ABORT(mp, mvp);
goto loop;
}
error = VOP_FSYNC(vp, waitfor, td);
@@ -1477,10 +1473,7 @@ loop:
allerror = error;
VOP_UNLOCK(vp, 0);
vrele(vp);
-
- MNT_ILOCK(mp);
}
- MNT_IUNLOCK(mp);
return (allerror);
}
OpenPOWER on IntegriCloud