ZFS SET_ERROR dtrace probe possible under FreeBSD?

Steven Hartland smh at freebsd.org
Tue Sep 16 02:03:59 UTC 2014


The following commit added SET_ERROR dtrace probes to illumos
https://github.com/illumos/illumos-gate/commit/be6fd75

Now we have all the SET_ERROR calls but the FreeBSD's ZFS implementation
but our SET_ERROR in sys/cddl/compat/opensolaris/sys/sdt.h is simply:
#define SET_ERROR(err)  (err)

I tried using the illumos version but that resulted being unable
to mount ZFS root, so clearly not right.

/*
 * the set-error SDT probe is extra static, in that we declare its fake
 * function literally, rather than with the DTRACE_PROBE1() macro. This is
 * necessary so that SET_ERROR() can evaluate to a value, which wouldn't
 * be possible if it required multiple statements (to declare the function
 * and then call it).
 *
 * SET_ERROR() uses the comma operator so that it can be used without much
 * additional code. For example, "return (EINVAL);" becomes
 * "return (SET_ERROR(EINVAL));". Note that the argument will be evaluated
 * twice, so it should not have side effects (e.g. something like:
 * "return (SET_ERROR(log_error(EINVAL, info)));" would log the error twice).
 */
extern void __dtrace_probe_set__error(uintptr_t);
#define SET_ERROR(err) (__dtrace_probe_set__error(err), err)


For those that know the the ins and outs of our dtrace is it
possible for us to add support for this trace point?

    Regards
    Steve


More information about the freebsd-hackers mailing list