Source-Changes-HG archive

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

[src/trunk]: src/sys Replace vget() with vref()/vn_lock(), this node already ...



details:   https://anonhg.NetBSD.org/src/rev/70b00de894ca
branches:  trunk
changeset: 756233:70b00de894ca
user:      hannken <hannken%NetBSD.org@localhost>
date:      Fri Jul 09 08:10:50 2010 +0000

description:
Replace vget() with vref()/vn_lock(), this node already has a reference.

diffstat:

 sys/fs/smbfs/smbfs_node.c           |   9 ++++++---
 sys/fs/smbfs/smbfs_vfsops.c         |  13 +++++++++----
 sys/miscfs/overlay/overlay_vfsops.c |   9 ++++++---
 sys/rump/librump/rumpvfs/rumpfs.c   |   7 ++++---
 sys/uvm/uvm_swap.c                  |   8 +++++---
 5 files changed, 30 insertions(+), 16 deletions(-)

diffs (162 lines):

diff -r 4d8fe48ef31c -r 70b00de894ca sys/fs/smbfs/smbfs_node.c
--- a/sys/fs/smbfs/smbfs_node.c Fri Jul 09 07:31:01 2010 +0000
+++ b/sys/fs/smbfs/smbfs_node.c Fri Jul 09 08:10:50 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: smbfs_node.c,v 1.43 2010/06/24 13:03:10 hannken Exp $  */
+/*     $NetBSD: smbfs_node.c,v 1.44 2010/07/09 08:16:28 hannken Exp $  */
 
 /*
  * Copyright (c) 2000-2001 Boris Popov
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smbfs_node.c,v 1.43 2010/06/24 13:03:10 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smbfs_node.c,v 1.44 2010/07/09 08:16:28 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -112,8 +112,11 @@
                if (dvp == NULL)
                        return EINVAL;
                vp = VTOSMB(VTOSMB(dvp)->n_parent)->n_vnode;
-               if ((error = vget(vp, LK_EXCLUSIVE | LK_RETRY)) == 0)
+               vref(vp);
+               if ((error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY)) == 0)
                        *vpp = vp;
+               else
+                       vrele(vp);
                return (error);
        }
 
diff -r 4d8fe48ef31c -r 70b00de894ca sys/fs/smbfs/smbfs_vfsops.c
--- a/sys/fs/smbfs/smbfs_vfsops.c       Fri Jul 09 07:31:01 2010 +0000
+++ b/sys/fs/smbfs/smbfs_vfsops.c       Fri Jul 09 08:10:50 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: smbfs_vfsops.c,v 1.91 2010/06/24 13:03:10 hannken Exp $        */
+/*     $NetBSD: smbfs_vfsops.c,v 1.92 2010/07/09 08:16:28 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.91 2010/06/24 13:03:10 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.92 2010/07/09 08:16:28 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -322,9 +322,10 @@
 smbfs_root(struct mount *mp, struct vnode **vpp)
 {
        struct smbmount *smp = VFSTOSMBFS(mp);
+       int error;
 
        if (__predict_false(!smp->sm_root)) {
-               int error = smbfs_setroot(mp);
+               error = smbfs_setroot(mp);
                if (error)
                        return (error);
                /* fallthrough */
@@ -332,7 +333,11 @@
 
        KASSERT(smp->sm_root != NULL && SMBTOV(smp->sm_root) != NULL);
        *vpp = SMBTOV(smp->sm_root);
-       return vget(*vpp, LK_EXCLUSIVE | LK_RETRY);
+       vref(*vpp);
+       error = vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
+       if (error)
+               vrele(*vpp);
+       return error;
 }
 
 /*
diff -r 4d8fe48ef31c -r 70b00de894ca sys/miscfs/overlay/overlay_vfsops.c
--- a/sys/miscfs/overlay/overlay_vfsops.c       Fri Jul 09 07:31:01 2010 +0000
+++ b/sys/miscfs/overlay/overlay_vfsops.c       Fri Jul 09 08:10:50 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: overlay_vfsops.c,v 1.55 2010/06/24 13:03:17 hannken Exp $      */
+/*     $NetBSD: overlay_vfsops.c,v 1.56 2010/07/09 08:14:26 hannken Exp $      */
 
 /*
  * Copyright (c) 1999, 2000 National Aeronautics & Space Administration
@@ -74,7 +74,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: overlay_vfsops.c,v 1.55 2010/06/24 13:03:17 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: overlay_vfsops.c,v 1.56 2010/07/09 08:14:26 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -136,8 +136,11 @@
         * Find lower node
         */
        lowerrootvp = mp->mnt_vnodecovered;
-       if ((error = vget(lowerrootvp, LK_EXCLUSIVE | LK_RETRY)))
+       vref(lowerrootvp);
+       if ((error = vn_lock(lowerrootvp, LK_EXCLUSIVE | LK_RETRY))) {
+               vrele(lowerrootvp);
                return (error);
+       }
 
        /*
         * First cut at fixing up upper mount point
diff -r 4d8fe48ef31c -r 70b00de894ca sys/rump/librump/rumpvfs/rumpfs.c
--- a/sys/rump/librump/rumpvfs/rumpfs.c Fri Jul 09 07:31:01 2010 +0000
+++ b/sys/rump/librump/rumpvfs/rumpfs.c Fri Jul 09 08:10:50 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpfs.c,v 1.60 2010/07/03 10:55:47 pooka Exp $        */
+/*     $NetBSD: rumpfs.c,v 1.61 2010/07/09 08:10:50 hannken Exp $      */
 
 /*
  * Copyright (c) 2009  Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.60 2010/07/03 10:55:47 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.61 2010/07/09 08:10:50 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -1207,7 +1207,8 @@
 {
        struct rumpfs_mount *rfsmp = mp->mnt_data;
 
-       vget(rfsmp->rfsmp_rvp, LK_EXCLUSIVE | LK_RETRY);
+       vref(rfsmp->rfsmp_rvp);
+       vn_lock(rfsmp->rfsmp_rvp, LK_EXCLUSIVE | LK_RETRY);
        *vpp = rfsmp->rfsmp_rvp;
        return 0;
 }
diff -r 4d8fe48ef31c -r 70b00de894ca sys/uvm/uvm_swap.c
--- a/sys/uvm/uvm_swap.c        Fri Jul 09 07:31:01 2010 +0000
+++ b/sys/uvm/uvm_swap.c        Fri Jul 09 08:10:50 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_swap.c,v 1.151 2010/06/24 13:03:20 hannken Exp $   */
+/*     $NetBSD: uvm_swap.c,v 1.152 2010/07/09 08:13:33 hannken Exp $   */
 
 /*
  * Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.151 2010/06/24 13:03:20 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.152 2010/07/09 08:13:33 hannken Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_compat_netbsd.h"
@@ -552,7 +552,9 @@
         */
        if (SCARG(uap, arg) == NULL) {
                vp = rootvp;            /* miniroot */
-               if (vget(vp, LK_EXCLUSIVE)) {
+               vref(vp);
+               if (vn_lock(vp, LK_EXCLUSIVE)) {
+                       vrele(vp);
                        error = EBUSY;
                        goto out;
                }



Home | Main Index | Thread Index | Old Index