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 http://www.opensolaris.org/os/licensing.
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 #if defined(_KERNEL)
23 #if defined(HAVE_DECLARE_EVENT_CLASS)
24 
25 #undef TRACE_SYSTEM
26 #define	TRACE_SYSTEM zfs
27 
28 #undef TRACE_SYSTEM_VAR
29 #define	TRACE_SYSTEM_VAR zfs_dnode
30 
31 #if !defined(_TRACE_DNODE_H) || defined(TRACE_HEADER_MULTI_READ)
32 #define	_TRACE_DNODE_H
33 
34 #include <linux/tracepoint.h>
35 #include <sys/types.h>
36 
37 /*
38  * Generic support for three argument tracepoints of the form:
39  *
40  * DTRACE_PROBE3(...,
41  *     dnode_t *, ...,
42  *     int64_t, ...,
43  *     uint32_t, ...);
44  */
45 /* BEGIN CSTYLED */
46 DECLARE_EVENT_CLASS(zfs_dnode_move_class,
47 	TP_PROTO(dnode_t *dn, int64_t refcount, uint32_t dbufs),
48 	TP_ARGS(dn, refcount, dbufs),
49 	TP_STRUCT__entry(
50 	    __field(uint64_t,		dn_object)
51 	    __field(dmu_object_type_t,	dn_type)
52 	    __field(uint16_t,		dn_bonuslen)
53 	    __field(uint8_t,		dn_bonustype)
54 	    __field(uint8_t,		dn_nblkptr)
55 	    __field(uint8_t,		dn_checksum)
56 	    __field(uint8_t,		dn_compress)
57 	    __field(uint8_t,		dn_nlevels)
58 	    __field(uint8_t,		dn_indblkshift)
59 	    __field(uint8_t,		dn_datablkshift)
60 	    __field(uint8_t,		dn_moved)
61 	    __field(uint16_t,		dn_datablkszsec)
62 	    __field(uint32_t,		dn_datablksz)
63 	    __field(uint64_t,		dn_maxblkid)
64 	    __field(int64_t,		dn_tx_holds)
65 	    __field(int64_t,		dn_holds)
66 	    __field(boolean_t,		dn_have_spill)
67 
68 	    __field(int64_t,		refcount)
69 	    __field(uint32_t,		dbufs)
70 	),
71 	TP_fast_assign(
72 	    __entry->dn_object		= dn->dn_object;
73 	    __entry->dn_type		= dn->dn_type;
74 	    __entry->dn_bonuslen	= dn->dn_bonuslen;
75 	    __entry->dn_bonustype	= dn->dn_bonustype;
76 	    __entry->dn_nblkptr		= dn->dn_nblkptr;
77 	    __entry->dn_checksum	= dn->dn_checksum;
78 	    __entry->dn_compress	= dn->dn_compress;
79 	    __entry->dn_nlevels		= dn->dn_nlevels;
80 	    __entry->dn_indblkshift	= dn->dn_indblkshift;
81 	    __entry->dn_datablkshift	= dn->dn_datablkshift;
82 	    __entry->dn_moved		= dn->dn_moved;
83 	    __entry->dn_datablkszsec	= dn->dn_datablkszsec;
84 	    __entry->dn_datablksz	= dn->dn_datablksz;
85 	    __entry->dn_maxblkid	= dn->dn_maxblkid;
86 	    __entry->dn_tx_holds	= dn->dn_tx_holds.rc_count;
87 	    __entry->dn_holds		= dn->dn_holds.rc_count;
88 	    __entry->dn_have_spill	= dn->dn_have_spill;
89 
90 	    __entry->refcount		= refcount;
91 	    __entry->dbufs		= dbufs;
92 	),
93 	TP_printk("dn { object %llu type %d bonuslen %u bonustype %u "
94 	    "nblkptr %u checksum %u compress %u nlevels %u indblkshift %u "
95 	    "datablkshift %u moved %u datablkszsec %u datablksz %u "
96 	    "maxblkid %llu tx_holds %lli holds %lli have_spill %d } "
97 	    "refcount %lli dbufs %u",
98 	    __entry->dn_object, __entry->dn_type, __entry->dn_bonuslen,
99 	    __entry->dn_bonustype, __entry->dn_nblkptr, __entry->dn_checksum,
100 	    __entry->dn_compress, __entry->dn_nlevels, __entry->dn_indblkshift,
101 	    __entry->dn_datablkshift, __entry->dn_moved,
102 	    __entry->dn_datablkszsec, __entry->dn_datablksz,
103 	    __entry->dn_maxblkid, __entry->dn_tx_holds, __entry->dn_holds,
104 	    __entry->dn_have_spill, __entry->refcount, __entry->dbufs)
105 );
106 /* END CSTYLED */
107 
108 #define	DEFINE_DNODE_MOVE_EVENT(name) \
109 DEFINE_EVENT(zfs_dnode_move_class, name, \
110     TP_PROTO(dnode_t *dn, int64_t refcount, uint32_t dbufs), \
111     TP_ARGS(dn, refcount, dbufs))
112 DEFINE_DNODE_MOVE_EVENT(zfs_dnode__move);
113 
114 #endif /* _TRACE_DNODE_H */
115 
116 #undef TRACE_INCLUDE_PATH
117 #undef TRACE_INCLUDE_FILE
118 #define	TRACE_INCLUDE_PATH sys
119 #define	TRACE_INCLUDE_FILE trace_dnode
120 #include <trace/define_trace.h>
121 
122 #else
123 
124 DEFINE_DTRACE_PROBE3(dnode__move);
125 
126 #endif /* HAVE_DECLARE_EVENT_CLASS */
127 #endif /* _KERNEL */
128