Source-Changes-HG archive

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

[src/trunk]: src/sys/miscfs/specfs specfs: Factor VOP_UNLOCK/vn_lock out of s...



details:   https://anonhg.NetBSD.org/src/rev/87f86bc37899
branches:  trunk
changeset: 364503:87f86bc37899
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Mar 28 12:35:26 2022 +0000

description:
specfs: Factor VOP_UNLOCK/vn_lock out of switch for clarity.

No functional change.

diffstat:

 sys/miscfs/specfs/spec_vnops.c |  12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diffs (57 lines):

diff -r 4c25badfc1c8 -r 87f86bc37899 sys/miscfs/specfs/spec_vnops.c
--- a/sys/miscfs/specfs/spec_vnops.c    Mon Mar 28 12:35:17 2022 +0000
+++ b/sys/miscfs/specfs/spec_vnops.c    Mon Mar 28 12:35:26 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: spec_vnops.c,v 1.192 2022/03/28 12:35:17 riastradh Exp $       */
+/*     $NetBSD: spec_vnops.c,v 1.193 2022/03/28 12:35:26 riastradh Exp $       */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.192 2022/03/28 12:35:17 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.193 2022/03/28 12:35:26 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -632,9 +632,9 @@
         * calling .d_open, so release it now and reacquire it when
         * done.
         */
+       VOP_UNLOCK(vp);
        switch (vp->v_type) {
        case VCHR:
-               VOP_UNLOCK(vp);
                do {
                        const struct cdevsw *cdev;
 
@@ -657,12 +657,9 @@
                        /* Try to autoload device module */
                        (void) module_autoload(name, MODULE_CLASS_DRIVER);
                } while (gen != module_gen);
-
-               vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
                break;
 
        case VBLK:
-               VOP_UNLOCK(vp);
                do {
                        const struct bdevsw *bdev;
 
@@ -685,13 +682,12 @@
                         /* Try to autoload device module */
                        (void) module_autoload(name, MODULE_CLASS_DRIVER);
                } while (gen != module_gen);
-               vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
-
                break;
 
        default:
                __unreachable();
        }
+       vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 
        /*
         * If it has been revoked since we released the vnode lock and



Home | Main Index | Thread Index | Old Index