Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/cddl/osnet/dist/uts/common/fs/zfs Change zfs_sync()...
details: https://anonhg.NetBSD.org/src/rev/9bf2f73cfc35
branches: trunk
changeset: 794550:9bf2f73cfc35
user: hannken <hannken%NetBSD.org@localhost>
date: Mon Mar 17 09:37:41 2014 +0000
description:
Change zfs_sync() to use vfs_vnode_iterator.
diffstat:
external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c | 48 +++-------------
1 files changed, 10 insertions(+), 38 deletions(-)
diffs (93 lines):
diff -r 23bd3fe10ea0 -r 9bf2f73cfc35 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c Mon Mar 17 09:37:09 2014 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c Mon Mar 17 09:37:41 2014 +0000
@@ -153,7 +153,8 @@
{
zfsvfs_t *zfsvfs = vfsp->vfs_data;
znode_t *zp;
- vnode_t *vp, *nvp, *mvp;
+ vnode_t *vp;
+ struct vnode_iterator *marker;
dmu_tx_t *tx;
int error;
@@ -167,51 +168,26 @@
if (panicstr)
return (0);
- /* Allocate a marker vnode. */
- mvp = vnalloc(vfsp);
-
/*
* On NetBSD, we need to push out atime updates. Solaris does
* this during VOP_INACTIVE, but that does not work well with the
* BSD VFS, so we do it in batch here.
*/
- mutex_enter(&mntvnode_lock);
-loop:
- for (vp = TAILQ_FIRST(&vfsp->mnt_vnodelist); vp; vp = nvp) {
- nvp = TAILQ_NEXT(vp, v_mntvnodes);
- /*
- * If the vnode that we are about to sync is no
- * longer associated with this mount point, start
- * over.
- */
- if (vp->v_mount != vfsp)
- goto loop;
- /*
- * Don't interfere with concurrent scans of this FS.
- */
- if (vismarker(vp))
+ vfs_vnode_iterator_init(vfsp, &marker);
+ while (vfs_vnode_iterator_next(marker, &vp)) {
+ error = vn_lock(vp, LK_EXCLUSIVE);
+ if (error) {
+ vrele(vp);
continue;
+ }
/*
* Skip the vnode/inode if inaccessible, or if the
* atime is clean.
*/
- mutex_enter(vp->v_interlock);
zp = VTOZ(vp);
if (zp == NULL || vp->v_type == VNON ||
- (vp->v_iflag & (VI_XLOCK | VI_CLEAN)) != 0 ||
zp->z_atime_dirty == 0 || zp->z_unlinked) {
- mutex_exit(vp->v_interlock);
- continue;
- }
- vmark(mvp, vp);
- mutex_exit(&mntvnode_lock);
- error = vget(vp, LK_EXCLUSIVE);
- if (error) {
- mutex_enter(&mntvnode_lock);
- nvp = vunmark(mvp);
- if (error == ENOENT) {
- goto loop;
- }
+ vput(vp);
continue;
}
tx = dmu_tx_create(zfsvfs->z_os);
@@ -227,10 +203,8 @@
dmu_tx_commit(tx);
}
vput(vp);
- mutex_enter(&mntvnode_lock);
- nvp = vunmark(mvp);
}
- mutex_exit(&mntvnode_lock);
+ vfs_vnode_iterator_destroy(marker);
/*
* SYNC_ATTR is used by fsflush() to force old filesystems like UFS
@@ -274,8 +248,6 @@
spa_sync_allpools();
}
- vnfree(nvp);
-
return (0);
}
Home |
Main Index |
Thread Index |
Old Index