Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/fs/smbfs Change smbfs_sync() to use vfs_vnode_iterator.
details: https://anonhg.NetBSD.org/src/rev/450113146c43
branches: trunk
changeset: 327809:450113146c43
user: hannken <hannken%NetBSD.org@localhost>
date: Mon Mar 17 09:37:09 2014 +0000
description:
Change smbfs_sync() to use vfs_vnode_iterator.
diffstat:
sys/fs/smbfs/smbfs_vfsops.c | 46 ++++++++++++--------------------------------
1 files changed, 13 insertions(+), 33 deletions(-)
diffs (86 lines):
diff -r 69b230b9feca -r 450113146c43 sys/fs/smbfs/smbfs_vfsops.c
--- a/sys/fs/smbfs/smbfs_vfsops.c Mon Mar 17 09:36:34 2014 +0000
+++ b/sys/fs/smbfs/smbfs_vfsops.c Mon Mar 17 09:37:09 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: smbfs_vfsops.c,v 1.97 2014/02/25 18:30:11 pooka Exp $ */
+/* $NetBSD: smbfs_vfsops.c,v 1.98 2014/03/17 09:37:09 hannken Exp $ */
/*
* Copyright (c) 2000-2001, Boris Popov
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.97 2014/02/25 18:30:11 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.98 2014/03/17 09:37:09 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -406,45 +406,27 @@
int
smbfs_sync(struct mount *mp, int waitfor, kauth_cred_t cred)
{
- struct vnode *vp, *mvp;
+ struct vnode *vp;
+ struct vnode_iterator *marker;
struct smbnode *np;
int error, allerror = 0;
- /* Allocate a marker vnode. */
- mvp = vnalloc(mp);
- /*
- * Force stale buffer cache information to be flushed.
- */
- mutex_enter(&mntvnode_lock);
-loop:
- for (vp = TAILQ_FIRST(&mp->mnt_vnodelist); vp; vp = vunmark(mvp)) {
- vmark(mvp, vp);
- /*
- * If the vnode that we are about to sync is no longer
- * associated with this mount point, start over.
- */
- if (vp->v_mount != mp || vismarker(vp))
+ 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_enter(vp->v_interlock);
+ }
np = VTOSMB(vp);
if (np == NULL) {
- mutex_exit(vp->v_interlock);
+ vput(vp);
continue;
}
if ((vp->v_type == VNON || (np->n_flag & NMODIFIED) == 0) &&
LIST_EMPTY(&vp->v_dirtyblkhd) &&
vp->v_uobj.uo_npages == 0) {
- mutex_exit(vp->v_interlock);
- continue;
- }
- mutex_exit(&mntvnode_lock);
- error = vget(vp, LK_EXCLUSIVE | LK_NOWAIT);
- if (error) {
- mutex_enter(&mntvnode_lock);
- if (error == ENOENT) {
- (void)vunmark(mvp);
- goto loop;
- }
+ vput(vp);
continue;
}
error = VOP_FSYNC(vp, cred,
@@ -452,10 +434,8 @@
if (error)
allerror = error;
vput(vp);
- mutex_enter(&mntvnode_lock);
}
- mutex_exit(&mntvnode_lock);
- vnfree(mvp);
+ vfs_vnode_iterator_destroy(marker);
return (allerror);
}
Home |
Main Index |
Thread Index |
Old Index