Fix: do not use bdi_unknown_name symbol
[lttng-modules.git] / include / instrumentation / events / writeback.h
CommitLineData
b7cdc182 1/* SPDX-License-Identifier: GPL-2.0-only */
b87700e3
AG
2#undef TRACE_SYSTEM
3#define TRACE_SYSTEM writeback
4
3bc29f0a
MD
5#if !defined(LTTNG_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ)
6#define LTTNG_TRACE_WRITEBACK_H
b87700e3 7
3b4aafcb 8#include <lttng/tracepoint-event.h>
aa634cd1 9#include <linux/tracepoint.h>
b87700e3
AG
10#include <linux/backing-dev.h>
11#include <linux/writeback.h>
5f4c791e 12#include <lttng/kernel-version.h>
b87700e3
AG
13
14#ifndef _TRACE_WRITEBACK_DEF_
15#define _TRACE_WRITEBACK_DEF_
99a570c8 16
dbabd729
MD
17/*
18 * Use the GPL-exported bdi_dev_name introduced in kernel 5.7. Do not use
19 * static inline bdi_dev_name in prior kernels because it uses the bdi_unknown_name
20 * symbol which is not exported to GPL modules.
21 */
22#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,7,0))
b1fdcb19
MD
23static inline const char *lttng_bdi_dev_name(struct backing_dev_info *bdi)
24{
25 return bdi_dev_name(bdi);
26}
27#else
28static inline const char *lttng_bdi_dev_name(struct backing_dev_info *bdi)
29{
30 if (!bdi || !bdi->dev)
31 return "(unknown)";
32 return dev_name(bdi->dev);
33}
34#endif
35
70f6fc80
MJ
36/*
37 * Vanilla kernels before 4.0 do not implement inode_to_bdi
38 * RHEL kernels before 3.10.0-327.10.1 do not implement inode_to_bdi
39 * RHEL kernel 3.10.0-327.10.1 has inode_to_bdi
40 * RHEL kernel 3.10.0-327.13.1 includes a partial merge of upstream
41 * commit a212b105b07d75b48b1a166378282e8a77fbf53d which inlines
42 * inode_to_bdi but not sb_is_blkdev_sb making it unusable by modules.
43 */
5f4c791e 44#if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(4,0,0))
70f6fc80 45static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
b87700e3 46{
70f6fc80
MJ
47 struct super_block *sb;
48
49 if (!inode)
50 return &noop_backing_dev_info;
51
52 sb = inode->i_sb;
b87700e3
AG
53
54 if (strcmp(sb->s_type->name, "bdev") == 0)
55 return inode->i_mapping->backing_dev_info;
56
57 return sb->s_bdi;
58}
70f6fc80
MJ
59#else
60static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
61{
62 return inode_to_bdi(inode);
63}
5f4c791e 64#endif /* #if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(4,0,0)) */
99a570c8 65
b87700e3
AG
66#endif
67
5f4c791e 68#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0))
084a3c41
MJ
69#define show_inode_state(state) \
70 __print_flags(state, "|", \
71 {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \
72 {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \
73 {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \
74 {I_NEW, "I_NEW"}, \
75 {I_WILL_FREE, "I_WILL_FREE"}, \
76 {I_FREEING, "I_FREEING"}, \
77 {I_CLEAR, "I_CLEAR"}, \
78 {I_SYNC, "I_SYNC"}, \
79 {I_DIRTY_TIME, "I_DIRTY_TIME"}, \
80 {I_REFERENCED, "I_REFERENCED"} \
81 )
5f4c791e 82#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0))
99a570c8
MD
83#define show_inode_state(state) \
84 __print_flags(state, "|", \
85 {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \
86 {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \
87 {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \
88 {I_NEW, "I_NEW"}, \
89 {I_WILL_FREE, "I_WILL_FREE"}, \
90 {I_FREEING, "I_FREEING"}, \
91 {I_CLEAR, "I_CLEAR"}, \
92 {I_SYNC, "I_SYNC"}, \
93 {I_DIRTY_TIME, "I_DIRTY_TIME"}, \
94 {I_DIRTY_TIME_EXPIRED, "I_DIRTY_TIME_EXPIRED"}, \
95 {I_REFERENCED, "I_REFERENCED"} \
96 )
5f4c791e 97#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0)) */
b87700e3
AG
98#define show_inode_state(state) \
99 __print_flags(state, "|", \
100 {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \
101 {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \
102 {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \
103 {I_NEW, "I_NEW"}, \
104 {I_WILL_FREE, "I_WILL_FREE"}, \
105 {I_FREEING, "I_FREEING"}, \
106 {I_CLEAR, "I_CLEAR"}, \
107 {I_SYNC, "I_SYNC"}, \
108 {I_REFERENCED, "I_REFERENCED"} \
109 )
5f4c791e 110#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0)) */
b87700e3 111
5f4c791e 112#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0))
99a570c8
MD
113
114LTTNG_TRACEPOINT_EVENT(writeback_dirty_page,
115 TP_PROTO(struct page *page, struct address_space *mapping),
116 TP_ARGS(page, mapping),
f127e61e 117 TP_FIELDS(
b1fdcb19 118 ctf_string(name, lttng_bdi_dev_name(mapping ? lttng_inode_to_bdi(mapping->host) : NULL))
f127e61e
MD
119 ctf_integer(unsigned long, ino, mapping ? mapping->host->i_ino : 0)
120 ctf_integer(pgoff_t, index, page->index)
99a570c8
MD
121 )
122)
123
124LTTNG_TRACEPOINT_EVENT_CLASS(writeback_dirty_inode_template,
125 TP_PROTO(struct inode *inode, int flags),
126 TP_ARGS(inode, flags),
f127e61e 127 TP_FIELDS(
99a570c8 128 /* may be called for files on pseudo FSes w/ unregistered bdi */
b1fdcb19 129 ctf_string(name, lttng_bdi_dev_name(lttng_inode_to_bdi(inode)))
f127e61e
MD
130 ctf_integer(unsigned long, ino, inode->i_ino)
131 ctf_integer(unsigned long, state, inode->i_state)
132 ctf_integer(unsigned long, flags, flags)
99a570c8
MD
133 )
134)
135#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(name) \
136LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_dirty_inode_template, name, \
137 TP_PROTO(struct inode *inode, int flags), \
138 TP_ARGS(inode, flags))
139LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode_start)
140LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode)
141LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_mark_inode_dirty)
142
143LTTNG_TRACEPOINT_EVENT_CLASS(writeback_write_inode_template,
144 TP_PROTO(struct inode *inode, struct writeback_control *wbc),
145 TP_ARGS(inode, wbc),
f127e61e 146 TP_FIELDS(
b1fdcb19 147 ctf_string(name, lttng_bdi_dev_name(lttng_inode_to_bdi(inode)))
f127e61e
MD
148 ctf_integer(unsigned long, ino, inode->i_ino)
149 ctf_integer(int, sync_mode, wbc->sync_mode)
99a570c8
MD
150 )
151)
152
153#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(name) \
154LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_write_inode_template, name, \
155 TP_PROTO(struct inode *inode, struct writeback_control *wbc), \
156 TP_ARGS(inode, wbc))
157LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode_start)
158LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode)
159
5f4c791e 160#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0))
99a570c8 161
aa634cd1
JD
162LTTNG_TRACEPOINT_EVENT(writeback_dirty_page,
163 TP_PROTO(struct page *page, struct address_space *mapping),
164 TP_ARGS(page, mapping),
f127e61e 165 TP_FIELDS(
b1fdcb19 166 ctf_string(name, lttng_bdi_dev_name(mapping ? mapping->backing_dev_info : NULL))
f127e61e
MD
167 ctf_integer(unsigned long, ino, mapping ? mapping->host->i_ino : 0)
168 ctf_integer(pgoff_t, index, page->index)
aa634cd1
JD
169 )
170)
171
172LTTNG_TRACEPOINT_EVENT_CLASS(writeback_dirty_inode_template,
173 TP_PROTO(struct inode *inode, int flags),
174 TP_ARGS(inode, flags),
f127e61e 175 TP_FIELDS(
aa634cd1 176 /* may be called for files on pseudo FSes w/ unregistered bdi */
b1fdcb19 177 ctf_string(name, lttng_bdi_dev_name(inode->i_mapping->backing_dev_info))
f127e61e
MD
178 ctf_integer(unsigned long, ino, inode->i_ino)
179 ctf_integer(unsigned long, flags, flags)
aa634cd1
JD
180 )
181)
182#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(name) \
183LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_dirty_inode_template, name, \
184 TP_PROTO(struct inode *inode, int flags), \
185 TP_ARGS(inode, flags))
186LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode_start)
187LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode)
188
189LTTNG_TRACEPOINT_EVENT_CLASS(writeback_write_inode_template,
190 TP_PROTO(struct inode *inode, struct writeback_control *wbc),
191 TP_ARGS(inode, wbc),
f127e61e 192 TP_FIELDS(
b1fdcb19 193 ctf_string(name, lttng_bdi_dev_name(inode->i_mapping->backing_dev_info))
f127e61e
MD
194 ctf_integer(unsigned long, ino, inode->i_ino)
195 ctf_integer(int, sync_mode, wbc->sync_mode)
aa634cd1
JD
196 )
197)
198
199#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(name) \
200LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_write_inode_template, name, \
201 TP_PROTO(struct inode *inode, struct writeback_control *wbc), \
202 TP_ARGS(inode, wbc))
203LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode_start)
204LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode)
99a570c8 205
5f4c791e 206#endif /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) */
aa634cd1 207
5f4c791e 208#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,3,0))
a40cb509
MD
209
210LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class,
211 TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work),
212 TP_ARGS(wb, work),
213 TP_FIELDS(
b1fdcb19 214 ctf_string(name, lttng_bdi_dev_name(wb->bdi))
a40cb509
MD
215 )
216)
217
b1fdcb19 218#else
99a570c8 219
3bc29f0a 220LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class,
b87700e3
AG
221 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work),
222 TP_ARGS(bdi, work),
f127e61e 223 TP_FIELDS(
b1fdcb19 224 ctf_string(name, lttng_bdi_dev_name(bdi))
b87700e3 225 )
b87700e3 226)
99a570c8 227
b1fdcb19 228#endif /* #else if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,3,0)) */
99a570c8 229
5f4c791e 230#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,3,0))
a40cb509
MD
231
232#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(name) \
233LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_work_class, name, \
234 TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work), \
235 TP_ARGS(wb, work))
236
5f4c791e 237#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,3,0)) */
a40cb509 238
3bc29f0a
MD
239#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(name) \
240LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_work_class, name, \
b87700e3
AG
241 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \
242 TP_ARGS(bdi, work))
a40cb509 243
5f4c791e 244#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,3,0)) */
a40cb509 245
3bc29f0a
MD
246LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_nothread)
247LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_queue)
248LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_exec)
5f4c791e 249#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,1,0))
3bc29f0a
MD
250LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_start)
251LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_written)
252LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_wait)
b87700e3
AG
253#endif
254
3bc29f0a 255LTTNG_TRACEPOINT_EVENT(writeback_pages_written,
b87700e3
AG
256 TP_PROTO(long pages_written),
257 TP_ARGS(pages_written),
f127e61e
MD
258 TP_FIELDS(
259 ctf_integer(long, pages, pages_written)
260 )
b87700e3
AG
261)
262
5f4c791e 263#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,3,0))
a40cb509
MD
264
265LTTNG_TRACEPOINT_EVENT_CLASS(writeback_class,
266 TP_PROTO(struct bdi_writeback *wb),
267 TP_ARGS(wb),
268 TP_FIELDS(
b1fdcb19 269 ctf_string(name, lttng_bdi_dev_name(wb->bdi))
a40cb509
MD
270 )
271)
272
273#undef DEFINE_WRITEBACK_EVENT
274#define DEFINE_WRITEBACK_EVENT(name) \
275LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_class, name, \
276 TP_PROTO(struct bdi_writeback *wb), \
277 TP_ARGS(wb))
278
279#define DEFINE_WRITEBACK_EVENT_MAP(name, map) \
280LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_class, name, map, \
281 TP_PROTO(struct bdi_writeback *wb), \
282 TP_ARGS(wb))
283
284LTTNG_TRACEPOINT_EVENT(writeback_bdi_register,
285 TP_PROTO(struct backing_dev_info *bdi),
286 TP_ARGS(bdi),
287 TP_FIELDS(
b1fdcb19 288 ctf_string(name, lttng_bdi_dev_name(bdi))
a40cb509
MD
289 )
290)
291
5f4c791e 292#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,3,0)) */
a40cb509 293
3bc29f0a 294LTTNG_TRACEPOINT_EVENT_CLASS(writeback_class,
b87700e3
AG
295 TP_PROTO(struct backing_dev_info *bdi),
296 TP_ARGS(bdi),
f127e61e 297 TP_FIELDS(
b1fdcb19 298 ctf_string(name, lttng_bdi_dev_name(bdi))
b87700e3
AG
299 )
300)
a40cb509 301
59fecd6c 302#undef DEFINE_WRITEBACK_EVENT
b87700e3 303#define DEFINE_WRITEBACK_EVENT(name) \
3bc29f0a 304LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_class, name, \
b87700e3
AG
305 TP_PROTO(struct backing_dev_info *bdi), \
306 TP_ARGS(bdi))
307
9cf29d3e 308#define DEFINE_WRITEBACK_EVENT_MAP(name, map) \
3bc29f0a 309LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_class, name, map, \
9cf29d3e
MD
310 TP_PROTO(struct backing_dev_info *bdi), \
311 TP_ARGS(bdi))
312
a40cb509
MD
313DEFINE_WRITEBACK_EVENT(writeback_bdi_register)
314
5f4c791e 315#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,3,0)) */
a40cb509 316
b87700e3 317DEFINE_WRITEBACK_EVENT(writeback_nowork)
b87700e3 318DEFINE_WRITEBACK_EVENT(writeback_wake_background)
b87700e3
AG
319DEFINE_WRITEBACK_EVENT(writeback_wake_thread)
320DEFINE_WRITEBACK_EVENT(writeback_wake_forker_thread)
b87700e3
AG
321DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister)
322DEFINE_WRITEBACK_EVENT(writeback_thread_start)
323DEFINE_WRITEBACK_EVENT(writeback_thread_stop)
324#if (LTTNG_KERNEL_RANGE(3,1,0, 3,2,0))
9cf29d3e
MD
325DEFINE_WRITEBACK_EVENT_MAP(balance_dirty_start, writeback_balance_dirty_start)
326DEFINE_WRITEBACK_EVENT_MAP(balance_dirty_wait, writeback_balance_dirty_wait)
327
3bc29f0a 328LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_written,
b87700e3 329
9cf29d3e 330 writeback_balance_dirty_written,
b87700e3
AG
331
332 TP_PROTO(struct backing_dev_info *bdi, int written),
333
334 TP_ARGS(bdi, written),
335
f127e61e 336 TP_FIELDS(
b1fdcb19 337 ctf_string(name, lttng_bdi_dev_name(bdi))
f127e61e 338 ctf_integer(int, written, written)
b87700e3
AG
339 )
340)
341#endif
342
3bc29f0a 343LTTNG_TRACEPOINT_EVENT_CLASS(writeback_wbc_class,
b87700e3
AG
344 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi),
345 TP_ARGS(wbc, bdi),
f127e61e 346 TP_FIELDS(
b1fdcb19 347 ctf_string(name, lttng_bdi_dev_name(bdi))
f127e61e
MD
348 ctf_integer(long, nr_to_write, wbc->nr_to_write)
349 ctf_integer(long, pages_skipped, wbc->pages_skipped)
350 ctf_integer(int, sync_mode, wbc->sync_mode)
351 ctf_integer(int, for_kupdate, wbc->for_kupdate)
352 ctf_integer(int, for_background, wbc->for_background)
353 ctf_integer(int, for_reclaim, wbc->for_reclaim)
354 ctf_integer(int, range_cyclic, wbc->range_cyclic)
5f4c791e 355#if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(3,1,0))
f127e61e
MD
356 ctf_integer(int, more_io, wbc->more_io)
357 ctf_integer(unsigned long, older_than_this,
358 wbc->older_than_this ? *wbc->older_than_this : 0)
b87700e3 359#endif
f127e61e
MD
360 ctf_integer(long, range_start, (long) wbc->range_start)
361 ctf_integer(long, range_end, (long) wbc->range_end)
362 )
b87700e3
AG
363)
364
9cf29d3e 365#undef DEFINE_WBC_EVENT
3bc29f0a
MD
366#define LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(name, map) \
367LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_wbc_class, name, map, \
b87700e3
AG
368 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \
369 TP_ARGS(wbc, bdi))
5f4c791e 370#if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(3,1,0))
3bc29f0a
MD
371LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_start, writeback_wbc_writeback_start)
372LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_written, writeback_wbc_writeback_written)
373LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_wait, writeback_wbc_writeback_wait)
374LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_start, writeback_wbc_balance_dirty_start)
375LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_written, writeback_wbc_balance_dirty_written)
376LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balance_dirty_wait)
b87700e3 377#endif
3bc29f0a 378LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
b87700e3 379
5f4c791e 380#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0) || \
b6af46d1
MJ
381 LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \
382 LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \
383 LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \
384 LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \
385 LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \
da139c48
MJ
386 LTTNG_KERNEL_RANGE(4,4,235, 4,5,0) || \
387 LTTNG_UBUNTU_KERNEL_RANGE(4,15,18,119, 4,16,0,0))
817e02f9
MJ
388LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
389 TP_PROTO(struct bdi_writeback *wb,
390 struct wb_writeback_work *work,
391 unsigned long dirtied_before,
392 int moved),
393 TP_ARGS(wb, work, dirtied_before, moved),
394 TP_FIELDS(
b1fdcb19 395 ctf_string(name, lttng_bdi_dev_name(wb->bdi))
817e02f9
MJ
396 ctf_integer(unsigned long, older, dirtied_before)
397 ctf_integer(int, moved, moved)
398 )
399)
5f4c791e 400#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,2,0))
3bc29f0a 401LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
b87700e3 402 TP_PROTO(struct bdi_writeback *wb,
b87700e3 403 struct wb_writeback_work *work,
b87700e3 404 int moved),
b87700e3 405 TP_ARGS(wb, work, moved),
817e02f9 406 TP_FIELDS(
b1fdcb19 407 ctf_string(name, lttng_bdi_dev_name(wb->bdi))
817e02f9
MJ
408 ctf_integer(int, moved, moved)
409 )
410)
5f4c791e 411#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,1,0))
817e02f9
MJ
412LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
413 TP_PROTO(struct bdi_writeback *wb,
414 unsigned long *older_than_this,
415 int moved),
b87700e3 416 TP_ARGS(wb, older_than_this, moved),
f127e61e 417 TP_FIELDS(
b1fdcb19 418 ctf_string(name, lttng_bdi_dev_name(wb->bdi))
f127e61e
MD
419 ctf_integer(unsigned long, older,
420 older_than_this ? *older_than_this : 0)
421 ctf_integer(long, age,
422 older_than_this ?
423 (jiffies - *older_than_this) * 1000 / HZ
424 : -1)
f127e61e 425 ctf_integer(int, moved, moved)
b87700e3 426 )
b87700e3 427)
817e02f9 428#endif
b87700e3 429
5f4c791e 430#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,8,0))
0b1facd4
MJ
431LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
432
433 writeback_global_dirty_state,
434
435 TP_PROTO(unsigned long background_thresh,
436 unsigned long dirty_thresh
437 ),
438
439 TP_ARGS(background_thresh,
440 dirty_thresh
441 ),
442
443 TP_FIELDS(
444 ctf_integer(unsigned long, nr_dirty, global_node_page_state(NR_FILE_DIRTY))
445 ctf_integer(unsigned long, nr_writeback, global_node_page_state(NR_WRITEBACK))
446 ctf_integer(unsigned long, nr_dirtied, global_node_page_state(NR_DIRTIED))
447 ctf_integer(unsigned long, nr_written, global_node_page_state(NR_WRITTEN))
448 ctf_integer(unsigned long, background_thresh, background_thresh)
449 ctf_integer(unsigned long, dirty_thresh, dirty_thresh)
450 ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
451 )
452)
5f4c791e 453#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
7ceeb15d
MJ
454LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
455
456 writeback_global_dirty_state,
457
458 TP_PROTO(unsigned long background_thresh,
459 unsigned long dirty_thresh
460 ),
461
462 TP_ARGS(background_thresh,
463 dirty_thresh
464 ),
465
466 TP_FIELDS(
467 ctf_integer(unsigned long, nr_dirty, global_node_page_state(NR_FILE_DIRTY))
468 ctf_integer(unsigned long, nr_writeback, global_node_page_state(NR_WRITEBACK))
469 ctf_integer(unsigned long, nr_unstable, global_node_page_state(NR_UNSTABLE_NFS))
470 ctf_integer(unsigned long, nr_dirtied, global_node_page_state(NR_DIRTIED))
471 ctf_integer(unsigned long, nr_written, global_node_page_state(NR_WRITTEN))
472 ctf_integer(unsigned long, background_thresh, background_thresh)
473 ctf_integer(unsigned long, dirty_thresh, dirty_thresh)
474 ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
475 )
476)
5f4c791e 477#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,1,0))
3bc29f0a 478LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
9cf29d3e
MD
479
480 writeback_global_dirty_state,
b87700e3
AG
481
482 TP_PROTO(unsigned long background_thresh,
483 unsigned long dirty_thresh
484 ),
485
486 TP_ARGS(background_thresh,
487 dirty_thresh
488 ),
489
f127e61e
MD
490 TP_FIELDS(
491 ctf_integer(unsigned long, nr_dirty, global_page_state(NR_FILE_DIRTY))
492 ctf_integer(unsigned long, nr_writeback, global_page_state(NR_WRITEBACK))
493 ctf_integer(unsigned long, nr_unstable, global_page_state(NR_UNSTABLE_NFS))
494 ctf_integer(unsigned long, nr_dirtied, global_page_state(NR_DIRTIED))
495 ctf_integer(unsigned long, nr_written, global_page_state(NR_WRITTEN))
496 ctf_integer(unsigned long, background_thresh, background_thresh)
497 ctf_integer(unsigned long, dirty_thresh, dirty_thresh)
498 ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
b87700e3
AG
499 )
500)
501#endif
502
5f4c791e 503#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,2,0))
b87700e3
AG
504
505#define KBps(x) ((x) << (PAGE_SHIFT - 10))
506
5f4c791e 507#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,3,0))
a40cb509
MD
508
509LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit,
510
511 writeback_bdi_dirty_ratelimit,
512
513 TP_PROTO(struct bdi_writeback *wb,
514 unsigned long dirty_rate,
515 unsigned long task_ratelimit),
516
517 TP_ARGS(wb, dirty_rate, task_ratelimit),
518
519 TP_FIELDS(
b1fdcb19 520 ctf_string(bdi, lttng_bdi_dev_name(wb->bdi))
a40cb509
MD
521 ctf_integer(unsigned long, write_bw, KBps(wb->bdi->wb.write_bandwidth))
522 ctf_integer(unsigned long, avg_write_bw, KBps(wb->bdi->wb.avg_write_bandwidth))
523 ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate))
524 ctf_integer(unsigned long, dirty_ratelimit, KBps(wb->bdi->wb.dirty_ratelimit))
525 ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit))
526 ctf_integer(unsigned long, balanced_dirty_ratelimit,
527 KBps(wb->bdi->wb.balanced_dirty_ratelimit))
528 )
529)
530
5f4c791e 531#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,2,0))
c7d89a6d 532
3bc29f0a 533LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit,
9cf29d3e
MD
534
535 writeback_bdi_dirty_ratelimit,
b87700e3
AG
536
537 TP_PROTO(struct backing_dev_info *bdi,
538 unsigned long dirty_rate,
539 unsigned long task_ratelimit),
540
541 TP_ARGS(bdi, dirty_rate, task_ratelimit),
542
f127e61e 543 TP_FIELDS(
b1fdcb19 544 ctf_string(bdi, lttng_bdi_dev_name(bdi))
902947a4
MJ
545 ctf_integer(unsigned long, write_bw, KBps(bdi->wb.write_bandwidth))
546 ctf_integer(unsigned long, avg_write_bw, KBps(bdi->wb.avg_write_bandwidth))
f127e61e 547 ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate))
902947a4 548 ctf_integer(unsigned long, dirty_ratelimit, KBps(bdi->wb.dirty_ratelimit))
f127e61e 549 ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit))
902947a4
MJ
550 ctf_integer(unsigned long, balanced_dirty_ratelimit,
551 KBps(bdi->wb.balanced_dirty_ratelimit))
c7d89a6d
MD
552 )
553)
554
5f4c791e 555#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,2,0)) */
c7d89a6d
MD
556
557LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit,
558
559 writeback_bdi_dirty_ratelimit,
560
561 TP_PROTO(struct backing_dev_info *bdi,
562 unsigned long dirty_rate,
563 unsigned long task_ratelimit),
564
565 TP_ARGS(bdi, dirty_rate, task_ratelimit),
566
567 TP_FIELDS(
b1fdcb19 568 ctf_string(bdi, lttng_bdi_dev_name(bdi))
c7d89a6d
MD
569 ctf_integer(unsigned long, write_bw, KBps(bdi->write_bandwidth))
570 ctf_integer(unsigned long, avg_write_bw, KBps(bdi->avg_write_bandwidth))
571 ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate))
572 ctf_integer(unsigned long, dirty_ratelimit, KBps(bdi->dirty_ratelimit))
573 ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit))
f127e61e 574 ctf_integer(unsigned long, balanced_dirty_ratelimit,
b87700e3 575 KBps(bdi->balanced_dirty_ratelimit))
b87700e3
AG
576 )
577)
578
5f4c791e 579#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,2,0)) */
c7d89a6d 580
5f4c791e 581#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,3,0))
a40cb509
MD
582
583LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages,
584
585 writeback_balance_dirty_pages,
586
587 TP_PROTO(struct bdi_writeback *wb,
588 unsigned long thresh,
589 unsigned long bg_thresh,
590 unsigned long dirty,
591 unsigned long bdi_thresh,
592 unsigned long bdi_dirty,
593 unsigned long dirty_ratelimit,
594 unsigned long task_ratelimit,
595 unsigned long dirtied,
596 unsigned long period,
597 long pause,
598 unsigned long start_time),
599
600 TP_ARGS(wb, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty,
601 dirty_ratelimit, task_ratelimit,
602 dirtied, period, pause, start_time
603 ),
604
605 TP_FIELDS(
b1fdcb19 606 ctf_string(bdi, lttng_bdi_dev_name(wb->bdi))
a40cb509
MD
607 ctf_integer(unsigned long, limit, global_dirty_limit)
608 ctf_integer(unsigned long, setpoint,
609 (global_dirty_limit + (thresh + bg_thresh) / 2) / 2)
610 ctf_integer(unsigned long, dirty, dirty)
611 ctf_integer(unsigned long, bdi_setpoint,
612 ((global_dirty_limit + (thresh + bg_thresh) / 2) / 2) *
613 bdi_thresh / (thresh + 1))
614 ctf_integer(unsigned long, bdi_dirty, bdi_dirty)
615 ctf_integer(unsigned long, dirty_ratelimit,
616 KBps(dirty_ratelimit))
617 ctf_integer(unsigned long, task_ratelimit,
618 KBps(task_ratelimit))
619 ctf_integer(unsigned int, dirtied, dirtied)
620 ctf_integer(unsigned int, dirtied_pause,
621 current->nr_dirtied_pause)
622 ctf_integer(unsigned long, paused,
623 (jiffies - start_time) * 1000 / HZ)
624 ctf_integer(long, pause, pause * 1000 / HZ)
625 ctf_integer(unsigned long, period,
626 period * 1000 / HZ)
627 ctf_integer(long, think,
628 current->dirty_paused_when == 0 ? 0 :
629 (long)(jiffies - current->dirty_paused_when) * 1000/HZ)
630 )
631)
632
5f4c791e 633#else /* #if LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,3,0)) */
a40cb509 634
3bc29f0a 635LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages,
9cf29d3e
MD
636
637 writeback_balance_dirty_pages,
b87700e3
AG
638
639 TP_PROTO(struct backing_dev_info *bdi,
640 unsigned long thresh,
641 unsigned long bg_thresh,
642 unsigned long dirty,
643 unsigned long bdi_thresh,
644 unsigned long bdi_dirty,
645 unsigned long dirty_ratelimit,
646 unsigned long task_ratelimit,
647 unsigned long dirtied,
5f4c791e 648#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,3,0))
b87700e3
AG
649 unsigned long period,
650#endif
651 long pause,
652 unsigned long start_time),
653
654 TP_ARGS(bdi, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty,
655 dirty_ratelimit, task_ratelimit,
5f4c791e 656#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,3,0))
f127e61e 657 dirtied, period, pause, start_time
b87700e3 658#else
f127e61e 659 dirtied, pause, start_time
b87700e3
AG
660#endif
661 ),
662
f127e61e 663 TP_FIELDS(
b1fdcb19 664 ctf_string(bdi, lttng_bdi_dev_name(bdi))
f127e61e
MD
665 ctf_integer(unsigned long, limit, global_dirty_limit)
666 ctf_integer(unsigned long, setpoint,
b87700e3 667 (global_dirty_limit + (thresh + bg_thresh) / 2) / 2)
f127e61e
MD
668 ctf_integer(unsigned long, dirty, dirty)
669 ctf_integer(unsigned long, bdi_setpoint,
b87700e3 670 ((global_dirty_limit + (thresh + bg_thresh) / 2) / 2) *
f127e61e
MD
671 bdi_thresh / (thresh + 1))
672 ctf_integer(unsigned long, bdi_dirty, bdi_dirty)
673 ctf_integer(unsigned long, dirty_ratelimit,
674 KBps(dirty_ratelimit))
675 ctf_integer(unsigned long, task_ratelimit,
676 KBps(task_ratelimit))
677 ctf_integer(unsigned int, dirtied, dirtied)
678 ctf_integer(unsigned int, dirtied_pause,
679 current->nr_dirtied_pause)
680 ctf_integer(unsigned long, paused,
681 (jiffies - start_time) * 1000 / HZ)
682 ctf_integer(long, pause, pause * 1000 / HZ)
5f4c791e 683#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,3,0))
f127e61e
MD
684 ctf_integer(unsigned long, period,
685 period * 1000 / HZ)
686 ctf_integer(long, think,
687 current->dirty_paused_when == 0 ? 0 :
688 (long)(jiffies - current->dirty_paused_when) * 1000/HZ)
b87700e3 689#endif
f127e61e 690 )
b87700e3 691)
5f4c791e 692#endif /* #else #if LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,3,0)) */
a40cb509 693
5f4c791e 694#endif /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,2,0)) */
b87700e3 695
5f4c791e 696#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,5,0))
3bc29f0a 697LTTNG_TRACEPOINT_EVENT(writeback_sb_inodes_requeue,
b87700e3
AG
698
699 TP_PROTO(struct inode *inode),
700 TP_ARGS(inode),
701
f127e61e 702 TP_FIELDS(
b1fdcb19 703 ctf_string(name, lttng_bdi_dev_name(lttng_inode_to_bdi(inode)))
f127e61e
MD
704 ctf_integer(unsigned long, ino, inode->i_ino)
705 ctf_integer(unsigned long, state, inode->i_state)
706 ctf_integer(unsigned long, dirtied_when, inode->dirtied_when)
b87700e3
AG
707 )
708)
709#endif
710
3bc29f0a 711LTTNG_TRACEPOINT_EVENT_CLASS(writeback_congest_waited_template,
b87700e3
AG
712
713 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
714
715 TP_ARGS(usec_timeout, usec_delayed),
716
f127e61e
MD
717 TP_FIELDS(
718 ctf_integer(unsigned int, usec_timeout, usec_timeout)
719 ctf_integer(unsigned int, usec_delayed, usec_delayed)
720 )
b87700e3
AG
721)
722
3bc29f0a 723LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_congestion_wait,
b87700e3
AG
724
725 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
726
727 TP_ARGS(usec_timeout, usec_delayed)
728)
729
3bc29f0a 730LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_wait_iff_congested,
b87700e3
AG
731
732 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
733
734 TP_ARGS(usec_timeout, usec_delayed)
735)
b87700e3 736
5f4c791e 737#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,1,0))
3bc29f0a 738LTTNG_TRACEPOINT_EVENT_CLASS(writeback_single_inode_template,
b87700e3
AG
739
740 TP_PROTO(struct inode *inode,
741 struct writeback_control *wbc,
742 unsigned long nr_to_write
743 ),
744
745 TP_ARGS(inode, wbc, nr_to_write),
746
f127e61e 747 TP_FIELDS(
b1fdcb19 748 ctf_string(name, lttng_bdi_dev_name(lttng_inode_to_bdi(inode)))
f127e61e
MD
749 ctf_integer(unsigned long, ino, inode->i_ino)
750 ctf_integer(unsigned long, state, inode->i_state)
751 ctf_integer(unsigned long, dirtied_when, inode->dirtied_when)
752 ctf_integer(unsigned long, writeback_index,
753 inode->i_mapping->writeback_index)
754 ctf_integer(long, nr_to_write, nr_to_write)
755 ctf_integer(unsigned long, wrote,
756 nr_to_write - wbc->nr_to_write)
b87700e3
AG
757 )
758)
759
5f4c791e 760#if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(3,5,0))
3bc29f0a 761LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template, writeback_single_inode_requeue,
b87700e3
AG
762 TP_PROTO(struct inode *inode,
763 struct writeback_control *wbc,
764 unsigned long nr_to_write),
765 TP_ARGS(inode, wbc, nr_to_write)
766)
767#endif
768
3bc29f0a 769LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template, writeback_single_inode,
b87700e3
AG
770 TP_PROTO(struct inode *inode,
771 struct writeback_control *wbc,
772 unsigned long nr_to_write),
773 TP_ARGS(inode, wbc, nr_to_write)
774)
775#endif
776
3bc29f0a 777#endif /* LTTNG_TRACE_WRITEBACK_H */
b87700e3
AG
778
779/* This part must be outside protection */
3b4aafcb 780#include <lttng/define_trace.h>
This page took 0.079418 seconds and 4 git commands to generate.