Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/nfs Change nfs_sync() to use vfs_vnode_iterator.
details: https://anonhg.NetBSD.org/src/rev/bc30d9cb4951
branches: trunk
changeset: 327805:bc30d9cb4951
user: hannken <hannken%NetBSD.org@localhost>
date: Mon Mar 17 09:34:51 2014 +0000
description:
Change nfs_sync() to use vfs_vnode_iterator.
diffstat:
sys/nfs/nfs_vfsops.c | 48 +++++++++++++++---------------------------------
1 files changed, 15 insertions(+), 33 deletions(-)
diffs (83 lines):
diff -r d16917841ec2 -r bc30d9cb4951 sys/nfs/nfs_vfsops.c
--- a/sys/nfs/nfs_vfsops.c Mon Mar 17 09:34:16 2014 +0000
+++ b/sys/nfs/nfs_vfsops.c Mon Mar 17 09:34:51 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_vfsops.c,v 1.224 2014/02/25 18:30:12 pooka Exp $ */
+/* $NetBSD: nfs_vfsops.c,v 1.225 2014/03/17 09:34:51 hannken Exp $ */
/*
* Copyright (c) 1989, 1993, 1995
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.224 2014/02/25 18:30:12 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.225 2014/03/17 09:34:51 hannken Exp $");
#if defined(_KERNEL_OPT)
#include "opt_nfs.h"
@@ -945,51 +945,33 @@
int
nfs_sync(struct mount *mp, int waitfor, kauth_cred_t cred)
{
- struct vnode *vp, *mvp;
+ struct vnode *vp;
+ struct vnode_iterator *marker;
int error, allerror = 0;
/*
* Force stale buffer cache information to be flushed.
*/
- mvp = vnalloc(mp);
-loop:
- /*
- * NOTE: not using the TAILQ_FOREACH here since in this loop vgone()
- * and vclean() can be called indirectly
- */
- mutex_enter(&mntvnode_lock);
- for (vp = TAILQ_FIRST(&mp->mnt_vnodelist); vp; vp = vunmark(mvp)) {
- vmark(mvp, vp);
- if (vp->v_mount != mp || vismarker(vp))
- continue;
- mutex_enter(vp->v_interlock);
- /* XXX MNT_LAZY cannot be right? */
- if (waitfor == MNT_LAZY ||
- (LIST_EMPTY(&vp->v_dirtyblkhd) &&
- UVM_OBJ_IS_CLEAN(&vp->v_uobj))) {
- mutex_exit(vp->v_interlock);
+ vfs_vnode_iterator_init(mp, &marker);
+ while (vfs_vnode_iterator_next(marker, &vp)) {
+ error = vn_lock(vp, LK_EXCLUSIVE);
+ if (error) {
+ vrele(vp);
continue;
}
- mutex_exit(&mntvnode_lock);
- error = vget(vp, LK_EXCLUSIVE | LK_NOWAIT);
- if (error != 0) {
- if (error != ENOENT) {
- mutex_enter(&mntvnode_lock);
- continue;
- }
- (void)vunmark(mvp);
- goto loop;
+ if (LIST_EMPTY(&vp->v_dirtyblkhd) &&
+ UVM_OBJ_IS_CLEAN(&vp->v_uobj)) {
+ vput(vp);
+ continue;
}
error = VOP_FSYNC(vp, cred,
waitfor == MNT_WAIT ? FSYNC_WAIT : 0, 0, 0);
if (error)
allerror = error;
vput(vp);
- mutex_enter(&mntvnode_lock);
}
- mutex_exit(&mntvnode_lock);
- vnfree(mvp);
- return (allerror);
+ vfs_vnode_iterator_destroy(marker);
+ return allerror;
}
/*
Home |
Main Index |
Thread Index |
Old Index