From b22e2797970b44e6b9d1e4624a5ede935c851010 Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Wed, 25 Nov 2015 10:39:57 -0500 Subject: [PATCH] Only trigger SET_ERROR tracepoint event on error Currently, the SET_ERROR tracepoint triggers regardless of whether there is an error or not. On Illumos, SET_ERROR only triggers on an actual error, which is avoids irrelevant noise. Linux 2.6.38 added support for conditional tracepoints, so we modify SET_ERROR to use them when they are avaliable for functionality equivalent to the Illumos functionality. Signed-off-by: Richard Yao Signed-off-by: Brian Behlendorf Closes #4043 --- include/sys/trace_dbgmsg.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/sys/trace_dbgmsg.h b/include/sys/trace_dbgmsg.h index e493a45802..314ddeb19a 100644 --- a/include/sys/trace_dbgmsg.h +++ b/include/sys/trace_dbgmsg.h @@ -103,9 +103,18 @@ DECLARE_EVENT_CLASS(zfs_set_error_class, __entry->function, __entry->error) ); +#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 DEFINE_SET_ERROR_EVENT(zfs_set__error);