summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/vfs_subr.c16
-rw-r--r--sys/kern/vnode_if.src16
-rw-r--r--sys/sys/vnode.h32
-rw-r--r--sys/tools/vnode_if.awk43
4 files changed, 74 insertions, 33 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 2eec46774327..d7a69b49d7f0 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -5597,21 +5597,21 @@ vop_rename_pre(void *ap)
#ifdef DEBUG_VFS_LOCKS
void
-vop_fplookup_vexec_pre(void *ap __unused)
+vop_fplookup_vexec_debugpre(void *ap __unused)
{
VFS_SMR_ASSERT_ENTERED();
}
void
-vop_fplookup_vexec_post(void *ap __unused, int rc __unused)
+vop_fplookup_vexec_debugpost(void *ap __unused, int rc __unused)
{
VFS_SMR_ASSERT_ENTERED();
}
void
-vop_strategy_pre(void *ap)
+vop_strategy_debugpre(void *ap)
{
struct vop_strategy_args *a;
struct buf *bp;
@@ -5635,7 +5635,7 @@ vop_strategy_pre(void *ap)
}
void
-vop_lock_pre(void *ap)
+vop_lock_debugpre(void *ap)
{
struct vop_lock1_args *a = ap;
@@ -5646,7 +5646,7 @@ vop_lock_pre(void *ap)
}
void
-vop_lock_post(void *ap, int rc)
+vop_lock_debugpost(void *ap, int rc)
{
struct vop_lock1_args *a = ap;
@@ -5656,7 +5656,7 @@ vop_lock_post(void *ap, int rc)
}
void
-vop_unlock_pre(void *ap)
+vop_unlock_debugpre(void *ap)
{
struct vop_unlock_args *a = ap;
@@ -5664,7 +5664,7 @@ vop_unlock_pre(void *ap)
}
void
-vop_need_inactive_pre(void *ap)
+vop_need_inactive_debugpre(void *ap)
{
struct vop_need_inactive_args *a = ap;
@@ -5672,7 +5672,7 @@ vop_need_inactive_pre(void *ap)
}
void
-vop_need_inactive_post(void *ap, int rc)
+vop_need_inactive_debugpost(void *ap, int rc)
{
struct vop_need_inactive_args *a = ap;
diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src
index 5c0649fdadaf..e5a7b389fb30 100644
--- a/sys/kern/vnode_if.src
+++ b/sys/kern/vnode_if.src
@@ -147,8 +147,8 @@ vop_close {
%% fplookup_vexec vp - - -
-%! fplookup_vexec pre vop_fplookup_vexec_pre
-%! fplookup_vexec post vop_fplookup_vexec_post
+%! fplookup_vexec debugpre vop_fplookup_vexec_debugpre
+%! fplookup_vexec debugpost vop_fplookup_vexec_debugpost
vop_fplookup_vexec {
IN struct vnode *vp;
@@ -379,8 +379,8 @@ vop_inactive {
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;
@@ -395,8 +395,8 @@ vop_reclaim {
};
-%! 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;
@@ -406,7 +406,7 @@ vop_lock1 {
};
-%! unlock pre vop_unlock_pre
+%! unlock debugpre vop_unlock_debugpre
vop_unlock {
IN struct vnode *vp;
@@ -426,7 +426,7 @@ vop_bmap {
%% strategy vp L L L
-%! strategy pre vop_strategy_pre
+%! strategy debugpre vop_strategy_debugpre
vop_strategy {
IN struct vnode *vp;
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index 8273842a91f5..3a83ea5af6e1 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -869,23 +869,23 @@ void vop_symlink_post(void *a, int rc);
int vop_sigdefer(struct vop_vector *vop, struct vop_generic_args *a);
#ifdef DEBUG_VFS_LOCKS
-void vop_fplookup_vexec_pre(void *a);
-void vop_fplookup_vexec_post(void *a, int rc);
-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);
+void vop_fplookup_vexec_debugpre(void *a);
+void vop_fplookup_vexec_debugpost(void *a, int rc);
+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);
#else
-#define vop_fplookup_vexec_pre(x) do { } while (0)
-#define vop_fplookup_vexec_post(x, y) do { } while (0)
-#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)
+#define vop_fplookup_vexec_debugpre(x) do { } while (0)
+#define vop_fplookup_vexec_debugpost(x, y) do { } while (0)
+#define vop_strategy_debugpre(x) do { } while (0)
+#define vop_lock_debugpre(x) do { } while (0)
+#define vop_lock_debugpost(x, y) do { } while (0)
+#define vop_unlock_debugpre(x) do { } while (0)
+#define vop_need_inactive_debugpre(x) do { } while (0)
+#define vop_need_inactive_debugpost(x, y) do { } while (0)
#endif
void vop_rename_fail(struct vop_rename_args *ap);
diff --git a/sys/tools/vnode_if.awk b/sys/tools/vnode_if.awk
index cd138bef75da..486f0e6b2ce1 100644
--- a/sys/tools/vnode_if.awk
+++ b/sys/tools/vnode_if.awk
@@ -87,6 +87,24 @@ function add_debug_code(name, arg, pos, ind)
}
}
+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,15 @@ function add_post(name)
}
}
+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 +240,8 @@ while ((getline < srcfile) > 0) {
if ($1 ~ /^%!/) {
if (NF != 4 ||
- ($3 != "pre" && $3 != "post")) {
+ ($3 != "pre" && $3 != "post" &&
+ $3 != "debugpre" && $3 != "debugpost")) {
die("Invalid %s construction", "%!");
continue;
}
@@ -316,7 +344,18 @@ while ((getline < srcfile) > 0) {
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("\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 +403,7 @@ while ((getline < srcfile) > 0) {
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 +422,7 @@ while ((getline < srcfile) > 0) {
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");