Add SDT DTrace probes for VFS vnode operations in the vfs:vop

provider namespace.  These are inserted dynamically into the
VOP_..._AP() functions created from vnode_if.src.  Each VOP has
entry and return probes, as arg0 the primary vnode, arg1 the
vnode operation argument structure pointer, providing access to
IN and OUT arguments, and for return probes, arg2 the return
value.

MFC after:	1 month
Sponsored by:	Google, Inc.
This commit is contained in:
Robert Watson 2009-03-29 03:30:15 +00:00
parent f19dafc798
commit ff8a07fda2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=190518

View file

@ -165,12 +165,18 @@ if (hfile) {
if (cfile) {
printc(common_head \
"#include \"opt_kdtrace.h\"\n" \
"\n" \
"#include <sys/param.h>\n" \
"#include <sys/event.h>\n" \
"#include <sys/kernel.h>\n" \
"#include <sys/mount.h>\n" \
"#include <sys/sdt.h>\n" \
"#include <sys/systm.h>\n" \
"#include <sys/vnode.h>\n" \
"\n" \
"SDT_PROVIDER_DECLARE(vfs);\n" \
"\n" \
"struct vnodeop_desc vop_default_desc = {\n" \
" \"default\",\n" \
" 0,\n" \
@ -348,6 +354,10 @@ while ((getline < srcfile) > 0) {
printc("\tVDESC_NO_OFFSET");
printc("};");
printc("\n");
printc("SDT_PROBE_DEFINE2(vfs, vop, " name ", entry, \"struct vnode *\", \"struct " name "_args *\");\n");
printc("SDT_PROBE_DEFINE3(vfs, vop, " name ", return, \"struct vnode *\", \"struct " name "_args *\", \"int\");\n");
# Print out function.
printc("\nint\n" uname "_AP(struct " name "_args *a)");
printc("{");
@ -364,6 +374,7 @@ while ((getline < srcfile) > 0) {
printc("\t vop->"name" == NULL && vop->vop_bypass == NULL)")
printc("\t\tvop = vop->vop_default;")
printc("\tVNASSERT(vop != NULL, a->a_" args[0]", (\"No "name"(%p, %p)\", a->a_" args[0]", a));")
printc("\tSDT_PROBE(vfs, vop, " name ", entry, a->a_" args[0] ", a, 0, 0, 0);\n");
for (i = 0; i < numargs; ++i)
add_debug_code(name, args[i], "Entry", "\t");
add_pre(name);
@ -372,6 +383,7 @@ while ((getline < srcfile) > 0) {
printc("\telse")
printc("\t\trc = vop->vop_bypass(&a->a_gen);")
printc(ctrstr);
printc("\tSDT_PROBE(vfs, vop, " name ", return, a->a_" args[0] ", a, rc, 0, 0);\n");
printc("\tif (rc == 0) {");
for (i = 0; i < numargs; ++i)
add_debug_code(name, args[i], "OK", "\t\t");