summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_default.c
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/kern/vfs_default.c
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/kern/vfs_default.c')
-rw-r--r--sys/kern/vfs_default.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c
index 25278c8..4e62765 100644
--- a/sys/kern/vfs_default.c
+++ b/sys/kern/vfs_default.c
@@ -1114,18 +1114,15 @@ vfs_stdsync(mp, waitfor)
/*
* Force stale buffer cache information to be flushed.
*/
- MNT_ILOCK(mp);
loop:
- MNT_VNODE_FOREACH(vp, mp, mvp) {
- /* bv_cnt is an acceptable race here. */
- if (vp->v_bufobj.bo_dirty.bv_cnt == 0)
+ MNT_VNODE_FOREACH_ALL(vp, mp, mvp) {
+ if (vp->v_bufobj.bo_dirty.bv_cnt == 0) {
+ VI_UNLOCK(vp);
continue;
- VI_LOCK(vp);
- MNT_IUNLOCK(mp);
+ }
if ((error = vget(vp, lockreq, td)) != 0) {
- MNT_ILOCK(mp);
if (error == ENOENT) {
- MNT_VNODE_FOREACH_ABORT_ILOCKED(mp, mvp);
+ MNT_VNODE_FOREACH_ALL_ABORT(mp, mvp);
goto loop;
}
continue;
@@ -1134,9 +1131,7 @@ loop:
if (error)
allerror = error;
vput(vp);
- MNT_ILOCK(mp);
}
- MNT_IUNLOCK(mp);
return (allerror);
}
OpenPOWER on IntegriCloud