Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Prepare to move fstrans into vnode_if.c, allow "FST...



details:   https://anonhg.NetBSD.org/src/rev/033fad3abd79
branches:  trunk
changeset: 351680:033fad3abd79
user:      hannken <hannken%NetBSD.org@localhost>
date:      Wed Feb 22 09:45:51 2017 +0000

description:
Prepare to move fstrans into vnode_if.c, allow "FSTRANS=YES"
and "FSTRANS=NO" in the vop description.
Add fstrans_start()/fstrans_done() to all vops that have FSTRANS=YES
or have the first vnode unlocked.

diffstat:

 sys/kern/vnode_if.sh  |  18 +++++++++++++++++-
 sys/kern/vnode_if.src |  15 ++++++++++++---
 2 files changed, 29 insertions(+), 4 deletions(-)

diffs (171 lines):

diff -r 3ec8e80f9b48 -r 033fad3abd79 sys/kern/vnode_if.sh
--- a/sys/kern/vnode_if.sh      Wed Feb 22 09:45:15 2017 +0000
+++ b/sys/kern/vnode_if.sh      Wed Feb 22 09:45:51 2017 +0000
@@ -29,7 +29,7 @@
  * SUCH DAMAGE.
  */
 "
-SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.61 2016/01/26 23:28:06 pooka Exp $'
+SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.62 2017/02/22 09:45:51 hannken Exp $'
 
 # Script to produce VFS front-end sugar.
 #
@@ -100,6 +100,7 @@
        args_name=$1;
        argc=0;
        willmake=-1;
+       fstrans=0;
        next;
 }
 # Last line of description
@@ -112,6 +113,12 @@
        if ($1 == "VERSION") {
                args_name=args_name "_v" $2;
                next;
+       } else if ($1 == "FSTRANS=YES") {
+               fstrans = 1;
+               next;
+       } else if ($1 == "FSTRANS=NO") {
+               fstrans = -1;
+               next;
        }
 
        argdir[argc] = $1; i=2;
@@ -144,6 +151,8 @@
                willmake=argc;
                i++;
        }
+       if (argc == 0 && fstrans == 0 && lockstate[0] != 1)
+               fstrans = 1;
 
        # XXX: replace non-portable types for rump.  We should really
        # nuke the types from the kernel, but that is a battle for
@@ -305,6 +314,7 @@
 #include <sys/buf.h>
 #include <sys/vnode.h>
 #include <sys/lock.h>'
+[ -z "${rump}" ] && echo '#include <sys/fstrans.h>'
 [ ! -z "${rump}" ] && echo '#include <rump/rumpvnode_if.h>'            \
        && echo '#include <rump-sys/kern.h>'
 
@@ -397,6 +407,8 @@
 function bodynorm() {
        printf("{\n\tint error;\n\tbool mpsafe;\n\tstruct %s_args a;\n",
                args_name);
+       if (fstrans == 1)
+               printf("\tstruct mount *mp = %s->v_mount;\n", argname[0]);
        if (lockdebug) {
                printf("#ifdef VNODE_LOCKDEBUG\n");
                for (i=0; i<argc; i++) {
@@ -420,8 +432,12 @@
        }
        printf("\tmpsafe = (%s->v_vflag & VV_MPSAFE);\n", argname[0]);
        printf("\tif (!mpsafe) { KERNEL_LOCK(1, curlwp); }\n");
+       if (fstrans == 1)
+               printf("\tfstrans_start(mp, FSTRANS_SHARED);\n");
        printf("\terror = (VCALL(%s, VOFFSET(%s), &a));\n",
                argname[0], name);
+       if (fstrans == 1)
+               printf("\tfstrans_done(mp);\n");
        printf("\tif (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }\n");
        if (willmake != -1) {
                printf("#ifdef DIAGNOSTIC\n");
diff -r 3ec8e80f9b48 -r 033fad3abd79 sys/kern/vnode_if.src
--- a/sys/kern/vnode_if.src     Wed Feb 22 09:45:15 2017 +0000
+++ b/sys/kern/vnode_if.src     Wed Feb 22 09:45:51 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: vnode_if.src,v 1.69 2015/04/20 23:08:07 riastradh Exp $
+#      $NetBSD: vnode_if.src,v 1.70 2017/02/22 09:45:51 hannken Exp $
 #
 # Copyright (c) 1992, 1993
 #      The Regents of the University of California.  All rights reserved.
@@ -72,7 +72,7 @@
 #
 vop_lookup {
        VERSION 2
-       IN struct vnode *dvp;
+       IN LOCKED=YES struct vnode *dvp;
        OUT WILLMAKE struct vnode **vpp;
        IN struct componentname *cnp;
 };
@@ -136,7 +136,7 @@
 #% getattr    vp      L L L
 #
 vop_getattr {
-       IN struct vnode *vp;
+       IN LOCKED=YES struct vnode *vp;
        IN struct vattr *vap;
        IN kauth_cred_t cred;
 };
@@ -192,6 +192,7 @@
 #% ioctl      vp      U U U
 #
 vop_ioctl {
+       FSTRANS=NO
        IN LOCKED=NO struct vnode *vp;
        IN u_long command;
        IN void *data;
@@ -203,6 +204,7 @@
 #% fcntl      vp      U U U
 #
 vop_fcntl {
+       FSTRANS=NO
        IN LOCKED=NO struct vnode *vp;
        IN u_int command;
        IN void *data;
@@ -230,6 +232,7 @@
 #% revoke     vp      U U U
 #
 vop_revoke {
+       FSTRANS=NO
        IN LOCKED=NO struct vnode *vp;
        IN int flags;
 };
@@ -392,6 +395,7 @@
 #% reclaim    vp      U U U
 #
 vop_reclaim {
+       FSTRANS=NO
        IN LOCKED=NO struct vnode *vp;
 };
 
@@ -399,6 +403,7 @@
 #% lock               vp      U L U
 #
 vop_lock {
+       FSTRANS=NO
        IN LOCKED=NO struct vnode *vp;
        IN int flags;
 };
@@ -407,6 +412,7 @@
 #% unlock     vp      L U L
 #
 vop_unlock {
+       FSTRANS=NO
        IN LOCKED=YES struct vnode *vp;
 };
 
@@ -441,6 +447,7 @@
 #% islocked   vp      = = =
 #
 vop_islocked {
+       FSTRANS=NO
        IN struct vnode *vp;
 };
 
@@ -481,6 +488,7 @@
 #% getpages    vp = = =
 #
 vop_getpages {
+       FSTRANS=NO
        IN struct vnode *vp;
        IN voff_t offset;
        IN struct vm_page **m;
@@ -495,6 +503,7 @@
 #% putpages    vp = = =
 #
 vop_putpages {
+       FSTRANS=NO
        IN struct vnode *vp;
        IN voff_t offlo;
        IN voff_t offhi;



Home | Main Index | Thread Index | Old Index