1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2009-2021 Christoph Hellwig
5 * NOTE: none of these tracepoints shall be considered a stable kernel ABI
6 * as they can change at any time.
8 * Current conventions for printing numbers measuring specific units:
10 * offset: byte offset into a subcomponent of a file operation
11 * pos: file offset, in bytes
12 * length: length of a file operation, in bytes
15 * Numbers describing space allocations should be formatted in hexadecimal.
18 #define TRACE_SYSTEM iomap
20 #if !defined(_IOMAP_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
21 #define _IOMAP_TRACE_H
23 #include <linux/tracepoint.h>
27 DECLARE_EVENT_CLASS(iomap_readpage_class
,
28 TP_PROTO(struct inode
*inode
, int nr_pages
),
29 TP_ARGS(inode
, nr_pages
),
33 __field(int, nr_pages
)
36 __entry
->dev
= inode
->i_sb
->s_dev
;
37 __entry
->ino
= inode
->i_ino
;
38 __entry
->nr_pages
= nr_pages
;
40 TP_printk("dev %d:%d ino 0x%llx nr_pages %d",
41 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
46 #define DEFINE_READPAGE_EVENT(name) \
47 DEFINE_EVENT(iomap_readpage_class, name, \
48 TP_PROTO(struct inode *inode, int nr_pages), \
49 TP_ARGS(inode, nr_pages))
50 DEFINE_READPAGE_EVENT(iomap_readpage
);
51 DEFINE_READPAGE_EVENT(iomap_readahead
);
53 DECLARE_EVENT_CLASS(iomap_range_class
,
54 TP_PROTO(struct inode
*inode
, loff_t off
, u64 len
),
55 TP_ARGS(inode
, off
, len
),
60 __field(loff_t
, offset
)
64 __entry
->dev
= inode
->i_sb
->s_dev
;
65 __entry
->ino
= inode
->i_ino
;
66 __entry
->size
= i_size_read(inode
);
67 __entry
->offset
= off
;
68 __entry
->length
= len
;
70 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx length 0x%llx",
71 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
78 #define DEFINE_RANGE_EVENT(name) \
79 DEFINE_EVENT(iomap_range_class, name, \
80 TP_PROTO(struct inode *inode, loff_t off, u64 len),\
81 TP_ARGS(inode, off, len))
82 DEFINE_RANGE_EVENT(iomap_writepage
);
83 DEFINE_RANGE_EVENT(iomap_release_folio
);
84 DEFINE_RANGE_EVENT(iomap_invalidate_folio
);
85 DEFINE_RANGE_EVENT(iomap_dio_invalidate_fail
);
86 DEFINE_RANGE_EVENT(iomap_dio_rw_queued
);
88 #define IOMAP_TYPE_STRINGS \
89 { IOMAP_HOLE, "HOLE" }, \
90 { IOMAP_DELALLOC, "DELALLOC" }, \
91 { IOMAP_MAPPED, "MAPPED" }, \
92 { IOMAP_UNWRITTEN, "UNWRITTEN" }, \
93 { IOMAP_INLINE, "INLINE" }
95 #define IOMAP_FLAGS_STRINGS \
96 { IOMAP_WRITE, "WRITE" }, \
97 { IOMAP_ZERO, "ZERO" }, \
98 { IOMAP_REPORT, "REPORT" }, \
99 { IOMAP_FAULT, "FAULT" }, \
100 { IOMAP_DIRECT, "DIRECT" }, \
101 { IOMAP_NOWAIT, "NOWAIT" }, \
102 { IOMAP_ATOMIC, "ATOMIC" }
104 #define IOMAP_F_FLAGS_STRINGS \
105 { IOMAP_F_NEW, "NEW" }, \
106 { IOMAP_F_DIRTY, "DIRTY" }, \
107 { IOMAP_F_SHARED, "SHARED" }, \
108 { IOMAP_F_MERGED, "MERGED" }, \
109 { IOMAP_F_BUFFER_HEAD, "BH" }, \
110 { IOMAP_F_SIZE_CHANGED, "SIZE_CHANGED" }
112 #define IOMAP_DIO_STRINGS \
113 {IOMAP_DIO_FORCE_WAIT, "DIO_FORCE_WAIT" }, \
114 {IOMAP_DIO_OVERWRITE_ONLY, "DIO_OVERWRITE_ONLY" }, \
115 {IOMAP_DIO_PARTIAL, "DIO_PARTIAL" }
117 DECLARE_EVENT_CLASS(iomap_class
,
118 TP_PROTO(struct inode
*inode
, struct iomap
*iomap
),
119 TP_ARGS(inode
, iomap
),
124 __field(loff_t
, offset
)
131 __entry
->dev
= inode
->i_sb
->s_dev
;
132 __entry
->ino
= inode
->i_ino
;
133 __entry
->addr
= iomap
->addr
;
134 __entry
->offset
= iomap
->offset
;
135 __entry
->length
= iomap
->length
;
136 __entry
->type
= iomap
->type
;
137 __entry
->flags
= iomap
->flags
;
138 __entry
->bdev
= iomap
->bdev
? iomap
->bdev
->bd_dev
: 0;
140 TP_printk("dev %d:%d ino 0x%llx bdev %d:%d addr 0x%llx offset 0x%llx "
141 "length 0x%llx type %s flags %s",
142 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
144 MAJOR(__entry
->bdev
), MINOR(__entry
->bdev
),
148 __print_symbolic(__entry
->type
, IOMAP_TYPE_STRINGS
),
149 __print_flags(__entry
->flags
, "|", IOMAP_F_FLAGS_STRINGS
))
152 #define DEFINE_IOMAP_EVENT(name) \
153 DEFINE_EVENT(iomap_class, name, \
154 TP_PROTO(struct inode *inode, struct iomap *iomap), \
155 TP_ARGS(inode, iomap))
156 DEFINE_IOMAP_EVENT(iomap_iter_dstmap
);
157 DEFINE_IOMAP_EVENT(iomap_iter_srcmap
);
159 TRACE_EVENT(iomap_writepage_map
,
160 TP_PROTO(struct inode
*inode
, u64 pos
, unsigned int dirty_len
,
161 struct iomap
*iomap
),
162 TP_ARGS(inode
, pos
, dirty_len
, iomap
),
167 __field(u64
, dirty_len
)
169 __field(loff_t
, offset
)
176 __entry
->dev
= inode
->i_sb
->s_dev
;
177 __entry
->ino
= inode
->i_ino
;
179 __entry
->dirty_len
= dirty_len
;
180 __entry
->addr
= iomap
->addr
;
181 __entry
->offset
= iomap
->offset
;
182 __entry
->length
= iomap
->length
;
183 __entry
->type
= iomap
->type
;
184 __entry
->flags
= iomap
->flags
;
185 __entry
->bdev
= iomap
->bdev
? iomap
->bdev
->bd_dev
: 0;
187 TP_printk("dev %d:%d ino 0x%llx bdev %d:%d pos 0x%llx dirty len 0x%llx "
188 "addr 0x%llx offset 0x%llx length 0x%llx type %s flags %s",
189 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
191 MAJOR(__entry
->bdev
), MINOR(__entry
->bdev
),
197 __print_symbolic(__entry
->type
, IOMAP_TYPE_STRINGS
),
198 __print_flags(__entry
->flags
, "|", IOMAP_F_FLAGS_STRINGS
))
201 TRACE_EVENT(iomap_iter
,
202 TP_PROTO(struct iomap_iter
*iter
, const void *ops
,
203 unsigned long caller
),
204 TP_ARGS(iter
, ops
, caller
),
210 __field(s64
, processed
)
211 __field(unsigned int, flags
)
212 __field(const void *, ops
)
213 __field(unsigned long, caller
)
216 __entry
->dev
= iter
->inode
->i_sb
->s_dev
;
217 __entry
->ino
= iter
->inode
->i_ino
;
218 __entry
->pos
= iter
->pos
;
219 __entry
->length
= iomap_length(iter
);
220 __entry
->processed
= iter
->processed
;
221 __entry
->flags
= iter
->flags
;
223 __entry
->caller
= caller
;
225 TP_printk("dev %d:%d ino 0x%llx pos 0x%llx length 0x%llx processed %lld flags %s (0x%x) ops %ps caller %pS",
226 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
231 __print_flags(__entry
->flags
, "|", IOMAP_FLAGS_STRINGS
),
234 (void *)__entry
->caller
)
237 TRACE_EVENT(iomap_dio_rw_begin
,
238 TP_PROTO(struct kiocb
*iocb
, struct iov_iter
*iter
,
239 unsigned int dio_flags
, size_t done_before
),
240 TP_ARGS(iocb
, iter
, dio_flags
, done_before
),
244 __field(loff_t
, isize
)
246 __field(size_t, count
)
247 __field(size_t, done_before
)
248 __field(int, ki_flags
)
249 __field(unsigned int, dio_flags
)
253 __entry
->dev
= file_inode(iocb
->ki_filp
)->i_sb
->s_dev
;
254 __entry
->ino
= file_inode(iocb
->ki_filp
)->i_ino
;
255 __entry
->isize
= file_inode(iocb
->ki_filp
)->i_size
;
256 __entry
->pos
= iocb
->ki_pos
;
257 __entry
->count
= iov_iter_count(iter
);
258 __entry
->done_before
= done_before
;
259 __entry
->ki_flags
= iocb
->ki_flags
;
260 __entry
->dio_flags
= dio_flags
;
261 __entry
->aio
= !is_sync_kiocb(iocb
);
263 TP_printk("dev %d:%d ino 0x%lx size 0x%llx offset 0x%llx length 0x%zx done_before 0x%zx flags %s dio_flags %s aio %d",
264 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
269 __entry
->done_before
,
270 __print_flags(__entry
->ki_flags
, "|", TRACE_IOCB_STRINGS
),
271 __print_flags(__entry
->dio_flags
, "|", IOMAP_DIO_STRINGS
),
275 TRACE_EVENT(iomap_dio_complete
,
276 TP_PROTO(struct kiocb
*iocb
, int error
, ssize_t ret
),
277 TP_ARGS(iocb
, error
, ret
),
281 __field(loff_t
, isize
)
283 __field(int, ki_flags
)
286 __field(ssize_t
, ret
)
289 __entry
->dev
= file_inode(iocb
->ki_filp
)->i_sb
->s_dev
;
290 __entry
->ino
= file_inode(iocb
->ki_filp
)->i_ino
;
291 __entry
->isize
= file_inode(iocb
->ki_filp
)->i_size
;
292 __entry
->pos
= iocb
->ki_pos
;
293 __entry
->ki_flags
= iocb
->ki_flags
;
294 __entry
->aio
= !is_sync_kiocb(iocb
);
295 __entry
->error
= error
;
298 TP_printk("dev %d:%d ino 0x%lx size 0x%llx offset 0x%llx flags %s aio %d error %d ret %zd",
299 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
303 __print_flags(__entry
->ki_flags
, "|", TRACE_IOCB_STRINGS
),
309 #endif /* _IOMAP_TRACE_H */
311 #undef TRACE_INCLUDE_PATH
312 #define TRACE_INCLUDE_PATH .
313 #define TRACE_INCLUDE_FILE trace
314 #include <trace/define_trace.h>