Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/chfs Convert a bogus mnt_vnodelist traversal to vfs_...



details:   https://anonhg.NetBSD.org/src/rev/b22174ab5f7c
branches:  trunk
changeset: 335523:b22174ab5f7c
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sun Jan 11 17:28:22 2015 +0000

description:
Convert a bogus mnt_vnodelist traversal to vfs_vnode_iterator.

diffstat:

 sys/ufs/chfs/chfs_gc.c    |   6 ++++--
 sys/ufs/chfs/chfs_vnode.c |  22 ++++++++++++++--------
 2 files changed, 18 insertions(+), 10 deletions(-)

diffs (75 lines):

diff -r 677777c159df -r b22174ab5f7c sys/ufs/chfs/chfs_gc.c
--- a/sys/ufs/chfs/chfs_gc.c    Sun Jan 11 17:27:54 2015 +0000
+++ b/sys/ufs/chfs/chfs_gc.c    Sun Jan 11 17:28:22 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chfs_gc.c,v 1.7 2014/09/08 17:41:11 joerg Exp $        */
+/*     $NetBSD: chfs_gc.c,v 1.8 2015/01/11 17:28:22 hannken Exp $      */
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -251,6 +251,7 @@
        dbg_gc("vp to ip\n");
        ip = VTOI(vp);
        KASSERT(ip);
+       vrele(vp);
 
        return ip;
 }
@@ -970,6 +971,7 @@
        }
 
        ip = VTOI(vnode);
+       vrele(vnode);
 
        /* Remove and obsolete the previous version. */
        mutex_enter(&chmp->chm_lock_vnocache);
@@ -1006,7 +1008,7 @@
 
        nref_len = chfs_nref_len(chmp, cheb, fd->nref);
 
-       (void)chfs_vnode_lookup(chmp, fd->vno);
+       /* XXX This was a noop  (void)chfs_vnode_lookup(chmp, fd->vno); */
 
        /* Find it in parent dirents. */
        for (nref = parent->chvc->dirents;
diff -r 677777c159df -r b22174ab5f7c sys/ufs/chfs/chfs_vnode.c
--- a/sys/ufs/chfs/chfs_vnode.c Sun Jan 11 17:27:54 2015 +0000
+++ b/sys/ufs/chfs/chfs_vnode.c Sun Jan 11 17:28:22 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chfs_vnode.c,v 1.12 2014/11/09 18:23:28 maxv Exp $     */
+/*     $NetBSD: chfs_vnode.c,v 1.13 2015/01/11 17:28:22 hannken Exp $  */
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -42,18 +42,24 @@
 #include <miscfs/genfs/genfs.h>
 
 /* chfs_vnode_lookup - lookup for a vnode */
+static bool
+chfs_vnode_lookup_selector(void *ctx, struct vnode *vp)
+{
+       ino_t *ino = ctx;
+
+       return (VTOI(vp) != NULL && VTOI(vp)->ino == *ino);
+}
 struct vnode *
 chfs_vnode_lookup(struct chfs_mount *chmp, ino_t vno)
 {
+       struct vnode_iterator *marker;
        struct vnode *vp;
-       struct chfs_inode *ip;
 
-       TAILQ_FOREACH(vp, &chmp->chm_fsmp->mnt_vnodelist, v_mntvnodes) {
-               ip = VTOI(vp);
-               if (ip && ip->ino == vno)
-                       return vp;
-       }
-       return NULL;
+       vfs_vnode_iterator_init(chmp->chm_fsmp, &marker);
+       vp = vfs_vnode_iterator_next(marker, chfs_vnode_lookup_selector, &vno);
+       vfs_vnode_iterator_destroy(marker);
+
+       return vp;
 }
 
 /* chfs_readvnode - reads a vnode from the flash and setups its inode */



Home | Main Index | Thread Index | Old Index