aboutsummaryrefslogtreecommitdiff
path: root/sys/tools
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2020-01-26 00:41:38 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2020-01-26 00:41:38 +0000
commit8a6f5fd50cba25ea51cb0cb39d632895a8827b4a (patch)
treefa5d114097f93ba0c76dbd51e2fbc27df01087be /sys/tools
parent6d69e665dd95fbb14e061dcdab97fb55634217e3 (diff)
downloadsrc-8a6f5fd50cba25ea51cb0cb39d632895a8827b4a.tar.gz
src-8a6f5fd50cba25ea51cb0cb39d632895a8827b4a.zip
vfs: stop null checking routines in vop wrappers
Calls to vop_bypass pass the same argument, but type casted to something else. Thus by replacing NULL routines with vop_bypass we avoid a runtime check. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D23357
Notes
Notes: svn path=/head/; revision=357131
Diffstat (limited to 'sys/tools')
-rw-r--r--sys/tools/vnode_if.awk12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/tools/vnode_if.awk b/sys/tools/vnode_if.awk
index df3251090b99..cd138bef75da 100644
--- a/sys/tools/vnode_if.awk
+++ b/sys/tools/vnode_if.awk
@@ -367,14 +367,11 @@ while ((getline < srcfile) > 0) {
add_pre(name);
for (i = 0; i < numargs; ++i)
add_debug_code(name, args[i], "Entry", "\t");
- printc("\tif (__predict_true(!SDT_PROBES_ENABLED() && vop->"name" != NULL)) {");
+ printc("\tif (!SDT_PROBES_ENABLED()) {");
printc("\t\trc = vop->"name"(a);")
printc("\t} else {")
printc("\t\tSDT_PROBE2(vfs, vop, " name ", entry, a->a_" args[0] ", a);");
- printc("\t\tif (vop->"name" != NULL)")
- printc("\t\t\trc = vop->"name"(a);")
- printc("\t\telse")
- printc("\t\t\trc = vop->vop_bypass(&a->a_gen);")
+ printc("\t\trc = vop->"name"(a);")
printc("\t\tSDT_PROBE3(vfs, vop, " name ", return, a->a_" args[0] ", a, rc);");
printc("\t}")
printc("\tif (rc == 0) {");
@@ -450,6 +447,11 @@ if (cfile) {
printc("\tif (vop != NULL)");
printc("\t\torig_vop->vop_bypass = vop->vop_bypass;");
printc("");
+ for (name in funcarr) {
+ printc("\tif (orig_vop->"name" == NULL)");
+ printc("\t\torig_vop->"name" = (void *)orig_vop->vop_bypass;");
+ }
+ printc("");
printc("\torig_vop->registered = true;");
printc("}")
}