]> git.proxmox.com Git - mirror_zfs-debian.git/blob - include/sys/trace_dbuf.h
Imported Upstream version 0.6.4.2
[mirror_zfs-debian.git] / include / sys / trace_dbuf.h
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
27 #if !defined(_TRACE_DBUF_H) || defined(TRACE_HEADER_MULTI_READ)
28 #define _TRACE_DBUF_H
29
30 #include <linux/tracepoint.h>
31 #include <sys/types.h>
32
33 /*
34 * Generic support for two argument tracepoints of the form:
35 *
36 * DTRACE_PROBE2(...,
37 * dmu_buf_impl_t *, ...,
38 * zio_t *, ...);
39 */
40
41 #define DBUF_TP_STRUCT_ENTRY \
42 __field(const char *, os_spa) \
43 __field(uint64_t, ds_object) \
44 __field(uint64_t, db_object) \
45 __field(uint64_t, db_level) \
46 __field(uint64_t, db_blkid) \
47 __field(uint64_t, db_offset) \
48 __field(uint64_t, db_size) \
49 __field(uint64_t, db_state) \
50 __field(int64_t, db_holds) \
51
52 #define DBUF_TP_FAST_ASSIGN \
53 __entry->os_spa = \
54 spa_name(DB_DNODE(db)->dn_objset->os_spa); \
55 \
56 __entry->ds_object = db->db_objset->os_dsl_dataset ? \
57 db->db_objset->os_dsl_dataset->ds_object : 0; \
58 \
59 __entry->db_object = db->db.db_object; \
60 __entry->db_level = db->db_level; \
61 __entry->db_blkid = db->db_blkid; \
62 __entry->db_offset = db->db.db_offset; \
63 __entry->db_size = db->db.db_size; \
64 __entry->db_state = db->db_state; \
65 __entry->db_holds = refcount_count(&db->db_holds);
66
67 #define DBUF_TP_PRINTK_FMT \
68 "dbuf { spa \"%s\" objset %llu object %llu level %llu " \
69 "blkid %llu offset %llu size %llu state %llu holds %lld }"
70
71 #define DBUF_TP_PRINTK_ARGS \
72 __entry->os_spa, __entry->ds_object, \
73 __entry->db_object, __entry->db_level, \
74 __entry->db_blkid, __entry->db_offset, \
75 __entry->db_size, __entry->db_state, __entry->db_holds
76
77 DECLARE_EVENT_CLASS(zfs_dbuf_class,
78 TP_PROTO(dmu_buf_impl_t *db, zio_t *zio),
79 TP_ARGS(db, zio),
80 TP_STRUCT__entry(DBUF_TP_STRUCT_ENTRY),
81 TP_fast_assign(DBUF_TP_FAST_ASSIGN),
82 TP_printk(DBUF_TP_PRINTK_FMT, DBUF_TP_PRINTK_ARGS)
83 );
84
85 #define DEFINE_DBUF_EVENT(name) \
86 DEFINE_EVENT(zfs_dbuf_class, name, \
87 TP_PROTO(dmu_buf_impl_t *db, zio_t *zio), \
88 TP_ARGS(db, zio))
89 DEFINE_DBUF_EVENT(zfs_blocked__read);
90
91 #endif /* _TRACE_DBUF_H */
92
93 #undef TRACE_INCLUDE_PATH
94 #undef TRACE_INCLUDE_FILE
95 #define TRACE_INCLUDE_PATH sys
96 #define TRACE_INCLUDE_FILE trace_dbuf
97 #include <trace/define_trace.h>
98
99 #endif /* _KERNEL && HAVE_DECLARE_EVENT_CLASS */