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(int,			zio_cmd)		\
35 		__field(zio_priority_t,		zio_priority)		\
36 		__field(uint64_t,		zio_size)		\
37 		__field(uint64_t,		zio_orig_size)		\
38 		__field(uint64_t,		zio_offset)		\
39 		__field(hrtime_t,		zio_timestamp)		\
40 		__field(hrtime_t,		zio_delta)		\
41 		__field(uint64_t,		zio_delay)		\
42 		__field(enum zio_flag,		zio_flags)		\
43 		__field(enum zio_stage,		zio_stage)		\
44 		__field(enum zio_stage,		zio_pipeline)		\
45 		__field(enum zio_flag,		zio_orig_flags)		\
46 		__field(enum zio_stage,		zio_orig_stage)		\
47 		__field(enum zio_stage,		zio_orig_pipeline)	\
48 		__field(uint8_t,		zio_reexecute)		\
49 		__field(uint64_t,		zio_txg)		\
50 		__field(int,			zio_error)		\
51 		__field(uint64_t,		zio_ena)		\
52 									\
53 		__field(enum zio_checksum,	zp_checksum)		\
54 		__field(enum zio_compress,	zp_compress)		\
55 		__field(dmu_object_type_t,	zp_type)		\
56 		__field(uint8_t,		zp_level)		\
57 		__field(uint8_t,		zp_copies)		\
58 		__field(boolean_t,		zp_dedup)		\
59 		__field(boolean_t,		zp_dedup_verify)	\
60 		__field(boolean_t,		zp_nopwrite)
61 
62 #define	ZIO_TP_FAST_ASSIGN						    \
63 		__entry->zio_type		= zio->io_type;		    \
64 		__entry->zio_cmd		= zio->io_cmd;		    \
65 		__entry->zio_priority		= zio->io_priority;	    \
66 		__entry->zio_size		= zio->io_size;		    \
67 		__entry->zio_orig_size		= zio->io_orig_size;	    \
68 		__entry->zio_offset		= zio->io_offset;	    \
69 		__entry->zio_timestamp		= zio->io_timestamp;	    \
70 		__entry->zio_delta		= zio->io_delta;	    \
71 		__entry->zio_delay		= zio->io_delay;	    \
72 		__entry->zio_flags		= zio->io_flags;	    \
73 		__entry->zio_stage		= zio->io_stage;	    \
74 		__entry->zio_pipeline		= zio->io_pipeline;	    \
75 		__entry->zio_orig_flags		= zio->io_orig_flags;	    \
76 		__entry->zio_orig_stage		= zio->io_orig_stage;	    \
77 		__entry->zio_orig_pipeline	= zio->io_orig_pipeline;    \
78 		__entry->zio_reexecute		= zio->io_reexecute;	    \
79 		__entry->zio_txg		= zio->io_txg;		    \
80 		__entry->zio_error		= zio->io_error;	    \
81 		__entry->zio_ena		= zio->io_ena;		    \
82 									    \
83 		__entry->zp_checksum		= zio->io_prop.zp_checksum; \
84 		__entry->zp_compress		= zio->io_prop.zp_compress; \
85 		__entry->zp_type		= zio->io_prop.zp_type;	    \
86 		__entry->zp_level		= zio->io_prop.zp_level;    \
87 		__entry->zp_copies		= zio->io_prop.zp_copies;   \
88 		__entry->zp_dedup		= zio->io_prop.zp_dedup;    \
89 		__entry->zp_nopwrite		= zio->io_prop.zp_nopwrite; \
90 		__entry->zp_dedup_verify	= zio->io_prop.zp_dedup_verify;
91 
92 #define	ZIO_TP_PRINTK_FMT						\
93 	"zio { type %u cmd %i prio %u size %llu orig_size %llu "	\
94 	"offset %llu timestamp %llu delta %llu delay %llu "		\
95 	"flags 0x%x stage 0x%x pipeline 0x%x orig_flags 0x%x "		\
96 	"orig_stage 0x%x orig_pipeline 0x%x reexecute %u "		\
97 	"txg %llu error %d ena %llu prop { checksum %u compress %u "	\
98 	"type %u level %u copies %u dedup %u dedup_verify %u nopwrite %u } }"
99 
100 #define	ZIO_TP_PRINTK_ARGS						\
101 	__entry->zio_type, __entry->zio_cmd, __entry->zio_priority,	\
102 	__entry->zio_size, __entry->zio_orig_size, __entry->zio_offset,	\
103 	__entry->zio_timestamp, __entry->zio_delta, __entry->zio_delay,	\
104 	__entry->zio_flags, __entry->zio_stage, __entry->zio_pipeline,	\
105 	__entry->zio_orig_flags, __entry->zio_orig_stage,		\
106 	__entry->zio_orig_pipeline, __entry->zio_reexecute,		\
107 	__entry->zio_txg, __entry->zio_error, __entry->zio_ena,		\
108 	__entry->zp_checksum, __entry->zp_compress, __entry->zp_type,	\
109 	__entry->zp_level, __entry->zp_copies, __entry->zp_dedup,	\
110 	__entry->zp_dedup_verify, __entry->zp_nopwrite
111 
112 #endif /* _SYS_TRACE_COMMON_H */
113