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