1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2009-2019 Christoph Hellwig
5 * NOTE: none of these tracepoints shall be consider a stable kernel ABI
6 * as they can change at any time.
9 #define TRACE_SYSTEM iomap
11 #if !defined(_IOMAP_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
12 #define _IOMAP_TRACE_H
14 #include <linux/tracepoint.h>
18 DECLARE_EVENT_CLASS(iomap_readpage_class
,
19 TP_PROTO(struct inode
*inode
, int nr_pages
),
20 TP_ARGS(inode
, nr_pages
),
24 __field(int, nr_pages
)
27 __entry
->dev
= inode
->i_sb
->s_dev
;
28 __entry
->ino
= inode
->i_ino
;
29 __entry
->nr_pages
= nr_pages
;
31 TP_printk("dev %d:%d ino 0x%llx nr_pages %d",
32 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
37 #define DEFINE_READPAGE_EVENT(name) \
38 DEFINE_EVENT(iomap_readpage_class, name, \
39 TP_PROTO(struct inode *inode, int nr_pages), \
40 TP_ARGS(inode, nr_pages))
41 DEFINE_READPAGE_EVENT(iomap_readpage
);
42 DEFINE_READPAGE_EVENT(iomap_readahead
);
44 DECLARE_EVENT_CLASS(iomap_range_class
,
45 TP_PROTO(struct inode
*inode
, unsigned long off
, unsigned int len
),
46 TP_ARGS(inode
, off
, len
),
51 __field(unsigned long, offset
)
52 __field(unsigned int, length
)
55 __entry
->dev
= inode
->i_sb
->s_dev
;
56 __entry
->ino
= inode
->i_ino
;
57 __entry
->size
= i_size_read(inode
);
58 __entry
->offset
= off
;
59 __entry
->length
= len
;
61 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset %lx "
63 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
70 #define DEFINE_RANGE_EVENT(name) \
71 DEFINE_EVENT(iomap_range_class, name, \
72 TP_PROTO(struct inode *inode, unsigned long off, unsigned int len),\
73 TP_ARGS(inode, off, len))
74 DEFINE_RANGE_EVENT(iomap_writepage
);
75 DEFINE_RANGE_EVENT(iomap_releasepage
);
76 DEFINE_RANGE_EVENT(iomap_invalidatepage
);
77 DEFINE_RANGE_EVENT(iomap_dio_invalidate_fail
);
79 #define IOMAP_TYPE_STRINGS \
80 { IOMAP_HOLE, "HOLE" }, \
81 { IOMAP_DELALLOC, "DELALLOC" }, \
82 { IOMAP_MAPPED, "MAPPED" }, \
83 { IOMAP_UNWRITTEN, "UNWRITTEN" }, \
84 { IOMAP_INLINE, "INLINE" }
86 #define IOMAP_FLAGS_STRINGS \
87 { IOMAP_WRITE, "WRITE" }, \
88 { IOMAP_ZERO, "ZERO" }, \
89 { IOMAP_REPORT, "REPORT" }, \
90 { IOMAP_FAULT, "FAULT" }, \
91 { IOMAP_DIRECT, "DIRECT" }, \
92 { IOMAP_NOWAIT, "NOWAIT" }
94 #define IOMAP_F_FLAGS_STRINGS \
95 { IOMAP_F_NEW, "NEW" }, \
96 { IOMAP_F_DIRTY, "DIRTY" }, \
97 { IOMAP_F_SHARED, "SHARED" }, \
98 { IOMAP_F_MERGED, "MERGED" }, \
99 { IOMAP_F_BUFFER_HEAD, "BH" }, \
100 { IOMAP_F_SIZE_CHANGED, "SIZE_CHANGED" }
102 DECLARE_EVENT_CLASS(iomap_class
,
103 TP_PROTO(struct inode
*inode
, struct iomap
*iomap
),
104 TP_ARGS(inode
, iomap
),
109 __field(loff_t
, offset
)
116 __entry
->dev
= inode
->i_sb
->s_dev
;
117 __entry
->ino
= inode
->i_ino
;
118 __entry
->addr
= iomap
->addr
;
119 __entry
->offset
= iomap
->offset
;
120 __entry
->length
= iomap
->length
;
121 __entry
->type
= iomap
->type
;
122 __entry
->flags
= iomap
->flags
;
123 __entry
->bdev
= iomap
->bdev
? iomap
->bdev
->bd_dev
: 0;
125 TP_printk("dev %d:%d ino 0x%llx bdev %d:%d addr %lld offset %lld "
126 "length %llu type %s flags %s",
127 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
129 MAJOR(__entry
->bdev
), MINOR(__entry
->bdev
),
133 __print_symbolic(__entry
->type
, IOMAP_TYPE_STRINGS
),
134 __print_flags(__entry
->flags
, "|", IOMAP_F_FLAGS_STRINGS
))
137 #define DEFINE_IOMAP_EVENT(name) \
138 DEFINE_EVENT(iomap_class, name, \
139 TP_PROTO(struct inode *inode, struct iomap *iomap), \
140 TP_ARGS(inode, iomap))
141 DEFINE_IOMAP_EVENT(iomap_apply_dstmap
);
142 DEFINE_IOMAP_EVENT(iomap_apply_srcmap
);
144 TRACE_EVENT(iomap_apply
,
145 TP_PROTO(struct inode
*inode
, loff_t pos
, loff_t length
,
146 unsigned int flags
, const void *ops
, void *actor
,
147 unsigned long caller
),
148 TP_ARGS(inode
, pos
, length
, flags
, ops
, actor
, caller
),
153 __field(loff_t
, length
)
154 __field(unsigned int, flags
)
155 __field(const void *, ops
)
156 __field(void *, actor
)
157 __field(unsigned long, caller
)
160 __entry
->dev
= inode
->i_sb
->s_dev
;
161 __entry
->ino
= inode
->i_ino
;
163 __entry
->length
= length
;
164 __entry
->flags
= flags
;
166 __entry
->actor
= actor
;
167 __entry
->caller
= caller
;
169 TP_printk("dev %d:%d ino 0x%llx pos %lld length %lld flags %s (0x%x) "
170 "ops %ps caller %pS actor %ps",
171 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
175 __print_flags(__entry
->flags
, "|", IOMAP_FLAGS_STRINGS
),
178 (void *)__entry
->caller
,
182 #endif /* _IOMAP_TRACE_H */
184 #undef TRACE_INCLUDE_PATH
185 #define TRACE_INCLUDE_PATH .
186 #define TRACE_INCLUDE_FILE trace
187 #include <trace/define_trace.h>