summaryrefslogtreecommitdiffstats
path: root/sys/fs/ext2fs
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/fs/ext2fs
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/fs/ext2fs')
-rw-r--r--sys/fs/ext2fs/ext2_vfsops.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/sys/fs/ext2fs/ext2_vfsops.c b/sys/fs/ext2fs/ext2_vfsops.c
index 48d5cb2..10ba705 100644
--- a/sys/fs/ext2fs/ext2_vfsops.c
+++ b/sys/fs/ext2fs/ext2_vfsops.c
@@ -480,19 +480,12 @@ ext2_reload(struct mount *mp, struct thread *td)
}
loop:
- MNT_ILOCK(mp);
- MNT_VNODE_FOREACH(vp, mp, mvp) {
- VI_LOCK(vp);
- if (vp->v_iflag & VI_DOOMED) {
- VI_UNLOCK(vp);
- continue;
- }
- MNT_IUNLOCK(mp);
+ MNT_VNODE_FOREACH_ALL(vp, mp, mvp) {
/*
* Step 4: invalidate all cached file data.
*/
if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td)) {
- MNT_VNODE_FOREACH_ABORT(mp, mvp);
+ MNT_VNODE_FOREACH_ALL_ABORT(mp, mvp);
goto loop;
}
if (vinvalbuf(vp, 0, 0, 0))
@@ -507,7 +500,7 @@ loop:
if (error) {
VOP_UNLOCK(vp, 0);
vrele(vp);
- MNT_VNODE_FOREACH_ABORT(mp, mvp);
+ MNT_VNODE_FOREACH_ALL_ABORT(mp, mvp);
return (error);
}
ext2_ei2i((struct ext2fs_dinode *) ((char *)bp->b_data +
@@ -515,9 +508,7 @@ loop:
brelse(bp);
VOP_UNLOCK(vp, 0);
vrele(vp);
- MNT_ILOCK(mp);
}
- MNT_IUNLOCK(mp);
return (0);
}
@@ -841,27 +832,24 @@ ext2_sync(struct mount *mp, int waitfor)
*/
MNT_ILOCK(mp);
loop:
- MNT_VNODE_FOREACH(vp, mp, mvp) {
- VI_LOCK(vp);
- if (vp->v_type == VNON || (vp->v_iflag & VI_DOOMED)) {
+ MNT_VNODE_FOREACH_ALL(vp, mp, mvp) {
+ if (vp->v_type == VNON) {
VI_UNLOCK(vp);
continue;
}
- MNT_IUNLOCK(mp);
ip = VTOI(vp);
if ((ip->i_flag &
(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0 &&
(vp->v_bufobj.bo_dirty.bv_cnt == 0 ||
waitfor == MNT_LAZY)) {
VI_UNLOCK(vp);
- MNT_ILOCK(mp);
continue;
}
error = vget(vp, LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK, td);
if (error) {
MNT_ILOCK(mp);
if (error == ENOENT) {
- MNT_VNODE_FOREACH_ABORT_ILOCKED(mp, mvp);
+ MNT_VNODE_FOREACH_ALL_ABORT(mp, mvp);
goto loop;
}
continue;
@@ -870,9 +858,7 @@ loop:
allerror = error;
VOP_UNLOCK(vp, 0);
vrele(vp);
- MNT_ILOCK(mp);
}
- MNT_IUNLOCK(mp);
/*
* Force stale file system control information to be flushed.
OpenPOWER on IntegriCloud