Index: sys/kern/vfs_subr.c =================================================================== --- sys/kern/vfs_subr.c +++ sys/kern/vfs_subr.c @@ -5409,7 +5409,7 @@ #ifdef DEBUG_VFS_LOCKS void -vop_strategy_pre(void *ap) +vop_strategy_debugpre(void *ap) { struct vop_strategy_args *a; struct buf *bp; @@ -5433,7 +5433,7 @@ } void -vop_lock_pre(void *ap) +vop_lock_debugpre(void *ap) { struct vop_lock1_args *a = ap; @@ -5444,7 +5444,7 @@ } void -vop_lock_post(void *ap, int rc) +vop_lock_debugpost(void *ap, int rc) { struct vop_lock1_args *a = ap; @@ -5454,7 +5454,7 @@ } void -vop_unlock_pre(void *ap) +vop_unlock_debugpre(void *ap) { struct vop_unlock_args *a = ap; @@ -5462,7 +5462,7 @@ } void -vop_need_inactive_pre(void *ap) +vop_need_inactive_debugpre(void *ap) { struct vop_need_inactive_args *a = ap; @@ -5470,7 +5470,7 @@ } void -vop_need_inactive_post(void *ap, int rc) +vop_need_inactive_debugpost(void *ap, int rc) { struct vop_need_inactive_args *a = ap; Index: sys/kern/vnode_if.src =================================================================== --- sys/kern/vnode_if.src +++ sys/kern/vnode_if.src @@ -358,8 +358,8 @@ IN struct thread *td; }; -%! need_inactive pre vop_need_inactive_pre -%! need_inactive post vop_need_inactive_post +%! need_inactive debugpre vop_need_inactive_debugpre +%! need_inactive debugpost vop_need_inactive_debugpost vop_need_inactive { IN struct vnode *vp; @@ -374,8 +374,8 @@ }; -%! lock1 pre vop_lock_pre -%! lock1 post vop_lock_post +%! lock1 debugpre vop_lock_debugpre +%! lock1 debugpost vop_lock_debugpost vop_lock1 { IN struct vnode *vp; @@ -385,7 +385,7 @@ }; -%! unlock pre vop_unlock_pre +%! unlock debugpre vop_unlock_debugpre vop_unlock { IN struct vnode *vp; @@ -405,7 +405,7 @@ %% strategy vp L L L -%! strategy pre vop_strategy_pre +%! strategy debugpre vop_strategy_debugpre vop_strategy { IN struct vnode *vp; Index: sys/sys/vnode.h =================================================================== --- sys/sys/vnode.h +++ sys/sys/vnode.h @@ -820,19 +820,12 @@ int vop_sigdefer(struct vop_vector *vop, struct vop_generic_args *a); #ifdef DEBUG_VFS_LOCKS -void vop_strategy_pre(void *a); -void vop_lock_pre(void *a); -void vop_lock_post(void *a, int rc); -void vop_unlock_pre(void *a); -void vop_need_inactive_pre(void *a); -void vop_need_inactive_post(void *a, int rc); -#else -#define vop_strategy_pre(x) do { } while (0) -#define vop_lock_pre(x) do { } while (0) -#define vop_lock_post(x, y) do { } while (0) -#define vop_unlock_pre(x) do { } while (0) -#define vop_need_inactive_pre(x) do { } while (0) -#define vop_need_inactive_post(x, y) do { } while (0) +void vop_strategy_debugpre(void *a); +void vop_lock_debugpre(void *a); +void vop_lock_debugpost(void *a, int rc); +void vop_unlock_debugpre(void *a); +void vop_need_inactive_debugpre(void *a); +void vop_need_inactive_debugpost(void *a, int rc); #endif void vop_rename_fail(struct vop_rename_args *ap); Index: sys/tools/vnode_if.awk =================================================================== --- sys/tools/vnode_if.awk +++ sys/tools/vnode_if.awk @@ -87,6 +87,24 @@ } } +function add_debugpre(name) +{ + if (lockdata[name, "debugpre"]) { + printc("#ifdef DEBUG_VFS_LOCKS"); + printc("\t"lockdata[name, "debugpre"]"(a);"); + printc("#endif"); + } +} + +function add_debugpost(name) +{ + if (lockdata[name, "debugpost"]) { + printc("#ifdef DEBUG_VFS_LOCKS"); + printc("\t"lockdata[name, "debugpost"]"(a, rc);"); + printc("#endif"); + } +} + function add_pre(name) { if (lockdata[name, "pre"]) { @@ -101,6 +119,16 @@ } } +function can_inline(name) +{ + + if (lockdata[name, "pre"]) + return 0; + if (lockdata[name, "post"]) + return 0; + return 1; +} + function find_arg_with_type (type) { for (jj = 0; jj < numargs; jj++) { @@ -213,7 +241,8 @@ if ($1 ~ /^%!/) { if (NF != 4 || - ($3 != "pre" && $3 != "post")) { + ($3 != "pre" && $3 != "post" && + $3 != "debugpre" && $3 != "debugpost")) { die("Invalid %s construction", "%!"); continue; } @@ -316,7 +345,19 @@ printh("\ta.a_gen.a_desc = &" name "_desc;"); for (i = 0; i < numargs; ++i) printh("\ta.a_" args[i] " = " args[i] ";"); + if (can_inline(name)) { + printh("\n#if !defined(DEBUG_VFS_LOCKS) && !defined(INVARIANTS) && !defined(KTR)"); + printh("\tif (!SDT_PROBES_ENABLED())"); + printh("\t\treturn (" args[0]"->v_op->"name"(&a));"); +# printh("\t\treturn (vop->"name"(a));") + printh("\telse"); + printh("\t\treturn (" uname "_APV("args[0]"->v_op, &a));"); + printh("#else"); + } printh("\treturn (" uname "_APV("args[0]"->v_op, &a));"); + if (can_inline(name)) + printh("#endif"); + printh("}"); printh(""); @@ -364,6 +405,7 @@ printc("\t (\"Wrong a_desc in " name "(%p, %p)\", a->a_" args[0]", a));"); printc("\tVNASSERT(vop != NULL, a->a_" args[0]", (\"No "name"(%p, %p)\", a->a_" args[0]", a));") printc("\tKTR_START" ctrstr); + add_debugpre(name); add_pre(name); for (i = 0; i < numargs; ++i) add_debug_code(name, args[i], "Entry", "\t"); @@ -382,6 +424,7 @@ add_debug_code(name, args[i], "Error", "\t\t"); printc("\t}"); add_post(name); + add_debugpost(name); printc("\tKTR_STOP" ctrstr); printc("\treturn (rc);"); printc("}\n");