aboutsummaryrefslogtreecommitdiff
path: root/sys/tools
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2020-07-30 15:50:51 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2020-07-30 15:50:51 +0000
commit848f8effdd69456368366a6bbdba322d0341c98e (patch)
tree1c40ecec61e3b40617474757193022deadcbb729 /sys/tools
parent2e4f8220e8a14671a715c34ab3bdbb9dcee3ab06 (diff)
downloadsrc-848f8effdd69456368366a6bbdba322d0341c98e.tar.gz
src-848f8effdd69456368366a6bbdba322d0341c98e.zip
vfs: inline vops if there are no pre/post associated calls
This removes a level of indirection from frequently used methods, most notably VOP_LOCK1 and VOP_UNLOCK1. Tested by: pho
Notes
Notes: svn path=/head/; revision=363708
Diffstat (limited to 'sys/tools')
-rw-r--r--sys/tools/vnode_if.awk43
1 files changed, 42 insertions, 1 deletions
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");