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_clearcommit() to use vfs_vnode_iterator.



details:   https://anonhg.NetBSD.org/src/rev/04f7fe219ecb
branches:  trunk
changeset: 327806:04f7fe219ecb
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon Mar 17 09:35:24 2014 +0000

description:
Change nfs_clearcommit() to use vfs_vnode_iterator.

diffstat:

 sys/nfs/nfs_subs.c |  20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diffs (58 lines):

diff -r bc30d9cb4951 -r 04f7fe219ecb sys/nfs/nfs_subs.c
--- a/sys/nfs/nfs_subs.c        Mon Mar 17 09:34:51 2014 +0000
+++ b/sys/nfs/nfs_subs.c        Mon Mar 17 09:35:24 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_subs.c,v 1.224 2013/09/18 23:27:38 pgoyette Exp $  */
+/*     $NetBSD: nfs_subs.c,v 1.225 2014/03/17 09:35:24 hannken Exp $   */
 
 /*
  * Copyright (c) 1989, 1993
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.224 2013/09/18 23:27:38 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.225 2014/03/17 09:35:24 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_nfs.h"
@@ -1754,22 +1754,21 @@
 nfs_clearcommit(struct mount *mp)
 {
        struct vnode *vp;
+       struct vnode_iterator *marker;
        struct nfsnode *np;
        struct vm_page *pg;
        struct nfsmount *nmp = VFSTONFS(mp);
 
        rw_enter(&nmp->nm_writeverflock, RW_WRITER);
-       mutex_enter(&mntvnode_lock);
-       TAILQ_FOREACH(vp, &mp->mnt_vnodelist, v_mntvnodes) {
-               KASSERT(vp->v_mount == mp);
-               if (vp->v_type != VREG)
-                       continue;
+       vfs_vnode_iterator_init(mp, &marker);
+       while (vfs_vnode_iterator_next(marker, &vp)) {
                mutex_enter(vp->v_interlock);
-               if (vp->v_iflag & (VI_XLOCK | VI_CLEAN)) {
+               np = VTONFS(vp);
+               if (vp->v_type != VREG || vp->v_mount != mp || np == NULL) {
                        mutex_exit(vp->v_interlock);
+                       vrele(vp);
                        continue;
                }
-               np = VTONFS(vp);
                np->n_pushlo = np->n_pushhi = np->n_pushedlo =
                    np->n_pushedhi = 0;
                np->n_commitflags &=
@@ -1778,8 +1777,9 @@
                        pg->flags &= ~PG_NEEDCOMMIT;
                }
                mutex_exit(vp->v_interlock);
+               vrele(vp);
        }
-       mutex_exit(&mntvnode_lock);
+       vfs_vnode_iterator_destroy(marker);
        mutex_enter(&nmp->nm_lock);
        nmp->nm_iflag &= ~NFSMNT_STALEWRITEVERF;
        mutex_exit(&nmp->nm_lock);



Home | Main Index | Thread Index | Old Index