xref: /freebsd/sys/contrib/openzfs/include/os/linux/zfs/sys/trace_common.h (revision 1719886f6d08408b834d270c59ffcfd821c8f63a)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or https://opensource.org/licenses/CDDL-1.0.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * This file contains commonly used trace macros.  Feel free to add and use
24  * them in your tracepoint headers.
25  */
26 
27 #ifndef	_SYS_TRACE_COMMON_H
28 #define	_SYS_TRACE_COMMON_H
29 #include <linux/tracepoint.h>
30 
31 /* ZIO macros */
32 #define	ZIO_TP_STRUCT_ENTRY						\
33 		__field(zio_type_t,		zio_type)		\
34 		__field(zio_priority_t,		zio_priority)		\
35 		__field(uint64_t,		zio_size)		\
36 		__field(uint64_t,		zio_orig_size)		\
37 		__field(uint64_t,		zio_offset)		\
38 		__field(hrtime_t,		zio_timestamp)		\
39 		__field(hrtime_t,		zio_delta)		\
40 		__field(uint64_t,		zio_delay)		\
41 		__field(zio_flag_t,		zio_flags)		\
42 		__field(enum zio_stage,		zio_stage)		\
43 		__field(enum zio_stage,		zio_pipeline)		\
44 		__field(zio_flag_t,		zio_orig_flags)		\
45 		__field(enum zio_stage,		zio_orig_stage)		\
46 		__field(enum zio_stage,		zio_orig_pipeline)	\
47 		__field(uint8_t,		zio_reexecute)		\
48 		__field(uint64_t,		zio_txg)		\
49 		__field(int,			zio_error)		\
50 		__field(uint64_t,		zio_ena)		\
51 									\
52 		__field(enum zio_checksum,	zp_checksum)		\
53 		__field(enum zio_compress,	zp_compress)		\
54 		__field(dmu_object_type_t,	zp_type)		\
55 		__field(uint8_t,		zp_level)		\
56 		__field(uint8_t,		zp_copies)		\
57 		__field(boolean_t,		zp_dedup)		\
58 		__field(boolean_t,		zp_dedup_verify)	\
59 		__field(boolean_t,		zp_nopwrite)
60 
61 #define	ZIO_TP_FAST_ASSIGN						    \
62 		__entry->zio_type		= zio->io_type;		    \
63 		__entry->zio_priority		= zio->io_priority;	    \
64 		__entry->zio_size		= zio->io_size;		    \
65 		__entry->zio_orig_size		= zio->io_orig_size;	    \
66 		__entry->zio_offset		= zio->io_offset;	    \
67 		__entry->zio_timestamp		= zio->io_timestamp;	    \
68 		__entry->zio_delta		= zio->io_delta;	    \
69 		__entry->zio_delay		= zio->io_delay;	    \
70 		__entry->zio_flags		= zio->io_flags;	    \
71 		__entry->zio_stage		= zio->io_stage;	    \
72 		__entry->zio_pipeline		= zio->io_pipeline;	    \
73 		__entry->zio_orig_flags		= zio->io_orig_flags;	    \
74 		__entry->zio_orig_stage		= zio->io_orig_stage;	    \
75 		__entry->zio_orig_pipeline	= zio->io_orig_pipeline;    \
76 		__entry->zio_reexecute		= zio->io_reexecute;	    \
77 		__entry->zio_txg		= zio->io_txg;		    \
78 		__entry->zio_error		= zio->io_error;	    \
79 		__entry->zio_ena		= zio->io_ena;		    \
80 									    \
81 		__entry->zp_checksum		= zio->io_prop.zp_checksum; \
82 		__entry->zp_compress		= zio->io_prop.zp_compress; \
83 		__entry->zp_type		= zio->io_prop.zp_type;	    \
84 		__entry->zp_level		= zio->io_prop.zp_level;    \
85 		__entry->zp_copies		= zio->io_prop.zp_copies;   \
86 		__entry->zp_dedup		= zio->io_prop.zp_dedup;    \
87 		__entry->zp_nopwrite		= zio->io_prop.zp_nopwrite; \
88 		__entry->zp_dedup_verify	= zio->io_prop.zp_dedup_verify;
89 
90 #define	ZIO_TP_PRINTK_FMT						\
91 	"zio { type %u prio %u size %llu orig_size %llu "		\
92 	"offset %llu timestamp %llu delta %llu delay %llu "		\
93 	"flags 0x%llx stage 0x%x pipeline 0x%x orig_flags 0x%llx "	\
94 	"orig_stage 0x%x orig_pipeline 0x%x reexecute %u "		\
95 	"txg %llu error %d ena %llu prop { checksum %u compress %u "	\
96 	"type %u level %u copies %u dedup %u dedup_verify %u nopwrite %u } }"
97 
98 #define	ZIO_TP_PRINTK_ARGS						\
99 	__entry->zio_type, __entry->zio_priority,			\
100 	__entry->zio_size, __entry->zio_orig_size, __entry->zio_offset,	\
101 	__entry->zio_timestamp, __entry->zio_delta, __entry->zio_delay,	\
102 	__entry->zio_flags, __entry->zio_stage, __entry->zio_pipeline,	\
103 	__entry->zio_orig_flags, __entry->zio_orig_stage,		\
104 	__entry->zio_orig_pipeline, __entry->zio_reexecute,		\
105 	__entry->zio_txg, __entry->zio_error, __entry->zio_ena,		\
106 	__entry->zp_checksum, __entry->zp_compress, __entry->zp_type,	\
107 	__entry->zp_level, __entry->zp_copies, __entry->zp_dedup,	\
108 	__entry->zp_dedup_verify, __entry->zp_nopwrite
109 
110 #endif /* _SYS_TRACE_COMMON_H */
111