diff options
Diffstat (limited to 'include/sys')
-rw-r--r-- | include/sys/sdt.h | 20 | ||||
-rw-r--r-- | include/sys/trace_dbgmsg.h | 77 | ||||
-rw-r--r-- | include/sys/zfs_context.h | 9 | ||||
-rw-r--r-- | include/sys/zfs_debug.h | 1 |
4 files changed, 12 insertions, 95 deletions
diff --git a/include/sys/sdt.h b/include/sys/sdt.h index 56efa1b39..9704072cb 100644 --- a/include/sys/sdt.h +++ b/include/sys/sdt.h @@ -34,13 +34,8 @@ #define ZFS_PROBE2(a, c, e) ((void) 0) #define ZFS_PROBE3(a, c, e, g) ((void) 0) #define ZFS_PROBE4(a, c, e, g, i) ((void) 0) -#define ZFS_SET_ERROR(err) ((void) 0) -#else - -#if defined(HAVE_DECLARE_EVENT_CLASS) - -#include <sys/trace.h> +#endif /* _KERNEL */ /* * The set-error SDT probe is extra static, in that we declare its fake @@ -55,16 +50,9 @@ * twice, so it should not have side effects (e.g. something like: * "return (SET_ERROR(log_error(EINVAL, info)));" would log the error twice). */ -#define SET_ERROR(err) \ - (trace_zfs_set__error(__FILE__, __func__, __LINE__, err), err) - -#else - +extern void __set_error(const char *file, const char *func, int line, int err); #undef SET_ERROR -#define SET_ERROR(err) (err) - -#endif /* HAVE_DECLARE_EVENT_CLASS */ - -#endif /* _KERNEL */ +#define SET_ERROR(err) \ + (__set_error(__FILE__, __func__, __LINE__, err), err) #endif /* _SYS_SDT_H */ diff --git a/include/sys/trace_dbgmsg.h b/include/sys/trace_dbgmsg.h index 08d96c59c..a4aab1e63 100644 --- a/include/sys/trace_dbgmsg.h +++ b/include/sys/trace_dbgmsg.h @@ -37,92 +37,29 @@ */ /* - * Generic support for four argument tracepoints of the form: + * Generic support for one argument tracepoints of the form: * - * DTRACE_PROBE4(..., - * const char *, ..., - * const char *, ..., - * int, ..., + * DTRACE_PROBE1(..., * const char *, ...); */ /* BEGIN CSTYLED */ DECLARE_EVENT_CLASS(zfs_dprintf_class, - TP_PROTO(const char *file, const char *function, int line, - const char *msg), - TP_ARGS(file, function, line, msg), + TP_PROTO(const char *msg), + TP_ARGS(msg), TP_STRUCT__entry( - __string(file, file) - __string(function, function) - __field(int, line) __string(msg, msg) ), TP_fast_assign( - __assign_str(file, strchr(file, '/') ? - strrchr(file, '/') + 1 : file) - __assign_str(function, function); - __entry->line = line; __assign_str(msg, msg); ), - TP_printk("%s:%d:%s(): %s", __get_str(file), __entry->line, - __get_str(function), __get_str(msg)) + TP_printk("%s", __get_str(msg)) ); /* END CSTYLED */ /* BEGIN CSTYLED */ #define DEFINE_DPRINTF_EVENT(name) \ DEFINE_EVENT(zfs_dprintf_class, name, \ - TP_PROTO(const char *file, const char *function, int line, \ - const char *msg), \ - TP_ARGS(file, function, line, msg)) + TP_PROTO(const char *msg), \ + TP_ARGS(msg)) /* END CSTYLED */ DEFINE_DPRINTF_EVENT(zfs_zfs__dprintf); - -/* - * Generic support for four argument tracepoints of the form: - * - * DTRACE_PROBE4(..., - * const char *, ..., - * const char *, ..., - * int, ..., - * uintptr_t, ...); - */ -/* BEGIN CSTYLED */ -DECLARE_EVENT_CLASS(zfs_set_error_class, - TP_PROTO(const char *file, const char *function, int line, - uintptr_t error), - TP_ARGS(file, function, line, error), - TP_STRUCT__entry( - __string(file, file) - __string(function, function) - __field(int, line) - __field(uintptr_t, error) - ), - TP_fast_assign( - __assign_str(file, strchr(file, '/') ? - strrchr(file, '/') + 1 : file) - __assign_str(function, function); - __entry->line = line; - __entry->error = error; - ), - TP_printk("%s:%d:%s(): error 0x%lx", __get_str(file), __entry->line, - __get_str(function), __entry->error) -); -/* END CSTYLED */ - -/* BEGIN CSTYLED */ -#ifdef TP_CONDITION -#define DEFINE_SET_ERROR_EVENT(name) \ -DEFINE_EVENT_CONDITION(zfs_set_error_class, name, \ - TP_PROTO(const char *file, const char *function, int line, \ - uintptr_t error), \ - TP_ARGS(file, function, line, error), \ - TP_CONDITION(error)) -#else -#define DEFINE_SET_ERROR_EVENT(name) \ -DEFINE_EVENT(zfs_set_error_class, name, \ - TP_PROTO(const char *file, const char *function, int line, \ - uintptr_t error), \ - TP_ARGS(file, function, line, error)) -#endif -/* END CSTYLED */ -DEFINE_SET_ERROR_EVENT(zfs_set__error); diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index 6163b2fbf..4fe35342d 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -207,15 +207,6 @@ extern int aok; (unsigned long)i) /* - * We use the comma operator so that this macro 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). - */ -#define SET_ERROR(err) (ZFS_SET_ERROR(err), err) - -/* * Threads. TS_STACK_MIN is dictated by the minimum allowed pthread stack * size. While TS_STACK_MAX is somewhat arbitrary, it was selected to be * large enough for the expected stack depth while small enough to avoid diff --git a/include/sys/zfs_debug.h b/include/sys/zfs_debug.h index b9b06a5ad..226aaa2b8 100644 --- a/include/sys/zfs_debug.h +++ b/include/sys/zfs_debug.h @@ -51,6 +51,7 @@ extern int zfs_free_leak_on_eio; #define ZFS_DEBUG_ZIO_FREE (1 << 6) #define ZFS_DEBUG_HISTOGRAM_VERIFY (1 << 7) #define ZFS_DEBUG_METASLAB_VERIFY (1 << 8) +#define ZFS_DEBUG_SET_ERROR (1 << 9) extern void __dprintf(const char *file, const char *func, int line, const char *fmt, ...); |