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