vnode_if_src 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. diff -r 17085b6e1232 -r b3ebd9465f5c sys/kern/vnode_if.sh --- a/sys/kern/vnode_if.sh Fri Feb 17 14:58:34 2017 +0100 +++ b/sys/kern/vnode_if.sh Fri Feb 17 14:58:35 2017 +0100 @@ -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 #include #include ' +[ -z "${rump}" ] && echo '#include ' [ ! -z "${rump}" ] && echo '#include ' \ && echo '#include ' @@ -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; iv_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 17085b6e1232 -r b3ebd9465f5c sys/kern/vnode_if.src --- a/sys/kern/vnode_if.src Fri Feb 17 14:58:34 2017 +0100 +++ b/sys/kern/vnode_if.src Fri Feb 17 14:58:35 2017 +0100 @@ -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;