Line data Source code
1 : /* SPDX-License-Identifier: GPL-2.0 */
2 : /*
3 : * Copyright (c) 2009-2019 Christoph Hellwig
4 : *
5 : * NOTE: none of these tracepoints shall be consider a stable kernel ABI
6 : * as they can change at any time.
7 : */
8 : #undef TRACE_SYSTEM
9 : #define TRACE_SYSTEM iomap
10 :
11 : #if !defined(_IOMAP_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
12 : #define _IOMAP_TRACE_H
13 :
14 : #include <linux/tracepoint.h>
15 :
16 : struct inode;
17 :
18 0 : DECLARE_EVENT_CLASS(iomap_readpage_class,
19 : TP_PROTO(struct inode *inode, int nr_pages),
20 : TP_ARGS(inode, nr_pages),
21 : TP_STRUCT__entry(
22 : __field(dev_t, dev)
23 : __field(u64, ino)
24 : __field(int, nr_pages)
25 : ),
26 : TP_fast_assign(
27 : __entry->dev = inode->i_sb->s_dev;
28 : __entry->ino = inode->i_ino;
29 : __entry->nr_pages = nr_pages;
30 : ),
31 : TP_printk("dev %d:%d ino 0x%llx nr_pages %d",
32 : MAJOR(__entry->dev), MINOR(__entry->dev),
33 : __entry->ino,
34 : __entry->nr_pages)
35 : )
36 :
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 0 : DEFINE_READPAGE_EVENT(iomap_readpage);
42 0 : DEFINE_READPAGE_EVENT(iomap_readahead);
43 :
44 0 : DECLARE_EVENT_CLASS(iomap_range_class,
45 : TP_PROTO(struct inode *inode, unsigned long off, unsigned int len),
46 : TP_ARGS(inode, off, len),
47 : TP_STRUCT__entry(
48 : __field(dev_t, dev)
49 : __field(u64, ino)
50 : __field(loff_t, size)
51 : __field(unsigned long, offset)
52 : __field(unsigned int, length)
53 : ),
54 : TP_fast_assign(
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;
60 : ),
61 : TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset %lx "
62 : "length %x",
63 : MAJOR(__entry->dev), MINOR(__entry->dev),
64 : __entry->ino,
65 : __entry->size,
66 : __entry->offset,
67 : __entry->length)
68 : )
69 :
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 0 : DEFINE_RANGE_EVENT(iomap_writepage);
75 0 : DEFINE_RANGE_EVENT(iomap_releasepage);
76 0 : DEFINE_RANGE_EVENT(iomap_invalidatepage);
77 0 : DEFINE_RANGE_EVENT(iomap_dio_invalidate_fail);
78 :
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" }
85 :
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" }
93 :
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" }
101 :
102 0 : DECLARE_EVENT_CLASS(iomap_class,
103 : TP_PROTO(struct inode *inode, struct iomap *iomap),
104 : TP_ARGS(inode, iomap),
105 : TP_STRUCT__entry(
106 : __field(dev_t, dev)
107 : __field(u64, ino)
108 : __field(u64, addr)
109 : __field(loff_t, offset)
110 : __field(u64, length)
111 : __field(u16, type)
112 : __field(u16, flags)
113 : __field(dev_t, bdev)
114 : ),
115 : TP_fast_assign(
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;
124 : ),
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),
128 : __entry->ino,
129 : MAJOR(__entry->bdev), MINOR(__entry->bdev),
130 : __entry->addr,
131 : __entry->offset,
132 : __entry->length,
133 : __print_symbolic(__entry->type, IOMAP_TYPE_STRINGS),
134 : __print_flags(__entry->flags, "|", IOMAP_F_FLAGS_STRINGS))
135 : )
136 :
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 3896 : DEFINE_IOMAP_EVENT(iomap_apply_dstmap);
142 0 : DEFINE_IOMAP_EVENT(iomap_apply_srcmap);
143 :
144 3896 : 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),
149 : TP_STRUCT__entry(
150 : __field(dev_t, dev)
151 : __field(u64, ino)
152 : __field(loff_t, pos)
153 : __field(loff_t, length)
154 : __field(unsigned int, flags)
155 : __field(const void *, ops)
156 : __field(void *, actor)
157 : __field(unsigned long, caller)
158 : ),
159 : TP_fast_assign(
160 : __entry->dev = inode->i_sb->s_dev;
161 : __entry->ino = inode->i_ino;
162 : __entry->pos = pos;
163 : __entry->length = length;
164 : __entry->flags = flags;
165 : __entry->ops = ops;
166 : __entry->actor = actor;
167 : __entry->caller = caller;
168 : ),
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),
172 : __entry->ino,
173 : __entry->pos,
174 : __entry->length,
175 : __print_flags(__entry->flags, "|", IOMAP_FLAGS_STRINGS),
176 : __entry->flags,
177 : __entry->ops,
178 : (void *)__entry->caller,
179 : __entry->actor)
180 : );
181 :
182 : #endif /* _IOMAP_TRACE_H */
183 :
184 : #undef TRACE_INCLUDE_PATH
185 : #define TRACE_INCLUDE_PATH .
186 : #define TRACE_INCLUDE_FILE trace
187 : #include <trace/define_trace.h>
|