diff options
author | Matthew Macy <[email protected]> | 2019-09-11 14:25:53 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-09-11 14:25:53 -0700 |
commit | d66620681d85105256203b4f4407f0092e5a7fe7 (patch) | |
tree | 688d620ec8af54e0db19a1c7bc87fab80a337c69 /include/os/linux | |
parent | 5815f7ac30e108fcbf4c6487328c28d818e9e014 (diff) |
OpenZFS restructuring - move linux tracing code to platform directories
Move Linux specific tracing headers and source to platform directories
and update the build system.
Reviewed-by: Allan Jude <[email protected]>
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed by: Brad Lewis <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Matt Macy <[email protected]>
Closes #9290
Diffstat (limited to 'include/os/linux')
-rw-r--r-- | include/os/linux/spl/sys/Makefile.am | 1 | ||||
-rw-r--r-- | include/os/linux/spl/sys/trace.h | 187 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/Makefile.am | 15 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/trace_acl.h | 164 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/trace_arc.h | 383 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/trace_common.h | 112 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/trace_dbgmsg.h | 75 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/trace_dbuf.h | 152 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/trace_defs.h | 52 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/trace_dmu.h | 136 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/trace_dnode.h | 129 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/trace_multilist.h | 89 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/trace_rrwlock.h | 31 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/trace_txg.h | 89 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/trace_vdev.h | 140 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/trace_zil.h | 229 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/trace_zio.h | 97 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/trace_zrlock.h | 94 |
18 files changed, 2175 insertions, 0 deletions
diff --git a/include/os/linux/spl/sys/Makefile.am b/include/os/linux/spl/sys/Makefile.am index de2f74d8c..934289321 100644 --- a/include/os/linux/spl/sys/Makefile.am +++ b/include/os/linux/spl/sys/Makefile.am @@ -43,6 +43,7 @@ KERNEL_H = \ $(top_srcdir)/include/os/linux/spl/sys/thread.h \ $(top_srcdir)/include/os/linux/spl/sys/time.h \ $(top_srcdir)/include/os/linux/spl/sys/timer.h \ + $(top_srcdir)/include/os/linux/spl/sys/trace.h \ $(top_srcdir)/include/os/linux/spl/sys/tsd.h \ $(top_srcdir)/include/os/linux/spl/sys/types32.h \ $(top_srcdir)/include/os/linux/spl/sys/types.h \ diff --git a/include/os/linux/spl/sys/trace.h b/include/os/linux/spl/sys/trace.h new file mode 100644 index 000000000..e2cd634b4 --- /dev/null +++ b/include/os/linux/spl/sys/trace.h @@ -0,0 +1,187 @@ +/* + * 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) + +/* + * Calls to DTRACE_PROBE* are mapped to standard Linux kernel trace points + * when they are available(when HAVE_DECLARE_EVENT_CLASS is defined). The + * tracepoint event class definitions are found in the general tracing + * header file: include/sys/trace_*.h. See include/sys/trace_vdev.h for + * a good example. + * + * If tracepoints are not available, stub functions are generated which can + * be traced using kprobes. In this case, the DEFINE_DTRACE_PROBE* macros + * are used to provide the stub functions and also the prototypes for + * those functions. The mechanism to do this relies on DEFINE_DTRACE_PROBE + * macros defined in the general tracing headers(see trace_vdev.h) and + * CREATE_TRACE_POINTS being defined only in module/zfs/trace.c. When ZFS + * source files include the general tracing headers, e.g. + * module/zfs/vdev_removal.c including trace_vdev.h, DTRACE_PROBE calls + * are mapped to stub functions calls and prototypes for those calls are + * declared via DEFINE_DTRACE_PROBE*. Only module/zfs/trace.c defines + * CREATE_TRACE_POINTS. That is follwed by includes of all the general + * tracing headers thereby defining all stub functions in one place via + * the DEFINE_DTRACE_PROBE macros. + * + * When adding new DTRACE_PROBEs to zfs source, both a tracepoint event + * class definition and a DEFINE_DTRACE_PROBE definition are needed to + * avoid undefined function errors. + */ + +#if defined(HAVE_DECLARE_EVENT_CLASS) + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM zfs + +#if !defined(_TRACE_ZFS_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_ZFS_H + +#include <linux/tracepoint.h> +#include <sys/types.h> + +/* + * The sys/trace_dbgmsg.h header defines tracepoint events for + * dprintf(), dbgmsg(), and SET_ERROR(). + */ +#define _SYS_TRACE_DBGMSG_INDIRECT +#include <sys/trace_dbgmsg.h> +#undef _SYS_TRACE_DBGMSG_INDIRECT + +/* + * DTRACE_PROBE with 0 arguments is not currently available with + * tracepoint events + */ +#define DTRACE_PROBE(name) \ + ((void)0) + +#define DTRACE_PROBE1(name, t1, arg1) \ + trace_zfs_##name((arg1)) + +#define DTRACE_PROBE2(name, t1, arg1, t2, arg2) \ + trace_zfs_##name((arg1), (arg2)) + +#define DTRACE_PROBE3(name, t1, arg1, t2, arg2, t3, arg3) \ + trace_zfs_##name((arg1), (arg2), (arg3)) + +#define DTRACE_PROBE4(name, t1, arg1, t2, arg2, t3, arg3, t4, arg4) \ + trace_zfs_##name((arg1), (arg2), (arg3), (arg4)) + +#endif /* _TRACE_ZFS_H */ + +#undef TRACE_INCLUDE_PATH +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_PATH sys +#define TRACE_INCLUDE_FILE trace +#include <trace/define_trace.h> + +#else /* HAVE_DECLARE_EVENT_CLASS */ + +#define DTRACE_PROBE(name) \ + trace_zfs_##name() + +#define DTRACE_PROBE1(name, t1, arg1) \ + trace_zfs_##name((uintptr_t)(arg1)) + +#define DTRACE_PROBE2(name, t1, arg1, t2, arg2) \ + trace_zfs_##name((uintptr_t)(arg1), (uintptr_t)(arg2)) + +#define DTRACE_PROBE3(name, t1, arg1, t2, arg2, t3, arg3) \ + trace_zfs_##name((uintptr_t)(arg1), (uintptr_t)(arg2), \ + (uintptr_t)(arg3)) + +#define DTRACE_PROBE4(name, t1, arg1, t2, arg2, t3, arg3, t4, arg4) \ + trace_zfs_##name((uintptr_t)(arg1), (uintptr_t)(arg2), \ + (uintptr_t)(arg3), (uintptr_t)(arg4)) + +#if defined(CREATE_TRACE_POINTS) + +#define FUNC_DTRACE_PROBE(name) \ +noinline void trace_zfs_##name(void) { } \ +EXPORT_SYMBOL(trace_zfs_##name) + +#define FUNC_DTRACE_PROBE1(name) \ +noinline void trace_zfs_##name(uintptr_t arg1) { } \ +EXPORT_SYMBOL(trace_zfs_##name) + +#define FUNC_DTRACE_PROBE2(name) \ +noinline void trace_zfs_##name(uintptr_t arg1, \ + uintptr_t arg2) { } \ +EXPORT_SYMBOL(trace_zfs_##name) + +#define FUNC_DTRACE_PROBE3(name) \ +noinline void trace_zfs_##name(uintptr_t arg1, \ + uintptr_t arg2, uintptr_t arg3) { } \ +EXPORT_SYMBOL(trace_zfs_##name) + +#define FUNC_DTRACE_PROBE4(name) \ +noinline void trace_zfs_##name(uintptr_t arg1, \ + uintptr_t arg2, uintptr_t arg3, uintptr_t arg4) { } \ +EXPORT_SYMBOL(trace_zfs_##name) + +#undef DEFINE_DTRACE_PROBE +#define DEFINE_DTRACE_PROBE(name) FUNC_DTRACE_PROBE(name) + +#undef DEFINE_DTRACE_PROBE1 +#define DEFINE_DTRACE_PROBE1(name) FUNC_DTRACE_PROBE1(name) + +#undef DEFINE_DTRACE_PROBE2 +#define DEFINE_DTRACE_PROBE2(name) FUNC_DTRACE_PROBE2(name) + +#undef DEFINE_DTRACE_PROBE3 +#define DEFINE_DTRACE_PROBE3(name) FUNC_DTRACE_PROBE3(name) + +#undef DEFINE_DTRACE_PROBE4 +#define DEFINE_DTRACE_PROBE4(name) FUNC_DTRACE_PROBE4(name) + +#else /* CREATE_TRACE_POINTS */ + +#define PROTO_DTRACE_PROBE(name) \ + noinline void trace_zfs_##name(void) +#define PROTO_DTRACE_PROBE1(name) \ + noinline void trace_zfs_##name(uintptr_t) +#define PROTO_DTRACE_PROBE2(name) \ + noinline void trace_zfs_##name(uintptr_t, uintptr_t) +#define PROTO_DTRACE_PROBE3(name) \ + noinline void trace_zfs_##name(uintptr_t, uintptr_t, \ + uintptr_t) +#define PROTO_DTRACE_PROBE4(name) \ + noinline void trace_zfs_##name(uintptr_t, uintptr_t, \ + uintptr_t, uintptr_t) + +#define DEFINE_DTRACE_PROBE(name) PROTO_DTRACE_PROBE(name) +#define DEFINE_DTRACE_PROBE1(name) PROTO_DTRACE_PROBE1(name) +#define DEFINE_DTRACE_PROBE2(name) PROTO_DTRACE_PROBE2(name) +#define DEFINE_DTRACE_PROBE3(name) PROTO_DTRACE_PROBE3(name) +#define DEFINE_DTRACE_PROBE4(name) PROTO_DTRACE_PROBE4(name) + +#endif /* CREATE_TRACE_POINTS */ + +/* + * The sys/trace_dbgmsg.h header defines tracepoint events for + * dprintf(), dbgmsg(), and SET_ERROR(). + */ +#define _SYS_TRACE_DBGMSG_INDIRECT +#include <sys/trace_dbgmsg.h> +#undef _SYS_TRACE_DBGMSG_INDIRECT + +#endif /* HAVE_DECLARE_EVENT_CLASS */ +#endif /* _KERNEL */ diff --git a/include/os/linux/zfs/sys/Makefile.am b/include/os/linux/zfs/sys/Makefile.am index 5aa87da37..c4e2df0d7 100644 --- a/include/os/linux/zfs/sys/Makefile.am +++ b/include/os/linux/zfs/sys/Makefile.am @@ -1,5 +1,20 @@ KERNEL_H = \ $(top_srcdir)/include/os/linux/zfs/sys/policy.h \ + $(top_srcdir)/include/os/linux/zfs/sys/trace_acl.h \ + $(top_srcdir)/include/os/linux/zfs/sys/trace_arc.h \ + $(top_srcdir)/include/os/linux/zfs/sys/trace_common.h \ + $(top_srcdir)/include/os/linux/zfs/sys/trace_defs.h \ + $(top_srcdir)/include/os/linux/zfs/sys/trace_dbgmsg.h \ + $(top_srcdir)/include/os/linux/zfs/sys/trace_dbuf.h \ + $(top_srcdir)/include/os/linux/zfs/sys/trace_dmu.h \ + $(top_srcdir)/include/os/linux/zfs/sys/trace_dnode.h \ + $(top_srcdir)/include/os/linux/zfs/sys/trace_multilist.h \ + $(top_srcdir)/include/os/linux/zfs/sys/trace_rrwlock.h \ + $(top_srcdir)/include/os/linux/zfs/sys/trace_txg.h \ + $(top_srcdir)/include/os/linux/zfs/sys/trace_vdev.h \ + $(top_srcdir)/include/os/linux/zfs/sys/trace_zil.h \ + $(top_srcdir)/include/os/linux/zfs/sys/trace_zio.h \ + $(top_srcdir)/include/os/linux/zfs/sys/trace_zrlock.h \ $(top_srcdir)/include/os/linux/zfs/sys/zfs_ctldir.h \ $(top_srcdir)/include/os/linux/zfs/sys/zfs_dir.h \ $(top_srcdir)/include/os/linux/zfs/sys/zfs_vfsops.h \ diff --git a/include/os/linux/zfs/sys/trace_acl.h b/include/os/linux/zfs/sys/trace_acl.h new file mode 100644 index 000000000..083560952 --- /dev/null +++ b/include/os/linux/zfs/sys/trace_acl.h @@ -0,0 +1,164 @@ +/* + * 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) +#if defined(HAVE_DECLARE_EVENT_CLASS) + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM zfs + +#undef TRACE_SYSTEM_VAR +#define TRACE_SYSTEM_VAR zfs_acl + +#if !defined(_TRACE_ACL_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_ACL_H + +#include <linux/tracepoint.h> +#include <linux/vfs_compat.h> +#include <sys/types.h> + +/* + * Generic support for three argument tracepoints of the form: + * + * DTRACE_PROBE3(..., + * znode_t *, ..., + * zfs_ace_hdr_t *, ..., + * uint32_t, ...); + */ +/* BEGIN CSTYLED */ +DECLARE_EVENT_CLASS(zfs_ace_class, + TP_PROTO(znode_t *zn, zfs_ace_hdr_t *ace, uint32_t mask_matched), + TP_ARGS(zn, ace, mask_matched), + TP_STRUCT__entry( + __field(uint64_t, z_id) + __field(uint8_t, z_unlinked) + __field(uint8_t, z_atime_dirty) + __field(uint8_t, z_zn_prefetch) + __field(uint8_t, z_moved) + __field(uint_t, z_blksz) + __field(uint_t, z_seq) + __field(uint64_t, z_mapcnt) + __field(uint64_t, z_size) + __field(uint64_t, z_pflags) + __field(uint32_t, z_sync_cnt) + __field(mode_t, z_mode) + __field(boolean_t, z_is_sa) + __field(boolean_t, z_is_mapped) + __field(boolean_t, z_is_ctldir) + __field(boolean_t, z_is_stale) + + __field(uint32_t, i_uid) + __field(uint32_t, i_gid) + __field(unsigned long, i_ino) + __field(unsigned int, i_nlink) + __field(loff_t, i_size) + __field(unsigned int, i_blkbits) + __field(unsigned short, i_bytes) + __field(umode_t, i_mode) + __field(__u32, i_generation) + + __field(uint16_t, z_type) + __field(uint16_t, z_flags) + __field(uint32_t, z_access_mask) + + __field(uint32_t, mask_matched) + ), + TP_fast_assign( + __entry->z_id = zn->z_id; + __entry->z_unlinked = zn->z_unlinked; + __entry->z_atime_dirty = zn->z_atime_dirty; + __entry->z_zn_prefetch = zn->z_zn_prefetch; + __entry->z_moved = zn->z_moved; + __entry->z_blksz = zn->z_blksz; + __entry->z_seq = zn->z_seq; + __entry->z_mapcnt = zn->z_mapcnt; + __entry->z_size = zn->z_size; + __entry->z_pflags = zn->z_pflags; + __entry->z_sync_cnt = zn->z_sync_cnt; + __entry->z_mode = zn->z_mode; + __entry->z_is_sa = zn->z_is_sa; + __entry->z_is_mapped = zn->z_is_mapped; + __entry->z_is_ctldir = zn->z_is_ctldir; + __entry->z_is_stale = zn->z_is_stale; + + __entry->i_uid = KUID_TO_SUID(ZTOI(zn)->i_uid); + __entry->i_gid = KGID_TO_SGID(ZTOI(zn)->i_gid); + __entry->i_ino = zn->z_inode.i_ino; + __entry->i_nlink = zn->z_inode.i_nlink; + __entry->i_size = zn->z_inode.i_size; + __entry->i_blkbits = zn->z_inode.i_blkbits; + __entry->i_bytes = zn->z_inode.i_bytes; + __entry->i_mode = zn->z_inode.i_mode; + __entry->i_generation = zn->z_inode.i_generation; + + __entry->z_type = ace->z_type; + __entry->z_flags = ace->z_flags; + __entry->z_access_mask = ace->z_access_mask; + + __entry->mask_matched = mask_matched; + ), + TP_printk("zn { id %llu unlinked %u atime_dirty %u " + "zn_prefetch %u moved %u blksz %u seq %u " + "mapcnt %llu size %llu pflags %llu " + "sync_cnt %u mode 0x%x is_sa %d " + "is_mapped %d is_ctldir %d is_stale %d inode { " + "uid %u gid %u ino %lu nlink %u size %lli " + "blkbits %u bytes %u mode 0x%x generation %x } } " + "ace { type %u flags %u access_mask %u } mask_matched %u", + __entry->z_id, __entry->z_unlinked, __entry->z_atime_dirty, + __entry->z_zn_prefetch, __entry->z_moved, __entry->z_blksz, + __entry->z_seq, __entry->z_mapcnt, __entry->z_size, + __entry->z_pflags, __entry->z_sync_cnt, __entry->z_mode, + __entry->z_is_sa, __entry->z_is_mapped, + __entry->z_is_ctldir, __entry->z_is_stale, __entry->i_uid, + __entry->i_gid, __entry->i_ino, __entry->i_nlink, + __entry->i_size, __entry->i_blkbits, + __entry->i_bytes, __entry->i_mode, __entry->i_generation, + __entry->z_type, __entry->z_flags, __entry->z_access_mask, + __entry->mask_matched) +); +/* END CSTYLED */ + +/* BEGIN CSTYLED */ +#define DEFINE_ACE_EVENT(name) \ +DEFINE_EVENT(zfs_ace_class, name, \ + TP_PROTO(znode_t *zn, zfs_ace_hdr_t *ace, uint32_t mask_matched), \ + TP_ARGS(zn, ace, mask_matched)) +/* END CSTYLED */ +DEFINE_ACE_EVENT(zfs_zfs__ace__denies); +DEFINE_ACE_EVENT(zfs_zfs__ace__allows); + +#endif /* _TRACE_ACL_H */ + +#undef TRACE_INCLUDE_PATH +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_PATH sys +#define TRACE_INCLUDE_FILE trace_acl +#include <trace/define_trace.h> + +#else + +DEFINE_DTRACE_PROBE3(zfs__ace__denies); +DEFINE_DTRACE_PROBE3(zfs__ace__allows); +DEFINE_DTRACE_PROBE(zfs__fastpath__execute__access__miss); + +#endif /* HAVE_DECLARE_EVENT_CLASS */ +#endif /* _KERNEL */ diff --git a/include/os/linux/zfs/sys/trace_arc.h b/include/os/linux/zfs/sys/trace_arc.h new file mode 100644 index 000000000..5ce5b38a3 --- /dev/null +++ b/include/os/linux/zfs/sys/trace_arc.h @@ -0,0 +1,383 @@ +/* + * 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 + */ + +#include <sys/list.h> + +#if defined(_KERNEL) +#if defined(HAVE_DECLARE_EVENT_CLASS) + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM zfs + +#undef TRACE_SYSTEM_VAR +#define TRACE_SYSTEM_VAR zfs_arc + +#if !defined(_TRACE_ARC_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_ARC_H + +#include <linux/tracepoint.h> +#include <sys/types.h> +#include <sys/trace_common.h> /* For ZIO macros */ + +/* + * Generic support for one argument tracepoints of the form: + * + * DTRACE_PROBE1(..., + * arc_buf_hdr_t *, ...); + */ +/* BEGIN CSTYLED */ +DECLARE_EVENT_CLASS(zfs_arc_buf_hdr_class, + TP_PROTO(arc_buf_hdr_t *ab), + TP_ARGS(ab), + TP_STRUCT__entry( + __array(uint64_t, hdr_dva_word, 2) + __field(uint64_t, hdr_birth) + __field(uint32_t, hdr_flags) + __field(uint32_t, hdr_bufcnt) + __field(arc_buf_contents_t, hdr_type) + __field(uint16_t, hdr_psize) + __field(uint16_t, hdr_lsize) + __field(uint64_t, hdr_spa) + __field(arc_state_type_t, hdr_state_type) + __field(clock_t, hdr_access) + __field(uint32_t, hdr_mru_hits) + __field(uint32_t, hdr_mru_ghost_hits) + __field(uint32_t, hdr_mfu_hits) + __field(uint32_t, hdr_mfu_ghost_hits) + __field(uint32_t, hdr_l2_hits) + __field(int64_t, hdr_refcount) + ), + TP_fast_assign( + __entry->hdr_dva_word[0] = ab->b_dva.dva_word[0]; + __entry->hdr_dva_word[1] = ab->b_dva.dva_word[1]; + __entry->hdr_birth = ab->b_birth; + __entry->hdr_flags = ab->b_flags; + __entry->hdr_bufcnt = ab->b_l1hdr.b_bufcnt; + __entry->hdr_psize = ab->b_psize; + __entry->hdr_lsize = ab->b_lsize; + __entry->hdr_spa = ab->b_spa; + __entry->hdr_state_type = ab->b_l1hdr.b_state->arcs_state; + __entry->hdr_access = ab->b_l1hdr.b_arc_access; + __entry->hdr_mru_hits = ab->b_l1hdr.b_mru_hits; + __entry->hdr_mru_ghost_hits = ab->b_l1hdr.b_mru_ghost_hits; + __entry->hdr_mfu_hits = ab->b_l1hdr.b_mfu_hits; + __entry->hdr_mfu_ghost_hits = ab->b_l1hdr.b_mfu_ghost_hits; + __entry->hdr_l2_hits = ab->b_l1hdr.b_l2_hits; + __entry->hdr_refcount = ab->b_l1hdr.b_refcnt.rc_count; + ), + TP_printk("hdr { dva 0x%llx:0x%llx birth %llu " + "flags 0x%x bufcnt %u type %u psize %u lsize %u spa %llu " + "state_type %u access %lu mru_hits %u mru_ghost_hits %u " + "mfu_hits %u mfu_ghost_hits %u l2_hits %u refcount %lli }", + __entry->hdr_dva_word[0], __entry->hdr_dva_word[1], + __entry->hdr_birth, __entry->hdr_flags, + __entry->hdr_bufcnt, __entry->hdr_type, __entry->hdr_psize, + __entry->hdr_lsize, __entry->hdr_spa, __entry->hdr_state_type, + __entry->hdr_access, __entry->hdr_mru_hits, + __entry->hdr_mru_ghost_hits, __entry->hdr_mfu_hits, + __entry->hdr_mfu_ghost_hits, __entry->hdr_l2_hits, + __entry->hdr_refcount) +); +/* END CSTYLED */ + +/* BEGIN CSTYLED */ +#define DEFINE_ARC_BUF_HDR_EVENT(name) \ +DEFINE_EVENT(zfs_arc_buf_hdr_class, name, \ + TP_PROTO(arc_buf_hdr_t *ab), \ + TP_ARGS(ab)) +/* END CSTYLED */ +DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__hit); +DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__evict); +DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__delete); +DEFINE_ARC_BUF_HDR_EVENT(zfs_new_state__mru); +DEFINE_ARC_BUF_HDR_EVENT(zfs_new_state__mfu); +DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__async__upgrade__sync); +DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__demand__hit__predictive__prefetch); +DEFINE_ARC_BUF_HDR_EVENT(zfs_l2arc__hit); +DEFINE_ARC_BUF_HDR_EVENT(zfs_l2arc__miss); + +/* + * Generic support for two argument tracepoints of the form: + * + * DTRACE_PROBE2(..., + * vdev_t *, ..., + * zio_t *, ...); + */ +/* BEGIN CSTYLED */ +DECLARE_EVENT_CLASS(zfs_l2arc_rw_class, + TP_PROTO(vdev_t *vd, zio_t *zio), + TP_ARGS(vd, zio), + TP_STRUCT__entry( + __field(uint64_t, vdev_id) + __field(uint64_t, vdev_guid) + __field(uint64_t, vdev_state) + ZIO_TP_STRUCT_ENTRY + ), + TP_fast_assign( + __entry->vdev_id = vd->vdev_id; + __entry->vdev_guid = vd->vdev_guid; + __entry->vdev_state = vd->vdev_state; + ZIO_TP_FAST_ASSIGN + ), + TP_printk("vdev { id %llu guid %llu state %llu } " + ZIO_TP_PRINTK_FMT, __entry->vdev_id, __entry->vdev_guid, + __entry->vdev_state, ZIO_TP_PRINTK_ARGS) +); +/* END CSTYLED */ + +/* BEGIN CSTYLED */ +#define DEFINE_L2ARC_RW_EVENT(name) \ +DEFINE_EVENT(zfs_l2arc_rw_class, name, \ + TP_PROTO(vdev_t *vd, zio_t *zio), \ + TP_ARGS(vd, zio)) +/* END CSTYLED */ +DEFINE_L2ARC_RW_EVENT(zfs_l2arc__read); +DEFINE_L2ARC_RW_EVENT(zfs_l2arc__write); + + +/* + * Generic support for two argument tracepoints of the form: + * + * DTRACE_PROBE2(..., + * zio_t *, ..., + * l2arc_write_callback_t *, ...); + */ +/* BEGIN CSTYLED */ +DECLARE_EVENT_CLASS(zfs_l2arc_iodone_class, + TP_PROTO(zio_t *zio, l2arc_write_callback_t *cb), + TP_ARGS(zio, cb), + TP_STRUCT__entry(ZIO_TP_STRUCT_ENTRY), + TP_fast_assign(ZIO_TP_FAST_ASSIGN), + TP_printk(ZIO_TP_PRINTK_FMT, ZIO_TP_PRINTK_ARGS) +); +/* END CSTYLED */ + +/* BEGIN CSTYLED */ +#define DEFINE_L2ARC_IODONE_EVENT(name) \ +DEFINE_EVENT(zfs_l2arc_iodone_class, name, \ + TP_PROTO(zio_t *zio, l2arc_write_callback_t *cb), \ + TP_ARGS(zio, cb)) +/* END CSTYLED */ +DEFINE_L2ARC_IODONE_EVENT(zfs_l2arc__iodone); + + +/* + * Generic support for four argument tracepoints of the form: + * + * DTRACE_PROBE4(..., + * arc_buf_hdr_t *, ..., + * const blkptr_t *, + * uint64_t, + * const zbookmark_phys_t *); + */ +/* BEGIN CSTYLED */ +DECLARE_EVENT_CLASS(zfs_arc_miss_class, + TP_PROTO(arc_buf_hdr_t *hdr, + const blkptr_t *bp, uint64_t size, const zbookmark_phys_t *zb), + TP_ARGS(hdr, bp, size, zb), + TP_STRUCT__entry( + __array(uint64_t, hdr_dva_word, 2) + __field(uint64_t, hdr_birth) + __field(uint32_t, hdr_flags) + __field(uint32_t, hdr_bufcnt) + __field(arc_buf_contents_t, hdr_type) + __field(uint16_t, hdr_psize) + __field(uint16_t, hdr_lsize) + __field(uint64_t, hdr_spa) + __field(arc_state_type_t, hdr_state_type) + __field(clock_t, hdr_access) + __field(uint32_t, hdr_mru_hits) + __field(uint32_t, hdr_mru_ghost_hits) + __field(uint32_t, hdr_mfu_hits) + __field(uint32_t, hdr_mfu_ghost_hits) + __field(uint32_t, hdr_l2_hits) + __field(int64_t, hdr_refcount) + + __array(uint64_t, bp_dva0, 2) + __array(uint64_t, bp_dva1, 2) + __array(uint64_t, bp_dva2, 2) + __array(uint64_t, bp_cksum, 4) + + __field(uint64_t, bp_lsize) + + __field(uint64_t, zb_objset) + __field(uint64_t, zb_object) + __field(int64_t, zb_level) + __field(uint64_t, zb_blkid) + ), + TP_fast_assign( + __entry->hdr_dva_word[0] = hdr->b_dva.dva_word[0]; + __entry->hdr_dva_word[1] = hdr->b_dva.dva_word[1]; + __entry->hdr_birth = hdr->b_birth; + __entry->hdr_flags = hdr->b_flags; + __entry->hdr_bufcnt = hdr->b_l1hdr.b_bufcnt; + __entry->hdr_psize = hdr->b_psize; + __entry->hdr_lsize = hdr->b_lsize; + __entry->hdr_spa = hdr->b_spa; + __entry->hdr_state_type = hdr->b_l1hdr.b_state->arcs_state; + __entry->hdr_access = hdr->b_l1hdr.b_arc_access; + __entry->hdr_mru_hits = hdr->b_l1hdr.b_mru_hits; + __entry->hdr_mru_ghost_hits = hdr->b_l1hdr.b_mru_ghost_hits; + __entry->hdr_mfu_hits = hdr->b_l1hdr.b_mfu_hits; + __entry->hdr_mfu_ghost_hits = hdr->b_l1hdr.b_mfu_ghost_hits; + __entry->hdr_l2_hits = hdr->b_l1hdr.b_l2_hits; + __entry->hdr_refcount = hdr->b_l1hdr.b_refcnt.rc_count; + + __entry->bp_dva0[0] = bp->blk_dva[0].dva_word[0]; + __entry->bp_dva0[1] = bp->blk_dva[0].dva_word[1]; + __entry->bp_dva1[0] = bp->blk_dva[1].dva_word[0]; + __entry->bp_dva1[1] = bp->blk_dva[1].dva_word[1]; + __entry->bp_dva2[0] = bp->blk_dva[2].dva_word[0]; + __entry->bp_dva2[1] = bp->blk_dva[2].dva_word[1]; + __entry->bp_cksum[0] = bp->blk_cksum.zc_word[0]; + __entry->bp_cksum[1] = bp->blk_cksum.zc_word[1]; + __entry->bp_cksum[2] = bp->blk_cksum.zc_word[2]; + __entry->bp_cksum[3] = bp->blk_cksum.zc_word[3]; + + __entry->bp_lsize = size; + + __entry->zb_objset = zb->zb_objset; + __entry->zb_object = zb->zb_object; + __entry->zb_level = zb->zb_level; + __entry->zb_blkid = zb->zb_blkid; + ), + TP_printk("hdr { dva 0x%llx:0x%llx birth %llu " + "flags 0x%x bufcnt %u psize %u lsize %u spa %llu state_type %u " + "access %lu mru_hits %u mru_ghost_hits %u mfu_hits %u " + "mfu_ghost_hits %u l2_hits %u refcount %lli } " + "bp { dva0 0x%llx:0x%llx dva1 0x%llx:0x%llx dva2 " + "0x%llx:0x%llx cksum 0x%llx:0x%llx:0x%llx:0x%llx " + "lsize %llu } zb { objset %llu object %llu level %lli " + "blkid %llu }", + __entry->hdr_dva_word[0], __entry->hdr_dva_word[1], + __entry->hdr_birth, __entry->hdr_flags, + __entry->hdr_bufcnt, __entry->hdr_psize, __entry->hdr_lsize, + __entry->hdr_spa, __entry->hdr_state_type, __entry->hdr_access, + __entry->hdr_mru_hits, __entry->hdr_mru_ghost_hits, + __entry->hdr_mfu_hits, __entry->hdr_mfu_ghost_hits, + __entry->hdr_l2_hits, __entry->hdr_refcount, + __entry->bp_dva0[0], __entry->bp_dva0[1], + __entry->bp_dva1[0], __entry->bp_dva1[1], + __entry->bp_dva2[0], __entry->bp_dva2[1], + __entry->bp_cksum[0], __entry->bp_cksum[1], + __entry->bp_cksum[2], __entry->bp_cksum[3], + __entry->bp_lsize, __entry->zb_objset, __entry->zb_object, + __entry->zb_level, __entry->zb_blkid) +); +/* END CSTYLED */ + +/* BEGIN CSTYLED */ +#define DEFINE_ARC_MISS_EVENT(name) \ +DEFINE_EVENT(zfs_arc_miss_class, name, \ + TP_PROTO(arc_buf_hdr_t *hdr, \ + const blkptr_t *bp, uint64_t size, const zbookmark_phys_t *zb), \ + TP_ARGS(hdr, bp, size, zb)) +/* END CSTYLED */ +DEFINE_ARC_MISS_EVENT(zfs_arc__miss); + +/* + * Generic support for four argument tracepoints of the form: + * + * DTRACE_PROBE4(..., + * l2arc_dev_t *, ..., + * list_t *, ..., + * uint64_t, ..., + * boolean_t, ...); + */ +/* BEGIN CSTYLED */ +DECLARE_EVENT_CLASS(zfs_l2arc_evict_class, + TP_PROTO(l2arc_dev_t *dev, + list_t *buflist, uint64_t taddr, boolean_t all), + TP_ARGS(dev, buflist, taddr, all), + TP_STRUCT__entry( + __field(uint64_t, vdev_id) + __field(uint64_t, vdev_guid) + __field(uint64_t, vdev_state) + + __field(uint64_t, l2ad_hand) + __field(uint64_t, l2ad_start) + __field(uint64_t, l2ad_end) + __field(boolean_t, l2ad_first) + __field(boolean_t, l2ad_writing) + + __field(uint64_t, taddr) + __field(boolean_t, all) + ), + TP_fast_assign( + __entry->vdev_id = dev->l2ad_vdev->vdev_id; + __entry->vdev_guid = dev->l2ad_vdev->vdev_guid; + __entry->vdev_state = dev->l2ad_vdev->vdev_state; + + __entry->l2ad_hand = dev->l2ad_hand; + __entry->l2ad_start = dev->l2ad_start; + __entry->l2ad_end = dev->l2ad_end; + __entry->l2ad_first = dev->l2ad_first; + __entry->l2ad_writing = dev->l2ad_writing; + + __entry->taddr = taddr; + __entry->all = all; + ), + TP_printk("l2ad { vdev { id %llu guid %llu state %llu } " + "hand %llu start %llu end %llu " + "first %d writing %d } taddr %llu all %d", + __entry->vdev_id, __entry->vdev_guid, __entry->vdev_state, + __entry->l2ad_hand, __entry->l2ad_start, + __entry->l2ad_end, __entry->l2ad_first, __entry->l2ad_writing, + __entry->taddr, __entry->all) +); +/* END CSTYLED */ + +/* BEGIN CSTYLED */ +#define DEFINE_L2ARC_EVICT_EVENT(name) \ +DEFINE_EVENT(zfs_l2arc_evict_class, name, \ + TP_PROTO(l2arc_dev_t *dev, \ + list_t *buflist, uint64_t taddr, boolean_t all), \ + TP_ARGS(dev, buflist, taddr, all)) +/* END CSTYLED */ +DEFINE_L2ARC_EVICT_EVENT(zfs_l2arc__evict); + +#endif /* _TRACE_ARC_H */ + +#undef TRACE_INCLUDE_PATH +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_PATH sys +#define TRACE_INCLUDE_FILE trace_arc +#include <trace/define_trace.h> + +#else + +DEFINE_DTRACE_PROBE1(arc__hit); +DEFINE_DTRACE_PROBE1(arc__evict); +DEFINE_DTRACE_PROBE1(arc__delete); +DEFINE_DTRACE_PROBE1(new_state__mru); +DEFINE_DTRACE_PROBE1(new_state__mfu); +DEFINE_DTRACE_PROBE1(arc__async__upgrade__sync); +DEFINE_DTRACE_PROBE1(arc__demand__hit__predictive__prefetch); +DEFINE_DTRACE_PROBE1(l2arc__hit); +DEFINE_DTRACE_PROBE1(l2arc__miss); +DEFINE_DTRACE_PROBE2(l2arc__read); +DEFINE_DTRACE_PROBE2(l2arc__write); +DEFINE_DTRACE_PROBE2(l2arc__iodone); +DEFINE_DTRACE_PROBE4(arc__miss); +DEFINE_DTRACE_PROBE4(l2arc__evict); + +#endif /* HAVE_DECLARE_EVENT_CLASS */ +#endif /* _KERNEL */ diff --git a/include/os/linux/zfs/sys/trace_common.h b/include/os/linux/zfs/sys/trace_common.h new file mode 100644 index 000000000..6922d1a18 --- /dev/null +++ b/include/os/linux/zfs/sys/trace_common.h @@ -0,0 +1,112 @@ +/* + * 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 + */ + +/* + * This file contains commonly used trace macros. Feel free to add and use + * them in your tracepoint headers. + */ + +#ifndef _SYS_TRACE_COMMON_H +#define _SYS_TRACE_COMMON_H +#include <linux/tracepoint.h> + +/* ZIO macros */ +#define ZIO_TP_STRUCT_ENTRY \ + __field(zio_type_t, zio_type) \ + __field(int, zio_cmd) \ + __field(zio_priority_t, zio_priority) \ + __field(uint64_t, zio_size) \ + __field(uint64_t, zio_orig_size) \ + __field(uint64_t, zio_offset) \ + __field(hrtime_t, zio_timestamp) \ + __field(hrtime_t, zio_delta) \ + __field(uint64_t, zio_delay) \ + __field(enum zio_flag, zio_flags) \ + __field(enum zio_stage, zio_stage) \ + __field(enum zio_stage, zio_pipeline) \ + __field(enum zio_flag, zio_orig_flags) \ + __field(enum zio_stage, zio_orig_stage) \ + __field(enum zio_stage, zio_orig_pipeline) \ + __field(uint8_t, zio_reexecute) \ + __field(uint64_t, zio_txg) \ + __field(int, zio_error) \ + __field(uint64_t, zio_ena) \ + \ + __field(enum zio_checksum, zp_checksum) \ + __field(enum zio_compress, zp_compress) \ + __field(dmu_object_type_t, zp_type) \ + __field(uint8_t, zp_level) \ + __field(uint8_t, zp_copies) \ + __field(boolean_t, zp_dedup) \ + __field(boolean_t, zp_dedup_verify) \ + __field(boolean_t, zp_nopwrite) + +#define ZIO_TP_FAST_ASSIGN \ + __entry->zio_type = zio->io_type; \ + __entry->zio_cmd = zio->io_cmd; \ + __entry->zio_priority = zio->io_priority; \ + __entry->zio_size = zio->io_size; \ + __entry->zio_orig_size = zio->io_orig_size; \ + __entry->zio_offset = zio->io_offset; \ + __entry->zio_timestamp = zio->io_timestamp; \ + __entry->zio_delta = zio->io_delta; \ + __entry->zio_delay = zio->io_delay; \ + __entry->zio_flags = zio->io_flags; \ + __entry->zio_stage = zio->io_stage; \ + __entry->zio_pipeline = zio->io_pipeline; \ + __entry->zio_orig_flags = zio->io_orig_flags; \ + __entry->zio_orig_stage = zio->io_orig_stage; \ + __entry->zio_orig_pipeline = zio->io_orig_pipeline; \ + __entry->zio_reexecute = zio->io_reexecute; \ + __entry->zio_txg = zio->io_txg; \ + __entry->zio_error = zio->io_error; \ + __entry->zio_ena = zio->io_ena; \ + \ + __entry->zp_checksum = zio->io_prop.zp_checksum; \ + __entry->zp_compress = zio->io_prop.zp_compress; \ + __entry->zp_type = zio->io_prop.zp_type; \ + __entry->zp_level = zio->io_prop.zp_level; \ + __entry->zp_copies = zio->io_prop.zp_copies; \ + __entry->zp_dedup = zio->io_prop.zp_dedup; \ + __entry->zp_nopwrite = zio->io_prop.zp_nopwrite; \ + __entry->zp_dedup_verify = zio->io_prop.zp_dedup_verify; + +#define ZIO_TP_PRINTK_FMT \ + "zio { type %u cmd %i prio %u size %llu orig_size %llu " \ + "offset %llu timestamp %llu delta %llu delay %llu " \ + "flags 0x%x stage 0x%x pipeline 0x%x orig_flags 0x%x " \ + "orig_stage 0x%x orig_pipeline 0x%x reexecute %u " \ + "txg %llu error %d ena %llu prop { checksum %u compress %u " \ + "type %u level %u copies %u dedup %u dedup_verify %u nopwrite %u } }" + +#define ZIO_TP_PRINTK_ARGS \ + __entry->zio_type, __entry->zio_cmd, __entry->zio_priority, \ + __entry->zio_size, __entry->zio_orig_size, __entry->zio_offset, \ + __entry->zio_timestamp, __entry->zio_delta, __entry->zio_delay, \ + __entry->zio_flags, __entry->zio_stage, __entry->zio_pipeline, \ + __entry->zio_orig_flags, __entry->zio_orig_stage, \ + __entry->zio_orig_pipeline, __entry->zio_reexecute, \ + __entry->zio_txg, __entry->zio_error, __entry->zio_ena, \ + __entry->zp_checksum, __entry->zp_compress, __entry->zp_type, \ + __entry->zp_level, __entry->zp_copies, __entry->zp_dedup, \ + __entry->zp_dedup_verify, __entry->zp_nopwrite + +#endif /* _SYS_TRACE_COMMON_H */ diff --git a/include/os/linux/zfs/sys/trace_dbgmsg.h b/include/os/linux/zfs/sys/trace_dbgmsg.h new file mode 100644 index 000000000..b2ef529ed --- /dev/null +++ b/include/os/linux/zfs/sys/trace_dbgmsg.h @@ -0,0 +1,75 @@ +/* + * 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) +#if defined(HAVE_DECLARE_EVENT_CLASS) + +/* Do not include this file directly. Please use <sys/trace.h> instead. */ +#ifndef _SYS_TRACE_DBGMSG_INDIRECT +#error "trace_dbgmsg.h included directly" +#endif + +/* + * This file defines tracepoint events for use by the dbgmsg(), + * dprintf(), and SET_ERROR() interfaces. These are grouped here because + * they all provide a way to store simple messages in the debug log (as + * opposed to events used by the DTRACE_PROBE interfaces which typically + * dump structured data). + * + * This header is included inside the trace.h multiple inclusion guard, + * and it is guarded above against direct inclusion, so it and need not + * be guarded separately. + */ + +/* + * Generic support for one argument tracepoints of the form: + * + * DTRACE_PROBE1(..., + * const char *, ...); + */ +/* BEGIN CSTYLED */ +DECLARE_EVENT_CLASS(zfs_dprintf_class, + TP_PROTO(const char *msg), + TP_ARGS(msg), + TP_STRUCT__entry( + __string(msg, msg) + ), + TP_fast_assign( + __assign_str(msg, 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 *msg), \ + TP_ARGS(msg)) +/* END CSTYLED */ +DEFINE_DPRINTF_EVENT(zfs_zfs__dprintf); + +#else + +DEFINE_DTRACE_PROBE1(zfs__dprintf); + +#endif /* HAVE_DECLARE_EVENT_CLASS */ +#endif /* _KERNEL */ diff --git a/include/os/linux/zfs/sys/trace_dbuf.h b/include/os/linux/zfs/sys/trace_dbuf.h new file mode 100644 index 000000000..fb12e2854 --- /dev/null +++ b/include/os/linux/zfs/sys/trace_dbuf.h @@ -0,0 +1,152 @@ +/* + * 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) +#if defined(HAVE_DECLARE_EVENT_CLASS) + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM zfs + +#undef TRACE_SYSTEM_VAR +#define TRACE_SYSTEM_VAR zfs_dbuf + +#if !defined(_TRACE_DBUF_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_DBUF_H + +#include <linux/tracepoint.h> +#include <sys/types.h> + +#ifndef TRACE_DBUF_MSG_MAX +#define TRACE_DBUF_MSG_MAX 512 +#endif + +/* + * Generic support for two argument tracepoints of the form: + * + * DTRACE_PROBE2(..., + * dmu_buf_impl_t *, ..., + * zio_t *, ...); + */ + +#define DBUF_TP_STRUCT_ENTRY \ + __dynamic_array(char, os_spa, TRACE_DBUF_MSG_MAX) \ + __field(uint64_t, ds_object) \ + __field(uint64_t, db_object) \ + __field(uint64_t, db_level) \ + __field(uint64_t, db_blkid) \ + __field(uint64_t, db_offset) \ + __field(uint64_t, db_size) \ + __field(uint64_t, db_state) \ + __field(int64_t, db_holds) \ + __dynamic_array(char, msg, TRACE_DBUF_MSG_MAX) + +#define DBUF_TP_FAST_ASSIGN \ + if (db != NULL) { \ + __assign_str(os_spa, \ + spa_name(DB_DNODE(db)->dn_objset->os_spa)); \ + \ + __entry->ds_object = db->db_objset->os_dsl_dataset ? \ + db->db_objset->os_dsl_dataset->ds_object : 0; \ + \ + __entry->db_object = db->db.db_object; \ + __entry->db_level = db->db_level; \ + __entry->db_blkid = db->db_blkid; \ + __entry->db_offset = db->db.db_offset; \ + __entry->db_size = db->db.db_size; \ + __entry->db_state = db->db_state; \ + __entry->db_holds = zfs_refcount_count(&db->db_holds); \ + snprintf(__get_str(msg), TRACE_DBUF_MSG_MAX, \ + DBUF_TP_PRINTK_FMT, DBUF_TP_PRINTK_ARGS); \ + } else { \ + __assign_str(os_spa, "NULL") \ + __entry->ds_object = 0; \ + __entry->db_object = 0; \ + __entry->db_level = 0; \ + __entry->db_blkid = 0; \ + __entry->db_offset = 0; \ + __entry->db_size = 0; \ + __entry->db_state = 0; \ + __entry->db_holds = 0; \ + snprintf(__get_str(msg), TRACE_DBUF_MSG_MAX, \ + "dbuf { NULL }"); \ + } + +#define DBUF_TP_PRINTK_FMT \ + "dbuf { spa \"%s\" objset %llu object %llu level %llu " \ + "blkid %llu offset %llu size %llu state %llu holds %lld }" + +#define DBUF_TP_PRINTK_ARGS \ + __get_str(os_spa), __entry->ds_object, \ + __entry->db_object, __entry->db_level, \ + __entry->db_blkid, __entry->db_offset, \ + __entry->db_size, __entry->db_state, __entry->db_holds + +/* BEGIN CSTYLED */ +DECLARE_EVENT_CLASS(zfs_dbuf_class, + TP_PROTO(dmu_buf_impl_t *db, zio_t *zio), + TP_ARGS(db, zio), + TP_STRUCT__entry(DBUF_TP_STRUCT_ENTRY), + TP_fast_assign(DBUF_TP_FAST_ASSIGN), + TP_printk("%s", __get_str(msg)) +); +/* END CSTYLED */ + +/* BEGIN CSTYLED */ +#define DEFINE_DBUF_EVENT(name) \ +DEFINE_EVENT(zfs_dbuf_class, name, \ + TP_PROTO(dmu_buf_impl_t *db, zio_t *zio), \ + TP_ARGS(db, zio)) +/* END CSTYLED */ +DEFINE_DBUF_EVENT(zfs_blocked__read); + +/* BEGIN CSTYLED */ +DECLARE_EVENT_CLASS(zfs_dbuf_evict_one_class, + TP_PROTO(dmu_buf_impl_t *db, multilist_sublist_t *mls), + TP_ARGS(db, mls), + TP_STRUCT__entry(DBUF_TP_STRUCT_ENTRY), + TP_fast_assign(DBUF_TP_FAST_ASSIGN), + TP_printk("%s", __get_str(msg)) +); +/* END CSTYLED */ + +/* BEGIN CSTYLED */ +#define DEFINE_DBUF_EVICT_ONE_EVENT(name) \ +DEFINE_EVENT(zfs_dbuf_evict_one_class, name, \ + TP_PROTO(dmu_buf_impl_t *db, multilist_sublist_t *mls), \ + TP_ARGS(db, mls)) +/* END CSTYLED */ +DEFINE_DBUF_EVICT_ONE_EVENT(zfs_dbuf__evict__one); + +#endif /* _TRACE_DBUF_H */ + +#undef TRACE_INCLUDE_PATH +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_PATH sys +#define TRACE_INCLUDE_FILE trace_dbuf +#include <trace/define_trace.h> + +#else + +DEFINE_DTRACE_PROBE2(blocked__read); +DEFINE_DTRACE_PROBE2(dbuf__evict__one); + +#endif /* HAVE_DECLARE_EVENT_CLASS */ +#endif /* _KERNEL */ diff --git a/include/os/linux/zfs/sys/trace_defs.h b/include/os/linux/zfs/sys/trace_defs.h new file mode 100644 index 000000000..aaff65fbc --- /dev/null +++ b/include/os/linux/zfs/sys/trace_defs.h @@ -0,0 +1,52 @@ +/* + * 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 + */ + +#ifndef _OS_LINUX_ZFS_TRACE_H +#define _OS_LINUX_ZFS_TRACE_H + +#include <sys/multilist.h> +#include <sys/arc_impl.h> +#include <sys/vdev_impl.h> +#include <sys/zio.h> +#include <sys/dbuf.h> +#include <sys/dmu_objset.h> +#include <sys/dsl_dataset.h> +#include <sys/dmu_tx.h> +#include <sys/dnode.h> +#include <sys/zfs_znode.h> +#include <sys/zil_impl.h> +#include <sys/zrlock.h> + +#include <sys/trace.h> +#include <sys/trace_acl.h> +#include <sys/trace_arc.h> +#include <sys/trace_dbuf.h> +#include <sys/trace_dmu.h> +#include <sys/trace_dnode.h> +#include <sys/trace_multilist.h> +#include <sys/trace_rrwlock.h> +#include <sys/trace_txg.h> +#include <sys/trace_vdev.h> +#include <sys/trace_zil.h> +#include <sys/trace_zio.h> +#include <sys/trace_zrlock.h> + +#endif diff --git a/include/os/linux/zfs/sys/trace_dmu.h b/include/os/linux/zfs/sys/trace_dmu.h new file mode 100644 index 000000000..3c64a370f --- /dev/null +++ b/include/os/linux/zfs/sys/trace_dmu.h @@ -0,0 +1,136 @@ +/* + * 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) +#if defined(HAVE_DECLARE_EVENT_CLASS) + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM zfs + +#undef TRACE_SYSTEM_VAR +#define TRACE_SYSTEM_VAR zfs_dmu + +#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, ...); + */ +/* BEGIN CSTYLED */ +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_dirty_delayed) + __field(hrtime_t, tx_start) + __field(boolean_t, tx_wait_dirty) + __field(int, tx_err) + __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_dirty_delayed = tx->tx_dirty_delayed; + __entry->tx_start = tx->tx_start; + __entry->tx_wait_dirty = tx->tx_wait_dirty; + __entry->tx_err = tx->tx_err; + __entry->dirty = dirty; + __entry->min_tx_time = min_tx_time; + ), + TP_printk("tx { txg %llu lastsnap_txg %llu tx_lasttried_txg %llu " + "anyobj %d dirty_delayed %d start %llu wait_dirty %d err %i " + "} dirty %llu min_tx_time %llu", + __entry->tx_txg, __entry->tx_lastsnap_txg, + __entry->tx_lasttried_txg, __entry->tx_anyobj, + __entry->tx_dirty_delayed, __entry->tx_start, + __entry->tx_wait_dirty, __entry->tx_err, + __entry->dirty, __entry->min_tx_time) +); +/* END CSTYLED */ + +/* BEGIN CSTYLED */ +#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)) +/* END CSTYLED */ +DEFINE_DELAY_MINTIME_EVENT(zfs_delay__mintime); + +/* BEGIN CSTYLED */ +DECLARE_EVENT_CLASS(zfs_free_long_range_class, + TP_PROTO(uint64_t long_free_dirty_all_txgs, uint64_t chunk_len, \ + uint64_t txg), + TP_ARGS(long_free_dirty_all_txgs, chunk_len, txg), + TP_STRUCT__entry( + __field(uint64_t, long_free_dirty_all_txgs) + __field(uint64_t, chunk_len) + __field(uint64_t, txg) + ), + TP_fast_assign( + __entry->long_free_dirty_all_txgs = long_free_dirty_all_txgs; + __entry->chunk_len = chunk_len; + __entry->txg = txg; + ), + TP_printk("long_free_dirty_all_txgs %llu chunk_len %llu txg %llu", + __entry->long_free_dirty_all_txgs, + __entry->chunk_len, __entry->txg) +); +/* END CSTYLED */ + +/* BEGIN CSTYLED */ +#define DEFINE_FREE_LONG_RANGE_EVENT(name) \ +DEFINE_EVENT(zfs_free_long_range_class, name, \ + TP_PROTO(uint64_t long_free_dirty_all_txgs, \ + uint64_t chunk_len, uint64_t txg), \ + TP_ARGS(long_free_dirty_all_txgs, chunk_len, txg)) +/* END CSTYLED */ +DEFINE_FREE_LONG_RANGE_EVENT(zfs_free__long__range); + +#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> + +#else + +DEFINE_DTRACE_PROBE3(delay__mintime); +DEFINE_DTRACE_PROBE3(free__long__range); + +#endif /* HAVE_DECLARE_EVENT_CLASS */ +#endif /* _KERNEL */ diff --git a/include/os/linux/zfs/sys/trace_dnode.h b/include/os/linux/zfs/sys/trace_dnode.h new file mode 100644 index 000000000..27ad6cba1 --- /dev/null +++ b/include/os/linux/zfs/sys/trace_dnode.h @@ -0,0 +1,129 @@ +/* + * 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) +#if defined(HAVE_DECLARE_EVENT_CLASS) + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM zfs + +#undef TRACE_SYSTEM_VAR +#define TRACE_SYSTEM_VAR zfs_dnode + +#if !defined(_TRACE_DNODE_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_DNODE_H + +#include <linux/tracepoint.h> +#include <sys/types.h> + +/* + * Generic support for three argument tracepoints of the form: + * + * DTRACE_PROBE3(..., + * dnode_t *, ..., + * int64_t, ..., + * uint32_t, ...); + */ +/* BEGIN CSTYLED */ +DECLARE_EVENT_CLASS(zfs_dnode_move_class, + TP_PROTO(dnode_t *dn, int64_t refcount, uint32_t dbufs), + TP_ARGS(dn, refcount, dbufs), + TP_STRUCT__entry( + __field(uint64_t, dn_object) + __field(dmu_object_type_t, dn_type) + __field(uint16_t, dn_bonuslen) + __field(uint8_t, dn_bonustype) + __field(uint8_t, dn_nblkptr) + __field(uint8_t, dn_checksum) + __field(uint8_t, dn_compress) + __field(uint8_t, dn_nlevels) + __field(uint8_t, dn_indblkshift) + __field(uint8_t, dn_datablkshift) + __field(uint8_t, dn_moved) + __field(uint16_t, dn_datablkszsec) + __field(uint32_t, dn_datablksz) + __field(uint64_t, dn_maxblkid) + __field(int64_t, dn_tx_holds) + __field(int64_t, dn_holds) + __field(boolean_t, dn_have_spill) + + __field(int64_t, refcount) + __field(uint32_t, dbufs) + ), + TP_fast_assign( + __entry->dn_object = dn->dn_object; + __entry->dn_type = dn->dn_type; + __entry->dn_bonuslen = dn->dn_bonuslen; + __entry->dn_bonustype = dn->dn_bonustype; + __entry->dn_nblkptr = dn->dn_nblkptr; + __entry->dn_checksum = dn->dn_checksum; + __entry->dn_compress = dn->dn_compress; + __entry->dn_nlevels = dn->dn_nlevels; + __entry->dn_indblkshift = dn->dn_indblkshift; + __entry->dn_datablkshift = dn->dn_datablkshift; + __entry->dn_moved = dn->dn_moved; + __entry->dn_datablkszsec = dn->dn_datablkszsec; + __entry->dn_datablksz = dn->dn_datablksz; + __entry->dn_maxblkid = dn->dn_maxblkid; + __entry->dn_tx_holds = dn->dn_tx_holds.rc_count; + __entry->dn_holds = dn->dn_holds.rc_count; + __entry->dn_have_spill = dn->dn_have_spill; + + __entry->refcount = refcount; + __entry->dbufs = dbufs; + ), + TP_printk("dn { object %llu type %d bonuslen %u bonustype %u " + "nblkptr %u checksum %u compress %u nlevels %u indblkshift %u " + "datablkshift %u moved %u datablkszsec %u datablksz %u " + "maxblkid %llu tx_holds %lli holds %lli have_spill %d } " + "refcount %lli dbufs %u", + __entry->dn_object, __entry->dn_type, __entry->dn_bonuslen, + __entry->dn_bonustype, __entry->dn_nblkptr, __entry->dn_checksum, + __entry->dn_compress, __entry->dn_nlevels, __entry->dn_indblkshift, + __entry->dn_datablkshift, __entry->dn_moved, + __entry->dn_datablkszsec, __entry->dn_datablksz, + __entry->dn_maxblkid, __entry->dn_tx_holds, __entry->dn_holds, + __entry->dn_have_spill, __entry->refcount, __entry->dbufs) +); +/* END CSTYLED */ + +/* BEGIN CSTYLED */ +#define DEFINE_DNODE_MOVE_EVENT(name) \ +DEFINE_EVENT(zfs_dnode_move_class, name, \ + TP_PROTO(dnode_t *dn, int64_t refcount, uint32_t dbufs), \ + TP_ARGS(dn, refcount, dbufs)) +/* END CSTYLED */ +DEFINE_DNODE_MOVE_EVENT(zfs_dnode__move); + +#endif /* _TRACE_DNODE_H */ + +#undef TRACE_INCLUDE_PATH +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_PATH sys +#define TRACE_INCLUDE_FILE trace_dnode +#include <trace/define_trace.h> + +#else + +DEFINE_DTRACE_PROBE3(dnode__move); + +#endif /* HAVE_DECLARE_EVENT_CLASS */ +#endif /* _KERNEL */ diff --git a/include/os/linux/zfs/sys/trace_multilist.h b/include/os/linux/zfs/sys/trace_multilist.h new file mode 100644 index 000000000..fe68d5296 --- /dev/null +++ b/include/os/linux/zfs/sys/trace_multilist.h @@ -0,0 +1,89 @@ +/* + * 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) +#if defined(HAVE_DECLARE_EVENT_CLASS) + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM zfs + +#undef TRACE_SYSTEM_VAR +#define TRACE_SYSTEM_VAR zfs_multilist + +#if !defined(_TRACE_MULTILIST_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_MULTILIST_H + +#include <linux/tracepoint.h> +#include <sys/types.h> + +/* + * Generic support for three argument tracepoints of the form: + * + * DTRACE_PROBE3(..., + * multilist_t *, ..., + * unsigned int, ..., + * void *, ...); + */ +/* BEGIN CSTYLED */ +DECLARE_EVENT_CLASS(zfs_multilist_insert_remove_class, + TP_PROTO(multilist_t *ml, unsigned sublist_idx, void *obj), + TP_ARGS(ml, sublist_idx, obj), + TP_STRUCT__entry( + __field(size_t, ml_offset) + __field(uint64_t, ml_num_sublists) + + __field(unsigned int, sublist_idx) + ), + TP_fast_assign( + __entry->ml_offset = ml->ml_offset; + __entry->ml_num_sublists = ml->ml_num_sublists; + + __entry->sublist_idx = sublist_idx; + ), + TP_printk("ml { offset %ld numsublists %llu sublistidx %u } ", + __entry->ml_offset, __entry->ml_num_sublists, __entry->sublist_idx) +); +/* END CSTYLED */ + +/* BEGIN CSTYLED */ +#define DEFINE_MULTILIST_INSERT_REMOVE_EVENT(name) \ +DEFINE_EVENT(zfs_multilist_insert_remove_class, name, \ + TP_PROTO(multilist_t *ml, unsigned int sublist_idx, void *obj), \ + TP_ARGS(ml, sublist_idx, obj)) +/* END CSTYLED */ +DEFINE_MULTILIST_INSERT_REMOVE_EVENT(zfs_multilist__insert); +DEFINE_MULTILIST_INSERT_REMOVE_EVENT(zfs_multilist__remove); + +#endif /* _TRACE_MULTILIST_H */ + +#undef TRACE_INCLUDE_PATH +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_PATH sys +#define TRACE_INCLUDE_FILE trace_multilist +#include <trace/define_trace.h> + +#else + +DEFINE_DTRACE_PROBE3(multilist__insert); +DEFINE_DTRACE_PROBE3(multilist__remove); + +#endif /* HAVE_DECLARE_EVENT_CLASS */ +#endif /* _KERNEL */ diff --git a/include/os/linux/zfs/sys/trace_rrwlock.h b/include/os/linux/zfs/sys/trace_rrwlock.h new file mode 100644 index 000000000..4c74d6257 --- /dev/null +++ b/include/os/linux/zfs/sys/trace_rrwlock.h @@ -0,0 +1,31 @@ +/* + * 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) +#if defined(HAVE_DECLARE_EVENT_CLASS) + +#else + +DEFINE_DTRACE_PROBE(zfs__rrwfastpath__rdmiss); +DEFINE_DTRACE_PROBE(zfs__rrwfastpath__exitmiss); + +#endif /* HAVE_DECLARE_EVENT_CLASS */ +#endif /* _KERNEL */ diff --git a/include/os/linux/zfs/sys/trace_txg.h b/include/os/linux/zfs/sys/trace_txg.h new file mode 100644 index 000000000..23d5d358b --- /dev/null +++ b/include/os/linux/zfs/sys/trace_txg.h @@ -0,0 +1,89 @@ +/* + * 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) +#if defined(HAVE_DECLARE_EVENT_CLASS) + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM zfs + +#undef TRACE_SYSTEM_VAR +#define TRACE_SYSTEM_VAR zfs_txg + +#if !defined(_TRACE_TXG_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_TXG_H + +#include <linux/tracepoint.h> +#include <sys/types.h> + +/* + * Generic support for two argument tracepoints of the form: + * + * DTRACE_PROBE2(..., + * dsl_pool_t *, ..., + * uint64_t, ...); + */ +/* BEGIN CSTYLED */ +DECLARE_EVENT_CLASS(zfs_txg_class, + TP_PROTO(dsl_pool_t *dp, uint64_t txg), + TP_ARGS(dp, txg), + TP_STRUCT__entry( + __field(uint64_t, txg) + ), + TP_fast_assign( + __entry->txg = txg; + ), + TP_printk("txg %llu", __entry->txg) +); +/* END CSTYLED */ + +/* BEGIN CSTYLED */ +#define DEFINE_TXG_EVENT(name) \ +DEFINE_EVENT(zfs_txg_class, name, \ + TP_PROTO(dsl_pool_t *dp, uint64_t txg), \ + TP_ARGS(dp, txg)) +/* END CSTYLED */ +DEFINE_TXG_EVENT(zfs_dsl_pool_sync__done); +DEFINE_TXG_EVENT(zfs_txg__quiescing); +DEFINE_TXG_EVENT(zfs_txg__opened); +DEFINE_TXG_EVENT(zfs_txg__syncing); +DEFINE_TXG_EVENT(zfs_txg__synced); +DEFINE_TXG_EVENT(zfs_txg__quiesced); + +#endif /* _TRACE_TXG_H */ + +#undef TRACE_INCLUDE_PATH +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_PATH sys +#define TRACE_INCLUDE_FILE trace_txg +#include <trace/define_trace.h> + +#else + +DEFINE_DTRACE_PROBE2(dsl_pool_sync__done); +DEFINE_DTRACE_PROBE2(txg__quiescing); +DEFINE_DTRACE_PROBE2(txg__opened); +DEFINE_DTRACE_PROBE2(txg__syncing); +DEFINE_DTRACE_PROBE2(txg__synced); +DEFINE_DTRACE_PROBE2(txg__quiesced); + +#endif /* HAVE_DECLARE_EVENT_CLASS */ +#endif /* _KERNEL */ diff --git a/include/os/linux/zfs/sys/trace_vdev.h b/include/os/linux/zfs/sys/trace_vdev.h new file mode 100644 index 000000000..50711446f --- /dev/null +++ b/include/os/linux/zfs/sys/trace_vdev.h @@ -0,0 +1,140 @@ +/* + * 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) +#if defined(HAVE_DECLARE_EVENT_CLASS) + +/* + * If tracepoints are available define dtrace_probe events for vdev + * related probes. Definitions in include/os/linux/spl/sys/trace.h + * will map DTRACE_PROBE* calls to tracepoints. + */ + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM zfs + +#undef TRACE_SYSTEM_VAR +#define TRACE_SYSTEM_VAR zfs_vdev + +#if !defined(_TRACE_VDEV_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_VDEV_H + +#include <linux/tracepoint.h> +#include <sys/types.h> + +/* + * Generic support for three argument tracepoints of the form: + * + * DTRACE_PROBE3(..., + * spa_t *, ..., + * uint64_t, ..., + * uint64_t, ...); + */ +/* BEGIN CSTYLED */ +DECLARE_EVENT_CLASS(zfs_removing_class_3, + TP_PROTO(spa_t *spa, uint64_t offset, uint64_t size), + TP_ARGS(spa, offset, size), + TP_STRUCT__entry( + __field(spa_t *, vdev_spa) + __field(uint64_t, vdev_offset) + __field(uint64_t, vdev_size) + ), + TP_fast_assign( + __entry->vdev_spa = spa; + __entry->vdev_offset = offset; + __entry->vdev_size = size; + ), + TP_printk("spa %p offset %llu size %llu", + __entry->vdev_spa, __entry->vdev_offset, + __entry->vdev_size) +); +/* END CSTYLED */ + +/* BEGIN CSTYLED */ +#define DEFINE_REMOVE_FREE_EVENT(name) \ +DEFINE_EVENT(zfs_removing_class_3, name, \ + TP_PROTO(spa_t *spa, uint64_t offset, uint64_t size), \ + TP_ARGS(spa, offset, size)) +/* END CSTYLED */ +DEFINE_REMOVE_FREE_EVENT(zfs_remove__free__synced); +DEFINE_REMOVE_FREE_EVENT(zfs_remove__free__unvisited); + +/* + * Generic support for four argument tracepoints of the form: + * + * DTRACE_PROBE4(..., + * spa_t *, ..., + * uint64_t, ..., + * uint64_t, ..., + * uint64_t, ...); + */ +/* BEGIN CSTYLED */ +DECLARE_EVENT_CLASS(zfs_removing_class_4, + TP_PROTO(spa_t *spa, uint64_t offset, uint64_t size, uint64_t txg), + TP_ARGS(spa, offset, size, txg), + TP_STRUCT__entry( + __field(spa_t *, vdev_spa) + __field(uint64_t, vdev_offset) + __field(uint64_t, vdev_size) + __field(uint64_t, vdev_txg) + ), + TP_fast_assign( + __entry->vdev_spa = spa; + __entry->vdev_offset = offset; + __entry->vdev_size = size; + __entry->vdev_txg = txg; + ), + TP_printk("spa %p offset %llu size %llu txg %llu", + __entry->vdev_spa, __entry->vdev_offset, + __entry->vdev_size, __entry->vdev_txg) +); + +/* BEGIN CSTYLED */ +#define DEFINE_REMOVE_FREE_EVENT_TXG(name) \ +DEFINE_EVENT(zfs_removing_class_4, name, \ + TP_PROTO(spa_t *spa, uint64_t offset, uint64_t size,uint64_t txg), \ + TP_ARGS(spa, offset, size, txg)) +/* END CSTYLED */ +DEFINE_REMOVE_FREE_EVENT_TXG(zfs_remove__free__inflight); + +#endif /* _TRACE_VDEV_H */ + +#undef TRACE_INCLUDE_PATH +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_PATH sys +#define TRACE_INCLUDE_FILE trace_vdev +#include <trace/define_trace.h> + +#else + +/* + * When tracepoints are not available, a DEFINE_DTRACE_PROBE* macro is + * needed for each DTRACE_PROBE. These will be used to generate stub + * tracing functions and prototypes for those functions. See + * include/os/linux/spl/sys/trace.h. + */ + +DEFINE_DTRACE_PROBE3(remove__free__synced); +DEFINE_DTRACE_PROBE3(remove__free__unvisited); +DEFINE_DTRACE_PROBE4(remove__free__inflight); + +#endif /* HAVE_DECLARE_EVENT_CLASS */ +#endif /* _KERNEL */ diff --git a/include/os/linux/zfs/sys/trace_zil.h b/include/os/linux/zfs/sys/trace_zil.h new file mode 100644 index 000000000..526846e66 --- /dev/null +++ b/include/os/linux/zfs/sys/trace_zil.h @@ -0,0 +1,229 @@ +/* + * 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) +#if defined(HAVE_DECLARE_EVENT_CLASS) + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM zfs + +#undef TRACE_SYSTEM_VAR +#define TRACE_SYSTEM_VAR zfs_zil + +#if !defined(_TRACE_ZIL_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_ZIL_H + +#include <linux/tracepoint.h> +#include <sys/types.h> + +#define ZILOG_TP_STRUCT_ENTRY \ + __field(uint64_t, zl_lr_seq) \ + __field(uint64_t, zl_commit_lr_seq) \ + __field(uint64_t, zl_destroy_txg) \ + __field(uint64_t, zl_replaying_seq) \ + __field(uint32_t, zl_suspend) \ + __field(uint8_t, zl_suspending) \ + __field(uint8_t, zl_keep_first) \ + __field(uint8_t, zl_replay) \ + __field(uint8_t, zl_stop_sync) \ + __field(uint8_t, zl_logbias) \ + __field(uint8_t, zl_sync) \ + __field(int, zl_parse_error) \ + __field(uint64_t, zl_parse_blk_seq) \ + __field(uint64_t, zl_parse_lr_seq) \ + __field(uint64_t, zl_parse_blk_count) \ + __field(uint64_t, zl_parse_lr_count) \ + __field(uint64_t, zl_cur_used) \ + __field(clock_t, zl_replay_time) \ + __field(uint64_t, zl_replay_blks) + +#define ZILOG_TP_FAST_ASSIGN \ + __entry->zl_lr_seq = zilog->zl_lr_seq; \ + __entry->zl_commit_lr_seq = zilog->zl_commit_lr_seq; \ + __entry->zl_destroy_txg = zilog->zl_destroy_txg; \ + __entry->zl_replaying_seq = zilog->zl_replaying_seq; \ + __entry->zl_suspend = zilog->zl_suspend; \ + __entry->zl_suspending = zilog->zl_suspending; \ + __entry->zl_keep_first = zilog->zl_keep_first; \ + __entry->zl_replay = zilog->zl_replay; \ + __entry->zl_stop_sync = zilog->zl_stop_sync; \ + __entry->zl_logbias = zilog->zl_logbias; \ + __entry->zl_sync = zilog->zl_sync; \ + __entry->zl_parse_error = zilog->zl_parse_error; \ + __entry->zl_parse_blk_seq = zilog->zl_parse_blk_seq; \ + __entry->zl_parse_lr_seq = zilog->zl_parse_lr_seq; \ + __entry->zl_parse_blk_count = zilog->zl_parse_blk_count;\ + __entry->zl_parse_lr_count = zilog->zl_parse_lr_count; \ + __entry->zl_cur_used = zilog->zl_cur_used; \ + __entry->zl_replay_time = zilog->zl_replay_time; \ + __entry->zl_replay_blks = zilog->zl_replay_blks; + +#define ZILOG_TP_PRINTK_FMT \ + "zl { lr_seq %llu commit_lr_seq %llu destroy_txg %llu " \ + "replaying_seq %llu suspend %u suspending %u keep_first %u " \ + "replay %u stop_sync %u logbias %u sync %u " \ + "parse_error %u parse_blk_seq %llu parse_lr_seq %llu " \ + "parse_blk_count %llu parse_lr_count %llu " \ + "cur_used %llu replay_time %lu replay_blks %llu }" + +#define ZILOG_TP_PRINTK_ARGS \ + __entry->zl_lr_seq, __entry->zl_commit_lr_seq, \ + __entry->zl_destroy_txg, __entry->zl_replaying_seq, \ + __entry->zl_suspend, __entry->zl_suspending, \ + __entry->zl_keep_first, __entry->zl_replay, \ + __entry->zl_stop_sync, __entry->zl_logbias, __entry->zl_sync, \ + __entry->zl_parse_error, __entry->zl_parse_blk_seq, \ + __entry->zl_parse_lr_seq, __entry->zl_parse_blk_count, \ + __entry->zl_parse_lr_count, __entry->zl_cur_used, \ + __entry->zl_replay_time, __entry->zl_replay_blks + +#define ITX_TP_STRUCT_ENTRY \ + __field(itx_wr_state_t, itx_wr_state) \ + __field(uint8_t, itx_sync) \ + __field(zil_callback_t, itx_callback) \ + __field(void *, itx_callback_data) \ + __field(uint64_t, itx_oid) \ + \ + __field(uint64_t, lrc_txtype) \ + __field(uint64_t, lrc_reclen) \ + __field(uint64_t, lrc_txg) \ + __field(uint64_t, lrc_seq) + +#define ITX_TP_FAST_ASSIGN \ + __entry->itx_wr_state = itx->itx_wr_state; \ + __entry->itx_sync = itx->itx_sync; \ + __entry->itx_callback = itx->itx_callback; \ + __entry->itx_callback_data = itx->itx_callback_data; \ + __entry->itx_oid = itx->itx_oid; \ + \ + __entry->lrc_txtype = itx->itx_lr.lrc_txtype; \ + __entry->lrc_reclen = itx->itx_lr.lrc_reclen; \ + __entry->lrc_txg = itx->itx_lr.lrc_txg; \ + __entry->lrc_seq = itx->itx_lr.lrc_seq; + +#define ITX_TP_PRINTK_FMT \ + "itx { wr_state %u sync %u callback %p callback_data %p oid %llu" \ + " { txtype %llu reclen %llu txg %llu seq %llu } }" + +#define ITX_TP_PRINTK_ARGS \ + __entry->itx_wr_state, __entry->itx_sync, __entry->itx_callback,\ + __entry->itx_callback_data, __entry->itx_oid, \ + __entry->lrc_txtype, __entry->lrc_reclen, __entry->lrc_txg, \ + __entry->lrc_seq + +#define ZCW_TP_STRUCT_ENTRY \ + __field(lwb_t *, zcw_lwb) \ + __field(boolean_t, zcw_done) \ + __field(int, zcw_zio_error) \ + +#define ZCW_TP_FAST_ASSIGN \ + __entry->zcw_lwb = zcw->zcw_lwb; \ + __entry->zcw_done = zcw->zcw_done; \ + __entry->zcw_zio_error = zcw->zcw_zio_error; + +#define ZCW_TP_PRINTK_FMT \ + "zcw { lwb %p done %u error %u }" + +#define ZCW_TP_PRINTK_ARGS \ + __entry->zcw_lwb, __entry->zcw_done, __entry->zcw_zio_error + +/* + * Generic support for two argument tracepoints of the form: + * + * DTRACE_PROBE2(..., + * zilog_t *, ..., + * itx_t *, ...); + */ +/* BEGIN CSTYLED */ +DECLARE_EVENT_CLASS(zfs_zil_process_itx_class, + TP_PROTO(zilog_t *zilog, itx_t *itx), + TP_ARGS(zilog, itx), + TP_STRUCT__entry( + ZILOG_TP_STRUCT_ENTRY + ITX_TP_STRUCT_ENTRY + ), + TP_fast_assign( + ZILOG_TP_FAST_ASSIGN + ITX_TP_FAST_ASSIGN + ), + TP_printk( + ZILOG_TP_PRINTK_FMT " " ITX_TP_PRINTK_FMT, + ZILOG_TP_PRINTK_ARGS, ITX_TP_PRINTK_ARGS) +); +/* END CSTYLED */ + +/* BEGIN CSTYLED */ +#define DEFINE_ZIL_PROCESS_ITX_EVENT(name) \ +DEFINE_EVENT(zfs_zil_process_itx_class, name, \ + TP_PROTO(zilog_t *zilog, itx_t *itx), \ + TP_ARGS(zilog, itx)) +DEFINE_ZIL_PROCESS_ITX_EVENT(zfs_zil__process__commit__itx); +DEFINE_ZIL_PROCESS_ITX_EVENT(zfs_zil__process__normal__itx); +/* END CSTYLED */ + +/* + * Generic support for two argument tracepoints of the form: + * + * DTRACE_PROBE2(..., + * zilog_t *, ..., + * zil_commit_waiter_t *, ...); + */ +/* BEGIN CSTYLED */ +DECLARE_EVENT_CLASS(zfs_zil_commit_io_error_class, + TP_PROTO(zilog_t *zilog, zil_commit_waiter_t *zcw), + TP_ARGS(zilog, zcw), + TP_STRUCT__entry( + ZILOG_TP_STRUCT_ENTRY + ZCW_TP_STRUCT_ENTRY + ), + TP_fast_assign( + ZILOG_TP_FAST_ASSIGN + ZCW_TP_FAST_ASSIGN + ), + TP_printk( + ZILOG_TP_PRINTK_FMT " " ZCW_TP_PRINTK_FMT, + ZILOG_TP_PRINTK_ARGS, ZCW_TP_PRINTK_ARGS) +); + +/* BEGIN CSTYLED */ +#define DEFINE_ZIL_COMMIT_IO_ERROR_EVENT(name) \ +DEFINE_EVENT(zfs_zil_commit_io_error_class, name, \ + TP_PROTO(zilog_t *zilog, zil_commit_waiter_t *zcw), \ + TP_ARGS(zilog, zcw)) +DEFINE_ZIL_COMMIT_IO_ERROR_EVENT(zfs_zil__commit__io__error); +/* END CSTYLED */ + +#endif /* _TRACE_ZIL_H */ + +#undef TRACE_INCLUDE_PATH +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_PATH sys +#define TRACE_INCLUDE_FILE trace_zil +#include <trace/define_trace.h> + +#else + +DEFINE_DTRACE_PROBE2(zil__process__commit__itx); +DEFINE_DTRACE_PROBE2(zil__process__normal__itx); +DEFINE_DTRACE_PROBE2(zil__commit__io__error); + +#endif /* HAVE_DECLARE_EVENT_CLASS */ +#endif /* _KERNEL */ diff --git a/include/os/linux/zfs/sys/trace_zio.h b/include/os/linux/zfs/sys/trace_zio.h new file mode 100644 index 000000000..8655e245c --- /dev/null +++ b/include/os/linux/zfs/sys/trace_zio.h @@ -0,0 +1,97 @@ +/* + * 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 + */ + +#include <sys/list.h> + +#if defined(_KERNEL) +#if defined(HAVE_DECLARE_EVENT_CLASS) + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM zfs + +#undef TRACE_SYSTEM_VAR +#define TRACE_SYSTEM_VAR zfs_zio + +#if !defined(_TRACE_ZIO_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_ZIO_H + +#include <linux/tracepoint.h> +#include <sys/types.h> +#include <sys/trace_common.h> /* For ZIO macros */ + +/* BEGIN CSTYLED */ +TRACE_EVENT(zfs_zio__delay__miss, + TP_PROTO(zio_t *zio, hrtime_t now), + TP_ARGS(zio, now), + TP_STRUCT__entry( + ZIO_TP_STRUCT_ENTRY + __field(hrtime_t, now) + ), + TP_fast_assign( + ZIO_TP_FAST_ASSIGN + __entry->now = now; + ), + TP_printk("now %llu " ZIO_TP_PRINTK_FMT, __entry->now, + ZIO_TP_PRINTK_ARGS) +); + +TRACE_EVENT(zfs_zio__delay__hit, + TP_PROTO(zio_t *zio, hrtime_t now, hrtime_t diff), + TP_ARGS(zio, now, diff), + TP_STRUCT__entry( + ZIO_TP_STRUCT_ENTRY + __field(hrtime_t, now) + __field(hrtime_t, diff) + ), + TP_fast_assign( + ZIO_TP_FAST_ASSIGN + __entry->now = now; + __entry->diff = diff; + ), + TP_printk("now %llu diff %llu " ZIO_TP_PRINTK_FMT, __entry->now, + __entry->diff, ZIO_TP_PRINTK_ARGS) +); + +TRACE_EVENT(zfs_zio__delay__skip, + TP_PROTO(zio_t *zio), + TP_ARGS(zio), + TP_STRUCT__entry(ZIO_TP_STRUCT_ENTRY), + TP_fast_assign(ZIO_TP_FAST_ASSIGN), + TP_printk(ZIO_TP_PRINTK_FMT, ZIO_TP_PRINTK_ARGS) +); +/* END CSTYLED */ + +#endif /* _TRACE_ZIO_H */ + +#undef TRACE_INCLUDE_PATH +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_PATH sys +#define TRACE_INCLUDE_FILE trace_zio +#include <trace/define_trace.h> + +#else + +DEFINE_DTRACE_PROBE2(zio__delay__miss); +DEFINE_DTRACE_PROBE3(zio__delay__hit); +DEFINE_DTRACE_PROBE1(zio__delay__skip); + +#endif /* HAVE_DECLARE_EVENT_CLASS */ +#endif /* _KERNEL */ diff --git a/include/os/linux/zfs/sys/trace_zrlock.h b/include/os/linux/zfs/sys/trace_zrlock.h new file mode 100644 index 000000000..23f9577ba --- /dev/null +++ b/include/os/linux/zfs/sys/trace_zrlock.h @@ -0,0 +1,94 @@ +/* + * 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) +#if defined(HAVE_DECLARE_EVENT_CLASS) + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM zfs + +#undef TRACE_SYSTEM_VAR +#define TRACE_SYSTEM_VAR zfs_zrlock + +#if !defined(_TRACE_ZRLOCK_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_ZRLOCK_H + +#include <linux/tracepoint.h> +#include <sys/types.h> + +/* + * Generic support for two argument tracepoints of the form: + * + * DTRACE_PROBE2(..., + * zrlock_t *, ..., + * uint32_t, ...); + */ +/* BEGIN CSTYLED */ +DECLARE_EVENT_CLASS(zfs_zrlock_class, + TP_PROTO(zrlock_t *zrl, kthread_t *owner, uint32_t n), + TP_ARGS(zrl, owner, n), + TP_STRUCT__entry( + __field(int32_t, refcount) +#ifdef ZFS_DEBUG + __field(pid_t, owner_pid) + __field(const char *, caller) +#endif + __field(uint32_t, n) + ), + TP_fast_assign( + __entry->refcount = zrl->zr_refcount; +#ifdef ZFS_DEBUG + __entry->owner_pid = owner ? owner->pid : 0; + __entry->caller = zrl->zr_caller ? zrl->zr_caller : "(null)"; +#endif + __entry->n = n; + ), +#ifdef ZFS_DEBUG + TP_printk("zrl { refcount %d owner_pid %d caller %s } n %u", + __entry->refcount, __entry->owner_pid, __entry->caller, + __entry->n) +#else + TP_printk("zrl { refcount %d } n %u", + __entry->refcount, __entry->n) +#endif +); +/* END_CSTYLED */ + +#define DEFINE_ZRLOCK_EVENT(name) \ +DEFINE_EVENT(zfs_zrlock_class, name, \ + TP_PROTO(zrlock_t *zrl, kthread_t *owner, uint32_t n), \ + TP_ARGS(zrl, owner, n)) +DEFINE_ZRLOCK_EVENT(zfs_zrlock__reentry); + +#endif /* _TRACE_ZRLOCK_H */ + +#undef TRACE_INCLUDE_PATH +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_PATH sys +#define TRACE_INCLUDE_FILE trace_zrlock +#include <trace/define_trace.h> + +#else + +DEFINE_DTRACE_PROBE3(zrlock__reentry); + +#endif /* HAVE_DECLARE_EVENT_CLASS */ +#endif /* _KERNEL */ |