fix: writeback: Drop I_DIRTY_TIME_EXPIRE (v5.9)
[lttng-modules.git] / instrumentation / events / lttng-module / writeback.h
... / ...
CommitLineData
1/* SPDX-License-Identifier: GPL-2.0 */
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 <probes/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))
26static 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
41static 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
95LTTNG_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
106LTTNG_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) \
120LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_dirty_inode_template, name, \
121 TP_PROTO(struct inode *inode, int flags), \
122 TP_ARGS(inode, flags))
123LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode_start)
124LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode)
125LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_mark_inode_dirty)
126
127LTTNG_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) \
139LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_write_inode_template, name, \
140 TP_PROTO(struct inode *inode, struct writeback_control *wbc), \
141 TP_ARGS(inode, wbc))
142LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode_start)
143LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode)
144
145#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
146
147LTTNG_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
158LTTNG_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) \
172LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_dirty_inode_template, name, \
173 TP_PROTO(struct inode *inode, int flags), \
174 TP_ARGS(inode, flags))
175LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode_start)
176LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode)
177
178LTTNG_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) \
190LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_write_inode_template, name, \
191 TP_PROTO(struct inode *inode, struct writeback_control *wbc), \
192 TP_ARGS(inode, wbc))
193LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode_start)
194LTTNG_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
200LTTNG_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
211LTTNG_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
222LTTNG_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) \
237LTTNG_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) \
244LTTNG_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
250LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_nothread)
251LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_queue)
252LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_exec)
253#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
254LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_start)
255LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_written)
256LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_wait)
257#endif
258
259LTTNG_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
269LTTNG_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) \
280LTTNG_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) \
285LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_class, name, map, \
286 TP_PROTO(struct bdi_writeback *wb), \
287 TP_ARGS(wb))
288
289LTTNG_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
300LTTNG_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) \
311LTTNG_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) \
316LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_class, name, map, \
317 TP_PROTO(struct backing_dev_info *bdi), \
318 TP_ARGS(bdi))
319
320DEFINE_WRITEBACK_EVENT(writeback_bdi_register)
321
322#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
323
324DEFINE_WRITEBACK_EVENT(writeback_nowork)
325#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
326DEFINE_WRITEBACK_EVENT(writeback_wake_background)
327#endif
328DEFINE_WRITEBACK_EVENT(writeback_wake_thread)
329DEFINE_WRITEBACK_EVENT(writeback_wake_forker_thread)
330DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister)
331DEFINE_WRITEBACK_EVENT(writeback_thread_start)
332DEFINE_WRITEBACK_EVENT(writeback_thread_stop)
333#if (LTTNG_KERNEL_RANGE(3,1,0, 3,2,0))
334DEFINE_WRITEBACK_EVENT_MAP(balance_dirty_start, writeback_balance_dirty_start)
335DEFINE_WRITEBACK_EVENT_MAP(balance_dirty_wait, writeback_balance_dirty_wait)
336
337LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_written,
338
339 writeback_balance_dirty_written,
340
341 TP_PROTO(struct backing_dev_info *bdi, int written),
342
343 TP_ARGS(bdi, written),
344
345 TP_FIELDS(
346 ctf_array_text(char, name, dev_name(bdi->dev), 32)
347 ctf_integer(int, written, written)
348 )
349)
350#endif
351
352LTTNG_TRACEPOINT_EVENT_CLASS(writeback_wbc_class,
353 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi),
354 TP_ARGS(wbc, bdi),
355 TP_FIELDS(
356 ctf_array_text(char, name, dev_name(bdi->dev), 32)
357 ctf_integer(long, nr_to_write, wbc->nr_to_write)
358 ctf_integer(long, pages_skipped, wbc->pages_skipped)
359 ctf_integer(int, sync_mode, wbc->sync_mode)
360 ctf_integer(int, for_kupdate, wbc->for_kupdate)
361 ctf_integer(int, for_background, wbc->for_background)
362 ctf_integer(int, for_reclaim, wbc->for_reclaim)
363 ctf_integer(int, range_cyclic, wbc->range_cyclic)
364#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
365 ctf_integer(int, more_io, wbc->more_io)
366 ctf_integer(unsigned long, older_than_this,
367 wbc->older_than_this ? *wbc->older_than_this : 0)
368#endif
369 ctf_integer(long, range_start, (long) wbc->range_start)
370 ctf_integer(long, range_end, (long) wbc->range_end)
371 )
372)
373
374#undef DEFINE_WBC_EVENT
375#define LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(name, map) \
376LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_wbc_class, name, map, \
377 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \
378 TP_ARGS(wbc, bdi))
379#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
380LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_start, writeback_wbc_writeback_start)
381LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_written, writeback_wbc_writeback_written)
382LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_wait, writeback_wbc_writeback_wait)
383LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_start, writeback_wbc_balance_dirty_start)
384LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_written, writeback_wbc_balance_dirty_written)
385LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balance_dirty_wait)
386#endif
387LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
388
389#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
390LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
391 TP_PROTO(struct bdi_writeback *wb,
392#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
393 struct wb_writeback_work *work,
394#else
395 unsigned long *older_than_this,
396#endif
397 int moved),
398#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
399 TP_ARGS(wb, work, moved),
400#else
401 TP_ARGS(wb, older_than_this, moved),
402#endif
403 TP_FIELDS(
404 ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
405#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
406#else
407 ctf_integer(unsigned long, older,
408 older_than_this ? *older_than_this : 0)
409 ctf_integer(long, age,
410 older_than_this ?
411 (jiffies - *older_than_this) * 1000 / HZ
412 : -1)
413#endif
414 ctf_integer(int, moved, moved)
415 )
416)
417
418#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
419LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
420
421 writeback_global_dirty_state,
422
423 TP_PROTO(unsigned long background_thresh,
424 unsigned long dirty_thresh
425 ),
426
427 TP_ARGS(background_thresh,
428 dirty_thresh
429 ),
430
431 TP_FIELDS(
432 ctf_integer(unsigned long, nr_dirty, global_node_page_state(NR_FILE_DIRTY))
433 ctf_integer(unsigned long, nr_writeback, global_node_page_state(NR_WRITEBACK))
434 ctf_integer(unsigned long, nr_dirtied, global_node_page_state(NR_DIRTIED))
435 ctf_integer(unsigned long, nr_written, global_node_page_state(NR_WRITTEN))
436 ctf_integer(unsigned long, background_thresh, background_thresh)
437 ctf_integer(unsigned long, dirty_thresh, dirty_thresh)
438 ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
439 )
440)
441#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
442LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
443
444 writeback_global_dirty_state,
445
446 TP_PROTO(unsigned long background_thresh,
447 unsigned long dirty_thresh
448 ),
449
450 TP_ARGS(background_thresh,
451 dirty_thresh
452 ),
453
454 TP_FIELDS(
455 ctf_integer(unsigned long, nr_dirty, global_node_page_state(NR_FILE_DIRTY))
456 ctf_integer(unsigned long, nr_writeback, global_node_page_state(NR_WRITEBACK))
457 ctf_integer(unsigned long, nr_unstable, global_node_page_state(NR_UNSTABLE_NFS))
458 ctf_integer(unsigned long, nr_dirtied, global_node_page_state(NR_DIRTIED))
459 ctf_integer(unsigned long, nr_written, global_node_page_state(NR_WRITTEN))
460 ctf_integer(unsigned long, background_thresh, background_thresh)
461 ctf_integer(unsigned long, dirty_thresh, dirty_thresh)
462 ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
463 )
464)
465#else
466LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
467
468 writeback_global_dirty_state,
469
470 TP_PROTO(unsigned long background_thresh,
471 unsigned long dirty_thresh
472 ),
473
474 TP_ARGS(background_thresh,
475 dirty_thresh
476 ),
477
478 TP_FIELDS(
479 ctf_integer(unsigned long, nr_dirty, global_page_state(NR_FILE_DIRTY))
480 ctf_integer(unsigned long, nr_writeback, global_page_state(NR_WRITEBACK))
481 ctf_integer(unsigned long, nr_unstable, global_page_state(NR_UNSTABLE_NFS))
482 ctf_integer(unsigned long, nr_dirtied, global_page_state(NR_DIRTIED))
483 ctf_integer(unsigned long, nr_written, global_page_state(NR_WRITTEN))
484 ctf_integer(unsigned long, background_thresh, background_thresh)
485 ctf_integer(unsigned long, dirty_thresh, dirty_thresh)
486 ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
487 )
488)
489#endif
490#endif
491
492#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
493
494#define KBps(x) ((x) << (PAGE_SHIFT - 10))
495
496#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
497
498LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit,
499
500 writeback_bdi_dirty_ratelimit,
501
502 TP_PROTO(struct bdi_writeback *wb,
503 unsigned long dirty_rate,
504 unsigned long task_ratelimit),
505
506 TP_ARGS(wb, dirty_rate, task_ratelimit),
507
508 TP_FIELDS(
509 ctf_array_text(char, bdi, dev_name(wb->bdi->dev), 32)
510 ctf_integer(unsigned long, write_bw, KBps(wb->bdi->wb.write_bandwidth))
511 ctf_integer(unsigned long, avg_write_bw, KBps(wb->bdi->wb.avg_write_bandwidth))
512 ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate))
513 ctf_integer(unsigned long, dirty_ratelimit, KBps(wb->bdi->wb.dirty_ratelimit))
514 ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit))
515 ctf_integer(unsigned long, balanced_dirty_ratelimit,
516 KBps(wb->bdi->wb.balanced_dirty_ratelimit))
517 )
518)
519
520#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0))
521
522LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit,
523
524 writeback_bdi_dirty_ratelimit,
525
526 TP_PROTO(struct backing_dev_info *bdi,
527 unsigned long dirty_rate,
528 unsigned long task_ratelimit),
529
530 TP_ARGS(bdi, dirty_rate, task_ratelimit),
531
532 TP_FIELDS(
533 ctf_array_text(char, bdi, dev_name(bdi->dev), 32)
534 ctf_integer(unsigned long, write_bw, KBps(bdi->wb.write_bandwidth))
535 ctf_integer(unsigned long, avg_write_bw, KBps(bdi->wb.avg_write_bandwidth))
536 ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate))
537 ctf_integer(unsigned long, dirty_ratelimit, KBps(bdi->wb.dirty_ratelimit))
538 ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit))
539 ctf_integer(unsigned long, balanced_dirty_ratelimit,
540 KBps(bdi->wb.balanced_dirty_ratelimit))
541 )
542)
543
544#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) */
545
546LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit,
547
548 writeback_bdi_dirty_ratelimit,
549
550 TP_PROTO(struct backing_dev_info *bdi,
551 unsigned long dirty_rate,
552 unsigned long task_ratelimit),
553
554 TP_ARGS(bdi, dirty_rate, task_ratelimit),
555
556 TP_FIELDS(
557 ctf_array_text(char, bdi, dev_name(bdi->dev), 32)
558 ctf_integer(unsigned long, write_bw, KBps(bdi->write_bandwidth))
559 ctf_integer(unsigned long, avg_write_bw, KBps(bdi->avg_write_bandwidth))
560 ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate))
561 ctf_integer(unsigned long, dirty_ratelimit, KBps(bdi->dirty_ratelimit))
562 ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit))
563 ctf_integer(unsigned long, balanced_dirty_ratelimit,
564 KBps(bdi->balanced_dirty_ratelimit))
565 )
566)
567
568#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) */
569
570#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
571
572LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages,
573
574 writeback_balance_dirty_pages,
575
576 TP_PROTO(struct bdi_writeback *wb,
577 unsigned long thresh,
578 unsigned long bg_thresh,
579 unsigned long dirty,
580 unsigned long bdi_thresh,
581 unsigned long bdi_dirty,
582 unsigned long dirty_ratelimit,
583 unsigned long task_ratelimit,
584 unsigned long dirtied,
585 unsigned long period,
586 long pause,
587 unsigned long start_time),
588
589 TP_ARGS(wb, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty,
590 dirty_ratelimit, task_ratelimit,
591 dirtied, period, pause, start_time
592 ),
593
594 TP_FIELDS(
595 ctf_array_text(char, bdi, dev_name(wb->bdi->dev), 32)
596 ctf_integer(unsigned long, limit, global_dirty_limit)
597 ctf_integer(unsigned long, setpoint,
598 (global_dirty_limit + (thresh + bg_thresh) / 2) / 2)
599 ctf_integer(unsigned long, dirty, dirty)
600 ctf_integer(unsigned long, bdi_setpoint,
601 ((global_dirty_limit + (thresh + bg_thresh) / 2) / 2) *
602 bdi_thresh / (thresh + 1))
603 ctf_integer(unsigned long, bdi_dirty, bdi_dirty)
604 ctf_integer(unsigned long, dirty_ratelimit,
605 KBps(dirty_ratelimit))
606 ctf_integer(unsigned long, task_ratelimit,
607 KBps(task_ratelimit))
608 ctf_integer(unsigned int, dirtied, dirtied)
609 ctf_integer(unsigned int, dirtied_pause,
610 current->nr_dirtied_pause)
611 ctf_integer(unsigned long, paused,
612 (jiffies - start_time) * 1000 / HZ)
613 ctf_integer(long, pause, pause * 1000 / HZ)
614 ctf_integer(unsigned long, period,
615 period * 1000 / HZ)
616 ctf_integer(long, think,
617 current->dirty_paused_when == 0 ? 0 :
618 (long)(jiffies - current->dirty_paused_when) * 1000/HZ)
619 )
620)
621
622#else /* #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
623
624LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages,
625
626 writeback_balance_dirty_pages,
627
628 TP_PROTO(struct backing_dev_info *bdi,
629 unsigned long thresh,
630 unsigned long bg_thresh,
631 unsigned long dirty,
632 unsigned long bdi_thresh,
633 unsigned long bdi_dirty,
634 unsigned long dirty_ratelimit,
635 unsigned long task_ratelimit,
636 unsigned long dirtied,
637#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
638 unsigned long period,
639#endif
640 long pause,
641 unsigned long start_time),
642
643 TP_ARGS(bdi, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty,
644 dirty_ratelimit, task_ratelimit,
645#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
646 dirtied, period, pause, start_time
647#else
648 dirtied, pause, start_time
649#endif
650 ),
651
652 TP_FIELDS(
653 ctf_array_text(char, bdi, dev_name(bdi->dev), 32)
654 ctf_integer(unsigned long, limit, global_dirty_limit)
655 ctf_integer(unsigned long, setpoint,
656 (global_dirty_limit + (thresh + bg_thresh) / 2) / 2)
657 ctf_integer(unsigned long, dirty, dirty)
658 ctf_integer(unsigned long, bdi_setpoint,
659 ((global_dirty_limit + (thresh + bg_thresh) / 2) / 2) *
660 bdi_thresh / (thresh + 1))
661 ctf_integer(unsigned long, bdi_dirty, bdi_dirty)
662 ctf_integer(unsigned long, dirty_ratelimit,
663 KBps(dirty_ratelimit))
664 ctf_integer(unsigned long, task_ratelimit,
665 KBps(task_ratelimit))
666 ctf_integer(unsigned int, dirtied, dirtied)
667 ctf_integer(unsigned int, dirtied_pause,
668 current->nr_dirtied_pause)
669 ctf_integer(unsigned long, paused,
670 (jiffies - start_time) * 1000 / HZ)
671 ctf_integer(long, pause, pause * 1000 / HZ)
672#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
673 ctf_integer(unsigned long, period,
674 period * 1000 / HZ)
675 ctf_integer(long, think,
676 current->dirty_paused_when == 0 ? 0 :
677 (long)(jiffies - current->dirty_paused_when) * 1000/HZ)
678#endif
679 )
680)
681#endif /* #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
682
683#endif /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) */
684
685#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
686LTTNG_TRACEPOINT_EVENT(writeback_sb_inodes_requeue,
687
688 TP_PROTO(struct inode *inode),
689 TP_ARGS(inode),
690
691 TP_FIELDS(
692 ctf_array_text(char, name,
693 dev_name(lttng_inode_to_bdi(inode)->dev), 32)
694 ctf_integer(unsigned long, ino, inode->i_ino)
695 ctf_integer(unsigned long, state, inode->i_state)
696 ctf_integer(unsigned long, dirtied_when, inode->dirtied_when)
697 )
698)
699#endif
700
701#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
702LTTNG_TRACEPOINT_EVENT_CLASS(writeback_congest_waited_template,
703
704 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
705
706 TP_ARGS(usec_timeout, usec_delayed),
707
708 TP_FIELDS(
709 ctf_integer(unsigned int, usec_timeout, usec_timeout)
710 ctf_integer(unsigned int, usec_delayed, usec_delayed)
711 )
712)
713
714LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_congestion_wait,
715
716 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
717
718 TP_ARGS(usec_timeout, usec_delayed)
719)
720
721LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_wait_iff_congested,
722
723 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
724
725 TP_ARGS(usec_timeout, usec_delayed)
726)
727#endif
728
729#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
730LTTNG_TRACEPOINT_EVENT_CLASS(writeback_single_inode_template,
731
732 TP_PROTO(struct inode *inode,
733 struct writeback_control *wbc,
734 unsigned long nr_to_write
735 ),
736
737 TP_ARGS(inode, wbc, nr_to_write),
738
739 TP_FIELDS(
740 ctf_array_text(char, name,
741 dev_name(lttng_inode_to_bdi(inode)->dev), 32)
742 ctf_integer(unsigned long, ino, inode->i_ino)
743 ctf_integer(unsigned long, state, inode->i_state)
744 ctf_integer(unsigned long, dirtied_when, inode->dirtied_when)
745 ctf_integer(unsigned long, writeback_index,
746 inode->i_mapping->writeback_index)
747 ctf_integer(long, nr_to_write, nr_to_write)
748 ctf_integer(unsigned long, wrote,
749 nr_to_write - wbc->nr_to_write)
750 )
751)
752
753#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
754LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template, writeback_single_inode_requeue,
755 TP_PROTO(struct inode *inode,
756 struct writeback_control *wbc,
757 unsigned long nr_to_write),
758 TP_ARGS(inode, wbc, nr_to_write)
759)
760#endif
761
762LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template, writeback_single_inode,
763 TP_PROTO(struct inode *inode,
764 struct writeback_control *wbc,
765 unsigned long nr_to_write),
766 TP_ARGS(inode, wbc, nr_to_write)
767)
768#endif
769
770#endif /* LTTNG_TRACE_WRITEBACK_H */
771
772/* This part must be outside protection */
773#include <probes/define_trace.h>
This page took 0.026779 seconds and 4 git commands to generate.