1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM writeback
5 #if !defined(LTTNG_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define LTTNG_TRACE_WRITEBACK_H
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>
14 #ifndef _TRACE_WRITEBACK_DEF_
15 #define _TRACE_WRITEBACK_DEF_
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.
25 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0))
26 static inline struct backing_dev_info
*lttng_inode_to_bdi(struct inode
*inode
)
28 struct super_block
*sb
;
31 return &noop_backing_dev_info
;
35 if (strcmp(sb
->s_type
->name
, "bdev") == 0)
36 return inode
->i_mapping
->backing_dev_info
;
41 static inline struct backing_dev_info
*lttng_inode_to_bdi(struct inode
*inode
)
43 return inode_to_bdi(inode
);
45 #endif /* #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)) */
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"}, \
56 {I_WILL_FREE, "I_WILL_FREE"}, \
57 {I_FREEING, "I_FREEING"}, \
58 {I_CLEAR, "I_CLEAR"}, \
60 {I_DIRTY_TIME, "I_DIRTY_TIME"}, \
61 {I_REFERENCED, "I_REFERENCED"} \
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"}, \
70 {I_WILL_FREE, "I_WILL_FREE"}, \
71 {I_FREEING, "I_FREEING"}, \
72 {I_CLEAR, "I_CLEAR"}, \
74 {I_DIRTY_TIME, "I_DIRTY_TIME"}, \
75 {I_DIRTY_TIME_EXPIRED, "I_DIRTY_TIME_EXPIRED"}, \
76 {I_REFERENCED, "I_REFERENCED"} \
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"}, \
85 {I_WILL_FREE, "I_WILL_FREE"}, \
86 {I_FREEING, "I_FREEING"}, \
87 {I_CLEAR, "I_CLEAR"}, \
89 {I_REFERENCED, "I_REFERENCED"} \
91 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
93 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
95 LTTNG_TRACEPOINT_EVENT(writeback_dirty_page
,
96 TP_PROTO(struct page
*page
, struct address_space
*mapping
),
97 TP_ARGS(page
, mapping
),
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
)
106 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_dirty_inode_template
,
107 TP_PROTO(struct inode
*inode
, int flags
),
108 TP_ARGS(inode
, flags
),
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
)
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
)
127 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_write_inode_template
,
128 TP_PROTO(struct inode
*inode
, struct writeback_control
*wbc
),
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
)
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), \
142 LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode_start
)
143 LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode
)
145 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
147 LTTNG_TRACEPOINT_EVENT(writeback_dirty_page
,
148 TP_PROTO(struct page
*page
, struct address_space
*mapping
),
149 TP_ARGS(page
, mapping
),
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
)
158 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_dirty_inode_template
,
159 TP_PROTO(struct inode
*inode
, int flags
),
160 TP_ARGS(inode
, flags
),
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
)
167 ctf_integer(unsigned long, ino
, inode
->i_ino
)
168 ctf_integer(unsigned long, flags
, flags
)
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
)
178 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_write_inode_template
,
179 TP_PROTO(struct inode
*inode
, struct writeback_control
*wbc
),
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
)
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), \
193 LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode_start
)
194 LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode
)
196 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
198 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
200 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class
,
201 TP_PROTO(struct bdi_writeback
*wb
, struct wb_writeback_work
*work
),
204 ctf_array_text(char, name
, wb
->bdi
->dev
? dev_name(wb
->bdi
->dev
) :
209 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
211 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class
,
212 TP_PROTO(struct backing_dev_info
*bdi
, struct wb_writeback_work
*work
),
215 ctf_array_text(char, name
, bdi
->dev
? dev_name(bdi
->dev
) :
220 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
222 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class
,
223 TP_PROTO(struct backing_dev_info
*bdi
, struct wb_writeback_work
*work
),
226 ctf_array_text(char, name
,
227 dev_name(bdi
->dev
? bdi
->dev
:
228 default_backing_dev_info
.dev
), 32)
232 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
234 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
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), \
241 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
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), \
248 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
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
)
259 LTTNG_TRACEPOINT_EVENT(writeback_pages_written
,
260 TP_PROTO(long pages_written
),
261 TP_ARGS(pages_written
),
263 ctf_integer(long, pages
, pages_written
)
267 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
269 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_class
,
270 TP_PROTO(struct bdi_writeback
*wb
),
273 ctf_array_text(char, name
,
274 dev_name(wb
->bdi
->dev
), 32)
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), \
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), \
289 LTTNG_TRACEPOINT_EVENT(writeback_bdi_register
,
290 TP_PROTO(struct backing_dev_info
*bdi
),
293 ctf_array_text(char, name
,
294 dev_name(bdi
->dev
), 32)
298 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
300 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_class
,
301 TP_PROTO(struct backing_dev_info
*bdi
),
304 ctf_array_text(char, name
,
305 dev_name(bdi
->dev
), 32)
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), \
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), \
320 DEFINE_WRITEBACK_EVENT(writeback_bdi_register
)
322 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
324 DEFINE_WRITEBACK_EVENT(writeback_nowork
)
325 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
326 DEFINE_WRITEBACK_EVENT(writeback_wake_background
)
328 DEFINE_WRITEBACK_EVENT(writeback_wake_thread
)
329 DEFINE_WRITEBACK_EVENT(writeback_wake_forker_thread
)
330 DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister
)
331 DEFINE_WRITEBACK_EVENT(writeback_thread_start
)
332 DEFINE_WRITEBACK_EVENT(writeback_thread_stop
)
333 #if (LTTNG_KERNEL_RANGE(3,1,0, 3,2,0))
334 DEFINE_WRITEBACK_EVENT_MAP(balance_dirty_start
, writeback_balance_dirty_start
)
335 DEFINE_WRITEBACK_EVENT_MAP(balance_dirty_wait
, writeback_balance_dirty_wait
)
337 LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_written
,
339 writeback_balance_dirty_written
,
341 TP_PROTO(struct backing_dev_info
*bdi
, int written
),
343 TP_ARGS(bdi
, written
),
346 ctf_array_text(char, name
, dev_name(bdi
->dev
), 32)
347 ctf_integer(int, written
, written
)
352 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_wbc_class
,
353 TP_PROTO(struct writeback_control
*wbc
, struct backing_dev_info
*bdi
),
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)
369 ctf_integer(long, range_start
, (long) wbc
->range_start
)
370 ctf_integer(long, range_end
, (long) wbc
->range_end
)
374 #undef DEFINE_WBC_EVENT
375 #define LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(name, map) \
376 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_wbc_class, name, map, \
377 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \
379 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
380 LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_start
, writeback_wbc_writeback_start
)
381 LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_written
, writeback_wbc_writeback_written
)
382 LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_wait
, writeback_wbc_writeback_wait
)
383 LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_start
, writeback_wbc_balance_dirty_start
)
384 LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_written
, writeback_wbc_balance_dirty_written
)
385 LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait
, writeback_wbc_balance_dirty_wait
)
387 LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage
, writeback_wbc_writepage
)
389 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
390 LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \
391 LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \
392 LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \
393 LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \
394 LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \
395 LTTNG_KERNEL_RANGE(4,4,235, 4,5,0))
396 LTTNG_TRACEPOINT_EVENT(writeback_queue_io
,
397 TP_PROTO(struct bdi_writeback
*wb
,
398 struct wb_writeback_work
*work
,
399 unsigned long dirtied_before
,
401 TP_ARGS(wb
, work
, dirtied_before
, moved
),
403 ctf_array_text(char, name
, dev_name(wb
->bdi
->dev
), 32)
404 ctf_integer(unsigned long, older
, dirtied_before
)
405 ctf_integer(int, moved
, moved
)
408 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
409 LTTNG_TRACEPOINT_EVENT(writeback_queue_io
,
410 TP_PROTO(struct bdi_writeback
*wb
,
411 struct wb_writeback_work
*work
,
413 TP_ARGS(wb
, work
, moved
),
415 ctf_array_text(char, name
, dev_name(wb
->bdi
->dev
), 32)
416 ctf_integer(int, moved
, moved
)
419 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
420 LTTNG_TRACEPOINT_EVENT(writeback_queue_io
,
421 TP_PROTO(struct bdi_writeback
*wb
,
422 unsigned long *older_than_this
,
424 TP_ARGS(wb
, older_than_this
, moved
),
426 ctf_array_text(char, name
, dev_name(wb
->bdi
->dev
), 32)
427 ctf_integer(unsigned long, older
,
428 older_than_this
? *older_than_this
: 0)
429 ctf_integer(long, age
,
431 (jiffies
- *older_than_this
) * 1000 / HZ
433 ctf_integer(int, moved
, moved
)
438 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
439 LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state
,
441 writeback_global_dirty_state
,
443 TP_PROTO(unsigned long background_thresh
,
444 unsigned long dirty_thresh
447 TP_ARGS(background_thresh
,
452 ctf_integer(unsigned long, nr_dirty
, global_node_page_state(NR_FILE_DIRTY
))
453 ctf_integer(unsigned long, nr_writeback
, global_node_page_state(NR_WRITEBACK
))
454 ctf_integer(unsigned long, nr_dirtied
, global_node_page_state(NR_DIRTIED
))
455 ctf_integer(unsigned long, nr_written
, global_node_page_state(NR_WRITTEN
))
456 ctf_integer(unsigned long, background_thresh
, background_thresh
)
457 ctf_integer(unsigned long, dirty_thresh
, dirty_thresh
)
458 ctf_integer(unsigned long, dirty_limit
, global_dirty_limit
)
461 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
462 LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state
,
464 writeback_global_dirty_state
,
466 TP_PROTO(unsigned long background_thresh
,
467 unsigned long dirty_thresh
470 TP_ARGS(background_thresh
,
475 ctf_integer(unsigned long, nr_dirty
, global_node_page_state(NR_FILE_DIRTY
))
476 ctf_integer(unsigned long, nr_writeback
, global_node_page_state(NR_WRITEBACK
))
477 ctf_integer(unsigned long, nr_unstable
, global_node_page_state(NR_UNSTABLE_NFS
))
478 ctf_integer(unsigned long, nr_dirtied
, global_node_page_state(NR_DIRTIED
))
479 ctf_integer(unsigned long, nr_written
, global_node_page_state(NR_WRITTEN
))
480 ctf_integer(unsigned long, background_thresh
, background_thresh
)
481 ctf_integer(unsigned long, dirty_thresh
, dirty_thresh
)
482 ctf_integer(unsigned long, dirty_limit
, global_dirty_limit
)
485 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
486 LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state
,
488 writeback_global_dirty_state
,
490 TP_PROTO(unsigned long background_thresh
,
491 unsigned long dirty_thresh
494 TP_ARGS(background_thresh
,
499 ctf_integer(unsigned long, nr_dirty
, global_page_state(NR_FILE_DIRTY
))
500 ctf_integer(unsigned long, nr_writeback
, global_page_state(NR_WRITEBACK
))
501 ctf_integer(unsigned long, nr_unstable
, global_page_state(NR_UNSTABLE_NFS
))
502 ctf_integer(unsigned long, nr_dirtied
, global_page_state(NR_DIRTIED
))
503 ctf_integer(unsigned long, nr_written
, global_page_state(NR_WRITTEN
))
504 ctf_integer(unsigned long, background_thresh
, background_thresh
)
505 ctf_integer(unsigned long, dirty_thresh
, dirty_thresh
)
506 ctf_integer(unsigned long, dirty_limit
, global_dirty_limit
)
511 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
513 #define KBps(x) ((x) << (PAGE_SHIFT - 10))
515 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
517 LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit
,
519 writeback_bdi_dirty_ratelimit
,
521 TP_PROTO(struct bdi_writeback
*wb
,
522 unsigned long dirty_rate
,
523 unsigned long task_ratelimit
),
525 TP_ARGS(wb
, dirty_rate
, task_ratelimit
),
528 ctf_array_text(char, bdi
, dev_name(wb
->bdi
->dev
), 32)
529 ctf_integer(unsigned long, write_bw
, KBps(wb
->bdi
->wb
.write_bandwidth
))
530 ctf_integer(unsigned long, avg_write_bw
, KBps(wb
->bdi
->wb
.avg_write_bandwidth
))
531 ctf_integer(unsigned long, dirty_rate
, KBps(dirty_rate
))
532 ctf_integer(unsigned long, dirty_ratelimit
, KBps(wb
->bdi
->wb
.dirty_ratelimit
))
533 ctf_integer(unsigned long, task_ratelimit
, KBps(task_ratelimit
))
534 ctf_integer(unsigned long, balanced_dirty_ratelimit
,
535 KBps(wb
->bdi
->wb
.balanced_dirty_ratelimit
))
539 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0))
541 LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit
,
543 writeback_bdi_dirty_ratelimit
,
545 TP_PROTO(struct backing_dev_info
*bdi
,
546 unsigned long dirty_rate
,
547 unsigned long task_ratelimit
),
549 TP_ARGS(bdi
, dirty_rate
, task_ratelimit
),
552 ctf_array_text(char, bdi
, dev_name(bdi
->dev
), 32)
553 ctf_integer(unsigned long, write_bw
, KBps(bdi
->wb
.write_bandwidth
))
554 ctf_integer(unsigned long, avg_write_bw
, KBps(bdi
->wb
.avg_write_bandwidth
))
555 ctf_integer(unsigned long, dirty_rate
, KBps(dirty_rate
))
556 ctf_integer(unsigned long, dirty_ratelimit
, KBps(bdi
->wb
.dirty_ratelimit
))
557 ctf_integer(unsigned long, task_ratelimit
, KBps(task_ratelimit
))
558 ctf_integer(unsigned long, balanced_dirty_ratelimit
,
559 KBps(bdi
->wb
.balanced_dirty_ratelimit
))
563 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) */
565 LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit
,
567 writeback_bdi_dirty_ratelimit
,
569 TP_PROTO(struct backing_dev_info
*bdi
,
570 unsigned long dirty_rate
,
571 unsigned long task_ratelimit
),
573 TP_ARGS(bdi
, dirty_rate
, task_ratelimit
),
576 ctf_array_text(char, bdi
, dev_name(bdi
->dev
), 32)
577 ctf_integer(unsigned long, write_bw
, KBps(bdi
->write_bandwidth
))
578 ctf_integer(unsigned long, avg_write_bw
, KBps(bdi
->avg_write_bandwidth
))
579 ctf_integer(unsigned long, dirty_rate
, KBps(dirty_rate
))
580 ctf_integer(unsigned long, dirty_ratelimit
, KBps(bdi
->dirty_ratelimit
))
581 ctf_integer(unsigned long, task_ratelimit
, KBps(task_ratelimit
))
582 ctf_integer(unsigned long, balanced_dirty_ratelimit
,
583 KBps(bdi
->balanced_dirty_ratelimit
))
587 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) */
589 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
591 LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages
,
593 writeback_balance_dirty_pages
,
595 TP_PROTO(struct bdi_writeback
*wb
,
596 unsigned long thresh
,
597 unsigned long bg_thresh
,
599 unsigned long bdi_thresh
,
600 unsigned long bdi_dirty
,
601 unsigned long dirty_ratelimit
,
602 unsigned long task_ratelimit
,
603 unsigned long dirtied
,
604 unsigned long period
,
606 unsigned long start_time
),
608 TP_ARGS(wb
, thresh
, bg_thresh
, dirty
, bdi_thresh
, bdi_dirty
,
609 dirty_ratelimit
, task_ratelimit
,
610 dirtied
, period
, pause
, start_time
614 ctf_array_text(char, bdi
, dev_name(wb
->bdi
->dev
), 32)
615 ctf_integer(unsigned long, limit
, global_dirty_limit
)
616 ctf_integer(unsigned long, setpoint
,
617 (global_dirty_limit
+ (thresh
+ bg_thresh
) / 2) / 2)
618 ctf_integer(unsigned long, dirty
, dirty
)
619 ctf_integer(unsigned long, bdi_setpoint
,
620 ((global_dirty_limit
+ (thresh
+ bg_thresh
) / 2) / 2) *
621 bdi_thresh
/ (thresh
+ 1))
622 ctf_integer(unsigned long, bdi_dirty
, bdi_dirty
)
623 ctf_integer(unsigned long, dirty_ratelimit
,
624 KBps(dirty_ratelimit
))
625 ctf_integer(unsigned long, task_ratelimit
,
626 KBps(task_ratelimit
))
627 ctf_integer(unsigned int, dirtied
, dirtied
)
628 ctf_integer(unsigned int, dirtied_pause
,
629 current
->nr_dirtied_pause
)
630 ctf_integer(unsigned long, paused
,
631 (jiffies
- start_time
) * 1000 / HZ
)
632 ctf_integer(long, pause
, pause
* 1000 / HZ
)
633 ctf_integer(unsigned long, period
,
635 ctf_integer(long, think
,
636 current
->dirty_paused_when
== 0 ? 0 :
637 (long)(jiffies
- current
->dirty_paused_when
) * 1000/HZ
)
641 #else /* #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
643 LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages
,
645 writeback_balance_dirty_pages
,
647 TP_PROTO(struct backing_dev_info
*bdi
,
648 unsigned long thresh
,
649 unsigned long bg_thresh
,
651 unsigned long bdi_thresh
,
652 unsigned long bdi_dirty
,
653 unsigned long dirty_ratelimit
,
654 unsigned long task_ratelimit
,
655 unsigned long dirtied
,
656 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
657 unsigned long period
,
660 unsigned long start_time
),
662 TP_ARGS(bdi
, thresh
, bg_thresh
, dirty
, bdi_thresh
, bdi_dirty
,
663 dirty_ratelimit
, task_ratelimit
,
664 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
665 dirtied
, period
, pause
, start_time
667 dirtied
, pause
, start_time
672 ctf_array_text(char, bdi
, dev_name(bdi
->dev
), 32)
673 ctf_integer(unsigned long, limit
, global_dirty_limit
)
674 ctf_integer(unsigned long, setpoint
,
675 (global_dirty_limit
+ (thresh
+ bg_thresh
) / 2) / 2)
676 ctf_integer(unsigned long, dirty
, dirty
)
677 ctf_integer(unsigned long, bdi_setpoint
,
678 ((global_dirty_limit
+ (thresh
+ bg_thresh
) / 2) / 2) *
679 bdi_thresh
/ (thresh
+ 1))
680 ctf_integer(unsigned long, bdi_dirty
, bdi_dirty
)
681 ctf_integer(unsigned long, dirty_ratelimit
,
682 KBps(dirty_ratelimit
))
683 ctf_integer(unsigned long, task_ratelimit
,
684 KBps(task_ratelimit
))
685 ctf_integer(unsigned int, dirtied
, dirtied
)
686 ctf_integer(unsigned int, dirtied_pause
,
687 current
->nr_dirtied_pause
)
688 ctf_integer(unsigned long, paused
,
689 (jiffies
- start_time
) * 1000 / HZ
)
690 ctf_integer(long, pause
, pause
* 1000 / HZ
)
691 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
692 ctf_integer(unsigned long, period
,
694 ctf_integer(long, think
,
695 current
->dirty_paused_when
== 0 ? 0 :
696 (long)(jiffies
- current
->dirty_paused_when
) * 1000/HZ
)
700 #endif /* #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
702 #endif /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) */
704 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
705 LTTNG_TRACEPOINT_EVENT(writeback_sb_inodes_requeue
,
707 TP_PROTO(struct inode
*inode
),
711 ctf_array_text(char, name
,
712 dev_name(lttng_inode_to_bdi(inode
)->dev
), 32)
713 ctf_integer(unsigned long, ino
, inode
->i_ino
)
714 ctf_integer(unsigned long, state
, inode
->i_state
)
715 ctf_integer(unsigned long, dirtied_when
, inode
->dirtied_when
)
720 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
721 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_congest_waited_template
,
723 TP_PROTO(unsigned int usec_timeout
, unsigned int usec_delayed
),
725 TP_ARGS(usec_timeout
, usec_delayed
),
728 ctf_integer(unsigned int, usec_timeout
, usec_timeout
)
729 ctf_integer(unsigned int, usec_delayed
, usec_delayed
)
733 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template
, writeback_congestion_wait
,
735 TP_PROTO(unsigned int usec_timeout
, unsigned int usec_delayed
),
737 TP_ARGS(usec_timeout
, usec_delayed
)
740 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template
, writeback_wait_iff_congested
,
742 TP_PROTO(unsigned int usec_timeout
, unsigned int usec_delayed
),
744 TP_ARGS(usec_timeout
, usec_delayed
)
748 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
749 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_single_inode_template
,
751 TP_PROTO(struct inode
*inode
,
752 struct writeback_control
*wbc
,
753 unsigned long nr_to_write
756 TP_ARGS(inode
, wbc
, nr_to_write
),
759 ctf_array_text(char, name
,
760 dev_name(lttng_inode_to_bdi(inode
)->dev
), 32)
761 ctf_integer(unsigned long, ino
, inode
->i_ino
)
762 ctf_integer(unsigned long, state
, inode
->i_state
)
763 ctf_integer(unsigned long, dirtied_when
, inode
->dirtied_when
)
764 ctf_integer(unsigned long, writeback_index
,
765 inode
->i_mapping
->writeback_index
)
766 ctf_integer(long, nr_to_write
, nr_to_write
)
767 ctf_integer(unsigned long, wrote
,
768 nr_to_write
- wbc
->nr_to_write
)
772 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
773 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template
, writeback_single_inode_requeue
,
774 TP_PROTO(struct inode
*inode
,
775 struct writeback_control
*wbc
,
776 unsigned long nr_to_write
),
777 TP_ARGS(inode
, wbc
, nr_to_write
)
781 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template
, writeback_single_inode
,
782 TP_PROTO(struct inode
*inode
,
783 struct writeback_control
*wbc
,
784 unsigned long nr_to_write
),
785 TP_ARGS(inode
, wbc
, nr_to_write
)
789 #endif /* LTTNG_TRACE_WRITEBACK_H */
791 /* This part must be outside protection */
792 #include <probes/define_trace.h>