]>
Commit | Line | Data |
---|---|---|
49ee64e5 NB |
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) && defined(HAVE_DECLARE_EVENT_CLASS) | |
23 | ||
24 | #undef TRACE_SYSTEM | |
25 | #define TRACE_SYSTEM zfs | |
26 | ||
c1718e95 FV |
27 | #undef TRACE_SYSTEM_VAR |
28 | #define TRACE_SYSTEM_VAR zfs_dbuf | |
29 | ||
49ee64e5 NB |
30 | #if !defined(_TRACE_DBUF_H) || defined(TRACE_HEADER_MULTI_READ) |
31 | #define _TRACE_DBUF_H | |
32 | ||
33 | #include <linux/tracepoint.h> | |
34 | #include <sys/types.h> | |
35 | ||
36 | /* | |
37 | * Generic support for two argument tracepoints of the form: | |
38 | * | |
39 | * DTRACE_PROBE2(..., | |
40 | * dmu_buf_impl_t *, ..., | |
41 | * zio_t *, ...); | |
42 | */ | |
43 | ||
44 | #define DBUF_TP_STRUCT_ENTRY \ | |
546f3843 RY |
45 | __string(os_spa, \ |
46 | spa_name(DB_DNODE(db)->dn_objset->os_spa)) \ | |
49ee64e5 NB |
47 | __field(uint64_t, ds_object) \ |
48 | __field(uint64_t, db_object) \ | |
49 | __field(uint64_t, db_level) \ | |
50 | __field(uint64_t, db_blkid) \ | |
51 | __field(uint64_t, db_offset) \ | |
52 | __field(uint64_t, db_size) \ | |
53 | __field(uint64_t, db_state) \ | |
54 | __field(int64_t, db_holds) \ | |
55 | ||
56 | #define DBUF_TP_FAST_ASSIGN \ | |
546f3843 RY |
57 | __assign_str(os_spa, \ |
58 | spa_name(DB_DNODE(db)->dn_objset->os_spa)); \ | |
49ee64e5 NB |
59 | \ |
60 | __entry->ds_object = db->db_objset->os_dsl_dataset ? \ | |
61 | db->db_objset->os_dsl_dataset->ds_object : 0; \ | |
62 | \ | |
63 | __entry->db_object = db->db.db_object; \ | |
64 | __entry->db_level = db->db_level; \ | |
65 | __entry->db_blkid = db->db_blkid; \ | |
66 | __entry->db_offset = db->db.db_offset; \ | |
67 | __entry->db_size = db->db.db_size; \ | |
68 | __entry->db_state = db->db_state; \ | |
69 | __entry->db_holds = refcount_count(&db->db_holds); | |
70 | ||
71 | #define DBUF_TP_PRINTK_FMT \ | |
72 | "dbuf { spa \"%s\" objset %llu object %llu level %llu " \ | |
73 | "blkid %llu offset %llu size %llu state %llu holds %lld }" | |
74 | ||
75 | #define DBUF_TP_PRINTK_ARGS \ | |
546f3843 | 76 | __get_str(os_spa), __entry->ds_object, \ |
49ee64e5 NB |
77 | __entry->db_object, __entry->db_level, \ |
78 | __entry->db_blkid, __entry->db_offset, \ | |
79 | __entry->db_size, __entry->db_state, __entry->db_holds | |
80 | ||
4ea3f864 | 81 | /* BEGIN CSTYLED */ |
49ee64e5 NB |
82 | DECLARE_EVENT_CLASS(zfs_dbuf_class, |
83 | TP_PROTO(dmu_buf_impl_t *db, zio_t *zio), | |
84 | TP_ARGS(db, zio), | |
85 | TP_STRUCT__entry(DBUF_TP_STRUCT_ENTRY), | |
86 | TP_fast_assign(DBUF_TP_FAST_ASSIGN), | |
87 | TP_printk(DBUF_TP_PRINTK_FMT, DBUF_TP_PRINTK_ARGS) | |
88 | ); | |
4ea3f864 | 89 | /* END CSTYLED */ |
49ee64e5 NB |
90 | |
91 | #define DEFINE_DBUF_EVENT(name) \ | |
4ea3f864 | 92 | /* BEGIN CSTYLED */ |
49ee64e5 NB |
93 | DEFINE_EVENT(zfs_dbuf_class, name, \ |
94 | TP_PROTO(dmu_buf_impl_t *db, zio_t *zio), \ | |
95 | TP_ARGS(db, zio)) | |
4ea3f864 | 96 | /* END CSTYLED */ |
49ee64e5 NB |
97 | DEFINE_DBUF_EVENT(zfs_blocked__read); |
98 | ||
4ea3f864 | 99 | /* BEGIN CSTYLED */ |
d3c2ae1c GW |
100 | DECLARE_EVENT_CLASS(zfs_dbuf_evict_one_class, |
101 | TP_PROTO(dmu_buf_impl_t *db, multilist_sublist_t *mls), | |
102 | TP_ARGS(db, mls), | |
103 | TP_STRUCT__entry(DBUF_TP_STRUCT_ENTRY), | |
104 | TP_fast_assign(DBUF_TP_FAST_ASSIGN), | |
105 | TP_printk(DBUF_TP_PRINTK_FMT, DBUF_TP_PRINTK_ARGS) | |
106 | ); | |
4ea3f864 | 107 | /* END CSTYLED */ |
d3c2ae1c GW |
108 | |
109 | #define DEFINE_DBUF_EVICT_ONE_EVENT(name) \ | |
4ea3f864 | 110 | /* BEGIN CSTYLED */ |
d3c2ae1c GW |
111 | DEFINE_EVENT(zfs_dbuf_evict_one_class, name, \ |
112 | TP_PROTO(dmu_buf_impl_t *db, multilist_sublist_t *mls), \ | |
113 | TP_ARGS(db, mls)) | |
4ea3f864 | 114 | /* END CSTYLED */ |
d3c2ae1c GW |
115 | DEFINE_DBUF_EVICT_ONE_EVENT(zfs_dbuf__evict__one); |
116 | ||
49ee64e5 NB |
117 | #endif /* _TRACE_DBUF_H */ |
118 | ||
119 | #undef TRACE_INCLUDE_PATH | |
120 | #undef TRACE_INCLUDE_FILE | |
121 | #define TRACE_INCLUDE_PATH sys | |
122 | #define TRACE_INCLUDE_FILE trace_dbuf | |
123 | #include <trace/define_trace.h> | |
124 | ||
125 | #endif /* _KERNEL && HAVE_DECLARE_EVENT_CLASS */ |