diff options
author | Ned Bass <[email protected]> | 2014-12-12 18:07:39 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-01-06 16:53:24 -0800 |
commit | 49ee64e5e6ec7240bc63d96064f2feeb8f84ed9d (patch) | |
tree | afba44d079cb1f7006bb4232781d9795bb986ec3 /include/sys/trace_dmu.h | |
parent | 74328ee18f94d27f9c802d29fdd311018dab2adf (diff) |
Remove duplicate typedefs from trace.h
Older versions of GCC (e.g. GCC 4.4.7 on RHEL6) do not allow duplicate
typedef declarations with the same type. The trace.h header contains
some typedefs to avoid 'unknown type' errors for C files that haven't
declared the type in question. But this causes build failures for C
files that have already declared the type. Newer versions of GCC (e.g.
v4.6) allow duplicate typedefs with the same type unless pedantic error
checking is in force. To support the older versions we need to remove
the duplicate typedefs.
Removal of the typedefs means we can't built tracepoints code using
those types unless the required headers have been included. To
facilitate this, all tracepoint event declarations have been moved out
of trace.h into separate headers. Each new header is explicitly included
from the C file that uses the events defined therein. The trace.h header
is still indirectly included form zfs_context.h and provides the
implementation of the dprintf(), dbgmsg(), and SET_ERROR() interfaces.
This makes those interfaces readily available throughout the code base.
The macros that redefine DTRACE_PROBE* to use Linux tracepoints are also
still provided by trace.h, so it is a prerequisite for the other
trace_*.h headers.
These new Linux implementation-specific headers do introduce a small
divergence from upstream ZFS in several core C files, but this should
not present a significant maintenance burden.
Signed-off-by: Ned Bass <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue #2953
Diffstat (limited to 'include/sys/trace_dmu.h')
-rw-r--r-- | include/sys/trace_dmu.h | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/include/sys/trace_dmu.h b/include/sys/trace_dmu.h new file mode 100644 index 000000000..154e32096 --- /dev/null +++ b/include/sys/trace_dmu.h @@ -0,0 +1,117 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +#if defined(_KERNEL) && defined(HAVE_DECLARE_EVENT_CLASS) + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM zfs + +#if !defined(_TRACE_DMU_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_DMU_H + +#include <linux/tracepoint.h> +#include <sys/types.h> + +/* + * Generic support for three argument tracepoints of the form: + * + * DTRACE_PROBE3(..., + * dmu_tx_t *, ..., + * uint64_t, ..., + * uint64_t, ...); + */ + +DECLARE_EVENT_CLASS(zfs_delay_mintime_class, + TP_PROTO(dmu_tx_t *tx, uint64_t dirty, uint64_t min_tx_time), + TP_ARGS(tx, dirty, min_tx_time), + TP_STRUCT__entry( + __field(uint64_t, tx_txg) + __field(uint64_t, tx_lastsnap_txg) + __field(uint64_t, tx_lasttried_txg) + __field(boolean_t, tx_anyobj) + __field(boolean_t, tx_waited) + __field(hrtime_t, tx_start) + __field(boolean_t, tx_wait_dirty) + __field(int, tx_err) +#ifdef DEBUG_DMU_TX + __field(uint64_t, tx_space_towrite) + __field(uint64_t, tx_space_tofree) + __field(uint64_t, tx_space_tooverwrite) + __field(uint64_t, tx_space_tounref) + __field(int64_t, tx_space_written) + __field(int64_t, tx_space_freed) +#endif + __field(uint64_t, min_tx_time) + __field(uint64_t, dirty) + ), + TP_fast_assign( + __entry->tx_txg = tx->tx_txg; + __entry->tx_lastsnap_txg = tx->tx_lastsnap_txg; + __entry->tx_lasttried_txg = tx->tx_lasttried_txg; + __entry->tx_anyobj = tx->tx_anyobj; + __entry->tx_waited = tx->tx_waited; + __entry->tx_start = tx->tx_start; + __entry->tx_wait_dirty = tx->tx_wait_dirty; + __entry->tx_err = tx->tx_err; +#ifdef DEBUG_DMU_TX + __entry->tx_space_towrite = tx->tx_space_towrite; + __entry->tx_space_tofree = tx->tx_space_tofree; + __entry->tx_space_tooverwrite = tx->tx_space_tooverwrite; + __entry->tx_space_tounref = tx->tx_space_tounref; + __entry->tx_space_written = tx->tx_space_written.rc_count; + __entry->tx_space_freed = tx->tx_space_freed.rc_count; +#endif + __entry->dirty = dirty; + __entry->min_tx_time = min_tx_time; + ), + TP_printk("tx { txg %llu lastsnap_txg %llu tx_lasttried_txg %llu " + "anyobj %d waited %d start %llu wait_dirty %d err %i " +#ifdef DEBUG_DMU_TX + "space_towrite %llu space_tofree %llu space_tooverwrite %llu " + "space_tounref %llu space_written %lli space_freed %lli " +#endif + "} dirty %llu min_tx_time %llu", + __entry->tx_txg, __entry->tx_lastsnap_txg, + __entry->tx_lasttried_txg, __entry->tx_anyobj, __entry->tx_waited, + __entry->tx_start, __entry->tx_wait_dirty, __entry->tx_err, +#ifdef DEBUG_DMU_TX + __entry->tx_space_towrite, __entry->tx_space_tofree, + __entry->tx_space_tooverwrite, __entry->tx_space_tounref, + __entry->tx_space_written, __entry->tx_space_freed, +#endif + __entry->dirty, __entry->min_tx_time) +); + +#define DEFINE_DELAY_MINTIME_EVENT(name) \ +DEFINE_EVENT(zfs_delay_mintime_class, name, \ + TP_PROTO(dmu_tx_t *tx, uint64_t dirty, uint64_t min_tx_time), \ + TP_ARGS(tx, dirty, min_tx_time)) +DEFINE_DELAY_MINTIME_EVENT(zfs_delay__mintime); + +#endif /* _TRACE_DMU_H */ + +#undef TRACE_INCLUDE_PATH +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_PATH sys +#define TRACE_INCLUDE_FILE trace_dmu +#include <trace/define_trace.h> + +#endif /* _KERNEL && HAVE_DECLARE_EVENT_CLASS */ |