1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM writeback
5 #if !defined(_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_WRITEBACK_H
8 #include <linux/tracepoint.h>
9 #include <linux/backing-dev.h>
10 #include <linux/writeback.h>
12 #define show_inode_state(state) \
13 __print_flags(state, "|", \
14 {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \
15 {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \
16 {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \
18 {I_WILL_FREE, "I_WILL_FREE"}, \
19 {I_FREEING, "I_FREEING"}, \
20 {I_CLEAR, "I_CLEAR"}, \
22 {I_DIRTY_TIME, "I_DIRTY_TIME"}, \
23 {I_DIRTY_TIME_EXPIRED, "I_DIRTY_TIME_EXPIRED"}, \
24 {I_REFERENCED, "I_REFERENCED"} \
27 /* enums need to be exported to user space */
30 #define EM(a,b) TRACE_DEFINE_ENUM(a);
31 #define EMe(a,b) TRACE_DEFINE_ENUM(a);
33 #define WB_WORK_REASON \
34 EM( WB_REASON_BACKGROUND, "background") \
35 EM( WB_REASON_VMSCAN, "vmscan") \
36 EM( WB_REASON_SYNC, "sync") \
37 EM( WB_REASON_PERIODIC, "periodic") \
38 EM( WB_REASON_LAPTOP_TIMER, "laptop_timer") \
39 EM( WB_REASON_FREE_MORE_MEM, "free_more_memory") \
40 EM( WB_REASON_FS_FREE_SPACE, "fs_free_space") \
41 EMe(WB_REASON_FORKER_THREAD, "forker_thread")
46 * Now redefine the EM() and EMe() macros to map the enums to the strings
47 * that will be printed in the output.
51 #define EM(a,b) { a, b },
52 #define EMe(a,b) { a, b }
54 struct wb_writeback_work
;
56 DECLARE_EVENT_CLASS(writeback_page_template
,
58 TP_PROTO(struct page
*page
, struct address_space
*mapping
),
60 TP_ARGS(page
, mapping
),
63 __array(char, name
, 32)
64 __field(unsigned long, ino
)
65 __field(pgoff_t
, index
)
69 strscpy_pad(__entry
->name
,
70 bdi_dev_name(mapping
? inode_to_bdi(mapping
->host
) :
72 __entry
->ino
= mapping
? mapping
->host
->i_ino
: 0;
73 __entry
->index
= page
->index
;
76 TP_printk("bdi %s: ino=%lu index=%lu",
83 DEFINE_EVENT(writeback_page_template
, writeback_dirty_page
,
85 TP_PROTO(struct page
*page
, struct address_space
*mapping
),
87 TP_ARGS(page
, mapping
)
90 DEFINE_EVENT(writeback_page_template
, wait_on_page_writeback
,
92 TP_PROTO(struct page
*page
, struct address_space
*mapping
),
94 TP_ARGS(page
, mapping
)
97 DECLARE_EVENT_CLASS(writeback_dirty_inode_template
,
99 TP_PROTO(struct inode
*inode
, int flags
),
101 TP_ARGS(inode
, flags
),
104 __array(char, name
, 32)
105 __field(unsigned long, ino
)
106 __field(unsigned long, state
)
107 __field(unsigned long, flags
)
111 struct backing_dev_info
*bdi
= inode_to_bdi(inode
);
113 /* may be called for files on pseudo FSes w/ unregistered bdi */
114 strscpy_pad(__entry
->name
, bdi_dev_name(bdi
), 32);
115 __entry
->ino
= inode
->i_ino
;
116 __entry
->state
= inode
->i_state
;
117 __entry
->flags
= flags
;
120 TP_printk("bdi %s: ino=%lu state=%s flags=%s",
123 show_inode_state(__entry
->state
),
124 show_inode_state(__entry
->flags
)
128 DEFINE_EVENT(writeback_dirty_inode_template
, writeback_mark_inode_dirty
,
130 TP_PROTO(struct inode
*inode
, int flags
),
132 TP_ARGS(inode
, flags
)
135 DEFINE_EVENT(writeback_dirty_inode_template
, writeback_dirty_inode_start
,
137 TP_PROTO(struct inode
*inode
, int flags
),
139 TP_ARGS(inode
, flags
)
142 DEFINE_EVENT(writeback_dirty_inode_template
, writeback_dirty_inode
,
144 TP_PROTO(struct inode
*inode
, int flags
),
146 TP_ARGS(inode
, flags
)
149 #ifdef CREATE_TRACE_POINTS
150 #ifdef CONFIG_CGROUP_WRITEBACK
152 static inline unsigned int __trace_wb_assign_cgroup(struct bdi_writeback
*wb
)
154 return wb
->memcg_css
->cgroup
->kn
->id
.ino
;
157 static inline unsigned int __trace_wbc_assign_cgroup(struct writeback_control
*wbc
)
160 return __trace_wb_assign_cgroup(wbc
->wb
);
164 #else /* CONFIG_CGROUP_WRITEBACK */
166 static inline unsigned int __trace_wb_assign_cgroup(struct bdi_writeback
*wb
)
171 static inline unsigned int __trace_wbc_assign_cgroup(struct writeback_control
*wbc
)
176 #endif /* CONFIG_CGROUP_WRITEBACK */
177 #endif /* CREATE_TRACE_POINTS */
179 #ifdef CONFIG_CGROUP_WRITEBACK
180 TRACE_EVENT(inode_foreign_history
,
182 TP_PROTO(struct inode
*inode
, struct writeback_control
*wbc
,
183 unsigned int history
),
185 TP_ARGS(inode
, wbc
, history
),
188 __array(char, name
, 32)
189 __field(unsigned long, ino
)
190 __field(unsigned int, cgroup_ino
)
191 __field(unsigned int, history
)
195 strncpy(__entry
->name
, bdi_dev_name(inode_to_bdi(inode
)), 32);
196 __entry
->ino
= inode
->i_ino
;
197 __entry
->cgroup_ino
= __trace_wbc_assign_cgroup(wbc
);
198 __entry
->history
= history
;
201 TP_printk("bdi %s: ino=%lu cgroup_ino=%u history=0x%x",
209 TRACE_EVENT(inode_switch_wbs
,
211 TP_PROTO(struct inode
*inode
, struct bdi_writeback
*old_wb
,
212 struct bdi_writeback
*new_wb
),
214 TP_ARGS(inode
, old_wb
, new_wb
),
217 __array(char, name
, 32)
218 __field(unsigned long, ino
)
219 __field(unsigned int, old_cgroup_ino
)
220 __field(unsigned int, new_cgroup_ino
)
224 strncpy(__entry
->name
, bdi_dev_name(old_wb
->bdi
), 32);
225 __entry
->ino
= inode
->i_ino
;
226 __entry
->old_cgroup_ino
= __trace_wb_assign_cgroup(old_wb
);
227 __entry
->new_cgroup_ino
= __trace_wb_assign_cgroup(new_wb
);
230 TP_printk("bdi %s: ino=%lu old_cgroup_ino=%u new_cgroup_ino=%u",
233 __entry
->old_cgroup_ino
,
234 __entry
->new_cgroup_ino
238 TRACE_EVENT(track_foreign_dirty
,
240 TP_PROTO(struct page
*page
, struct bdi_writeback
*wb
),
245 __array(char, name
, 32)
247 __field(unsigned long, ino
)
248 __field(unsigned int, memcg_id
)
249 __field(unsigned int, cgroup_ino
)
250 __field(unsigned int, page_cgroup_ino
)
254 struct address_space
*mapping
= page_mapping(page
);
255 struct inode
*inode
= mapping
? mapping
->host
: NULL
;
257 strncpy(__entry
->name
, bdi_dev_name(wb
->bdi
), 32);
258 __entry
->bdi_id
= wb
->bdi
->id
;
259 __entry
->ino
= inode
? inode
->i_ino
: 0;
260 __entry
->memcg_id
= wb
->memcg_css
->id
;
261 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
262 __entry
->page_cgroup_ino
= page
->mem_cgroup
->css
.cgroup
->kn
->id
.ino
;
265 TP_printk("bdi %s[%llu]: ino=%lu memcg_id=%u cgroup_ino=%u page_cgroup_ino=%u",
271 __entry
->page_cgroup_ino
275 TRACE_EVENT(flush_foreign
,
277 TP_PROTO(struct bdi_writeback
*wb
, unsigned int frn_bdi_id
,
278 unsigned int frn_memcg_id
),
280 TP_ARGS(wb
, frn_bdi_id
, frn_memcg_id
),
283 __array(char, name
, 32)
284 __field(unsigned int, cgroup_ino
)
285 __field(unsigned int, frn_bdi_id
)
286 __field(unsigned int, frn_memcg_id
)
290 strncpy(__entry
->name
, bdi_dev_name(wb
->bdi
), 32);
291 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
292 __entry
->frn_bdi_id
= frn_bdi_id
;
293 __entry
->frn_memcg_id
= frn_memcg_id
;
296 TP_printk("bdi %s: cgroup_ino=%u frn_bdi_id=%u frn_memcg_id=%u",
300 __entry
->frn_memcg_id
305 DECLARE_EVENT_CLASS(writeback_write_inode_template
,
307 TP_PROTO(struct inode
*inode
, struct writeback_control
*wbc
),
312 __array(char, name
, 32)
313 __field(unsigned long, ino
)
314 __field(int, sync_mode
)
315 __field(unsigned int, cgroup_ino
)
319 strscpy_pad(__entry
->name
,
320 bdi_dev_name(inode_to_bdi(inode
)), 32);
321 __entry
->ino
= inode
->i_ino
;
322 __entry
->sync_mode
= wbc
->sync_mode
;
323 __entry
->cgroup_ino
= __trace_wbc_assign_cgroup(wbc
);
326 TP_printk("bdi %s: ino=%lu sync_mode=%d cgroup_ino=%u",
334 DEFINE_EVENT(writeback_write_inode_template
, writeback_write_inode_start
,
336 TP_PROTO(struct inode
*inode
, struct writeback_control
*wbc
),
341 DEFINE_EVENT(writeback_write_inode_template
, writeback_write_inode
,
343 TP_PROTO(struct inode
*inode
, struct writeback_control
*wbc
),
348 DECLARE_EVENT_CLASS(writeback_work_class
,
349 TP_PROTO(struct bdi_writeback
*wb
, struct wb_writeback_work
*work
),
352 __array(char, name
, 32)
353 __field(long, nr_pages
)
354 __field(dev_t
, sb_dev
)
355 __field(int, sync_mode
)
356 __field(int, for_kupdate
)
357 __field(int, range_cyclic
)
358 __field(int, for_background
)
360 __field(unsigned int, cgroup_ino
)
363 strscpy_pad(__entry
->name
, bdi_dev_name(wb
->bdi
), 32);
364 __entry
->nr_pages
= work
->nr_pages
;
365 __entry
->sb_dev
= work
->sb
? work
->sb
->s_dev
: 0;
366 __entry
->sync_mode
= work
->sync_mode
;
367 __entry
->for_kupdate
= work
->for_kupdate
;
368 __entry
->range_cyclic
= work
->range_cyclic
;
369 __entry
->for_background
= work
->for_background
;
370 __entry
->reason
= work
->reason
;
371 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
373 TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d "
374 "kupdate=%d range_cyclic=%d background=%d reason=%s cgroup_ino=%u",
376 MAJOR(__entry
->sb_dev
), MINOR(__entry
->sb_dev
),
379 __entry
->for_kupdate
,
380 __entry
->range_cyclic
,
381 __entry
->for_background
,
382 __print_symbolic(__entry
->reason
, WB_WORK_REASON
),
386 #define DEFINE_WRITEBACK_WORK_EVENT(name) \
387 DEFINE_EVENT(writeback_work_class, name, \
388 TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work), \
390 DEFINE_WRITEBACK_WORK_EVENT(writeback_queue
);
391 DEFINE_WRITEBACK_WORK_EVENT(writeback_exec
);
392 DEFINE_WRITEBACK_WORK_EVENT(writeback_start
);
393 DEFINE_WRITEBACK_WORK_EVENT(writeback_written
);
394 DEFINE_WRITEBACK_WORK_EVENT(writeback_wait
);
396 TRACE_EVENT(writeback_pages_written
,
397 TP_PROTO(long pages_written
),
398 TP_ARGS(pages_written
),
403 __entry
->pages
= pages_written
;
405 TP_printk("%ld", __entry
->pages
)
408 DECLARE_EVENT_CLASS(writeback_class
,
409 TP_PROTO(struct bdi_writeback
*wb
),
412 __array(char, name
, 32)
413 __field(unsigned int, cgroup_ino
)
416 strscpy_pad(__entry
->name
, bdi_dev_name(wb
->bdi
), 32);
417 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
419 TP_printk("bdi %s: cgroup_ino=%u",
424 #define DEFINE_WRITEBACK_EVENT(name) \
425 DEFINE_EVENT(writeback_class, name, \
426 TP_PROTO(struct bdi_writeback *wb), \
429 DEFINE_WRITEBACK_EVENT(writeback_wake_background
);
431 TRACE_EVENT(writeback_bdi_register
,
432 TP_PROTO(struct backing_dev_info
*bdi
),
435 __array(char, name
, 32)
438 strscpy_pad(__entry
->name
, bdi_dev_name(bdi
), 32);
445 DECLARE_EVENT_CLASS(wbc_class
,
446 TP_PROTO(struct writeback_control
*wbc
, struct backing_dev_info
*bdi
),
449 __array(char, name
, 32)
450 __field(long, nr_to_write
)
451 __field(long, pages_skipped
)
452 __field(int, sync_mode
)
453 __field(int, for_kupdate
)
454 __field(int, for_background
)
455 __field(int, for_reclaim
)
456 __field(int, range_cyclic
)
457 __field(long, range_start
)
458 __field(long, range_end
)
459 __field(unsigned int, cgroup_ino
)
463 strscpy_pad(__entry
->name
, bdi_dev_name(bdi
), 32);
464 __entry
->nr_to_write
= wbc
->nr_to_write
;
465 __entry
->pages_skipped
= wbc
->pages_skipped
;
466 __entry
->sync_mode
= wbc
->sync_mode
;
467 __entry
->for_kupdate
= wbc
->for_kupdate
;
468 __entry
->for_background
= wbc
->for_background
;
469 __entry
->for_reclaim
= wbc
->for_reclaim
;
470 __entry
->range_cyclic
= wbc
->range_cyclic
;
471 __entry
->range_start
= (long)wbc
->range_start
;
472 __entry
->range_end
= (long)wbc
->range_end
;
473 __entry
->cgroup_ino
= __trace_wbc_assign_cgroup(wbc
);
476 TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d "
477 "bgrd=%d reclm=%d cyclic=%d "
478 "start=0x%lx end=0x%lx cgroup_ino=%u",
480 __entry
->nr_to_write
,
481 __entry
->pages_skipped
,
483 __entry
->for_kupdate
,
484 __entry
->for_background
,
485 __entry
->for_reclaim
,
486 __entry
->range_cyclic
,
487 __entry
->range_start
,
493 #define DEFINE_WBC_EVENT(name) \
494 DEFINE_EVENT(wbc_class, name, \
495 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \
497 DEFINE_WBC_EVENT(wbc_writepage
);
499 TRACE_EVENT(writeback_queue_io
,
500 TP_PROTO(struct bdi_writeback
*wb
,
501 struct wb_writeback_work
*work
,
502 unsigned long dirtied_before
,
504 TP_ARGS(wb
, work
, dirtied_before
, moved
),
506 __array(char, name
, 32)
507 __field(unsigned long, older
)
511 __field(unsigned int, cgroup_ino
)
514 strscpy_pad(__entry
->name
, bdi_dev_name(wb
->bdi
), 32);
515 __entry
->older
= dirtied_before
;
516 __entry
->age
= (jiffies
- dirtied_before
) * 1000 / HZ
;
517 __entry
->moved
= moved
;
518 __entry
->reason
= work
->reason
;
519 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
521 TP_printk("bdi %s: older=%lu age=%ld enqueue=%d reason=%s cgroup_ino=%u",
523 __entry
->older
, /* dirtied_before in jiffies */
524 __entry
->age
, /* dirtied_before in relative milliseconds */
526 __print_symbolic(__entry
->reason
, WB_WORK_REASON
),
531 TRACE_EVENT(global_dirty_state
,
533 TP_PROTO(unsigned long background_thresh
,
534 unsigned long dirty_thresh
537 TP_ARGS(background_thresh
,
542 __field(unsigned long, nr_dirty
)
543 __field(unsigned long, nr_writeback
)
544 __field(unsigned long, nr_unstable
)
545 __field(unsigned long, background_thresh
)
546 __field(unsigned long, dirty_thresh
)
547 __field(unsigned long, dirty_limit
)
548 __field(unsigned long, nr_dirtied
)
549 __field(unsigned long, nr_written
)
553 __entry
->nr_dirty
= global_node_page_state(NR_FILE_DIRTY
);
554 __entry
->nr_writeback
= global_node_page_state(NR_WRITEBACK
);
555 __entry
->nr_unstable
= global_node_page_state(NR_UNSTABLE_NFS
);
556 __entry
->nr_dirtied
= global_node_page_state(NR_DIRTIED
);
557 __entry
->nr_written
= global_node_page_state(NR_WRITTEN
);
558 __entry
->background_thresh
= background_thresh
;
559 __entry
->dirty_thresh
= dirty_thresh
;
560 __entry
->dirty_limit
= global_wb_domain
.dirty_limit
;
563 TP_printk("dirty=%lu writeback=%lu unstable=%lu "
564 "bg_thresh=%lu thresh=%lu limit=%lu "
565 "dirtied=%lu written=%lu",
567 __entry
->nr_writeback
,
568 __entry
->nr_unstable
,
569 __entry
->background_thresh
,
570 __entry
->dirty_thresh
,
571 __entry
->dirty_limit
,
577 #define KBps(x) ((x) << (PAGE_SHIFT - 10))
579 TRACE_EVENT(bdi_dirty_ratelimit
,
581 TP_PROTO(struct bdi_writeback
*wb
,
582 unsigned long dirty_rate
,
583 unsigned long task_ratelimit
),
585 TP_ARGS(wb
, dirty_rate
, task_ratelimit
),
588 __array(char, bdi
, 32)
589 __field(unsigned long, write_bw
)
590 __field(unsigned long, avg_write_bw
)
591 __field(unsigned long, dirty_rate
)
592 __field(unsigned long, dirty_ratelimit
)
593 __field(unsigned long, task_ratelimit
)
594 __field(unsigned long, balanced_dirty_ratelimit
)
595 __field(unsigned int, cgroup_ino
)
599 strscpy_pad(__entry
->bdi
, bdi_dev_name(wb
->bdi
), 32);
600 __entry
->write_bw
= KBps(wb
->write_bandwidth
);
601 __entry
->avg_write_bw
= KBps(wb
->avg_write_bandwidth
);
602 __entry
->dirty_rate
= KBps(dirty_rate
);
603 __entry
->dirty_ratelimit
= KBps(wb
->dirty_ratelimit
);
604 __entry
->task_ratelimit
= KBps(task_ratelimit
);
605 __entry
->balanced_dirty_ratelimit
=
606 KBps(wb
->balanced_dirty_ratelimit
);
607 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
611 "write_bw=%lu awrite_bw=%lu dirty_rate=%lu "
612 "dirty_ratelimit=%lu task_ratelimit=%lu "
613 "balanced_dirty_ratelimit=%lu cgroup_ino=%u",
615 __entry
->write_bw
, /* write bandwidth */
616 __entry
->avg_write_bw
, /* avg write bandwidth */
617 __entry
->dirty_rate
, /* bdi dirty rate */
618 __entry
->dirty_ratelimit
, /* base ratelimit */
619 __entry
->task_ratelimit
, /* ratelimit with position control */
620 __entry
->balanced_dirty_ratelimit
, /* the balanced ratelimit */
625 TRACE_EVENT(balance_dirty_pages
,
627 TP_PROTO(struct bdi_writeback
*wb
,
628 unsigned long thresh
,
629 unsigned long bg_thresh
,
631 unsigned long bdi_thresh
,
632 unsigned long bdi_dirty
,
633 unsigned long dirty_ratelimit
,
634 unsigned long task_ratelimit
,
635 unsigned long dirtied
,
636 unsigned long period
,
638 unsigned long start_time
),
640 TP_ARGS(wb
, thresh
, bg_thresh
, dirty
, bdi_thresh
, bdi_dirty
,
641 dirty_ratelimit
, task_ratelimit
,
642 dirtied
, period
, pause
, start_time
),
645 __array( char, bdi
, 32)
646 __field(unsigned long, limit
)
647 __field(unsigned long, setpoint
)
648 __field(unsigned long, dirty
)
649 __field(unsigned long, bdi_setpoint
)
650 __field(unsigned long, bdi_dirty
)
651 __field(unsigned long, dirty_ratelimit
)
652 __field(unsigned long, task_ratelimit
)
653 __field(unsigned int, dirtied
)
654 __field(unsigned int, dirtied_pause
)
655 __field(unsigned long, paused
)
656 __field( long, pause
)
657 __field(unsigned long, period
)
658 __field( long, think
)
659 __field(unsigned int, cgroup_ino
)
663 unsigned long freerun
= (thresh
+ bg_thresh
) / 2;
664 strscpy_pad(__entry
->bdi
, bdi_dev_name(wb
->bdi
), 32);
666 __entry
->limit
= global_wb_domain
.dirty_limit
;
667 __entry
->setpoint
= (global_wb_domain
.dirty_limit
+
669 __entry
->dirty
= dirty
;
670 __entry
->bdi_setpoint
= __entry
->setpoint
*
671 bdi_thresh
/ (thresh
+ 1);
672 __entry
->bdi_dirty
= bdi_dirty
;
673 __entry
->dirty_ratelimit
= KBps(dirty_ratelimit
);
674 __entry
->task_ratelimit
= KBps(task_ratelimit
);
675 __entry
->dirtied
= dirtied
;
676 __entry
->dirtied_pause
= current
->nr_dirtied_pause
;
677 __entry
->think
= current
->dirty_paused_when
== 0 ? 0 :
678 (long)(jiffies
- current
->dirty_paused_when
) * 1000/HZ
;
679 __entry
->period
= period
* 1000 / HZ
;
680 __entry
->pause
= pause
* 1000 / HZ
;
681 __entry
->paused
= (jiffies
- start_time
) * 1000 / HZ
;
682 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
687 "limit=%lu setpoint=%lu dirty=%lu "
688 "bdi_setpoint=%lu bdi_dirty=%lu "
689 "dirty_ratelimit=%lu task_ratelimit=%lu "
690 "dirtied=%u dirtied_pause=%u "
691 "paused=%lu pause=%ld period=%lu think=%ld cgroup_ino=%u",
696 __entry
->bdi_setpoint
,
698 __entry
->dirty_ratelimit
,
699 __entry
->task_ratelimit
,
701 __entry
->dirtied_pause
,
702 __entry
->paused
, /* ms */
703 __entry
->pause
, /* ms */
704 __entry
->period
, /* ms */
705 __entry
->think
, /* ms */
710 TRACE_EVENT(writeback_sb_inodes_requeue
,
712 TP_PROTO(struct inode
*inode
),
716 __array(char, name
, 32)
717 __field(unsigned long, ino
)
718 __field(unsigned long, state
)
719 __field(unsigned long, dirtied_when
)
720 __field(unsigned int, cgroup_ino
)
724 strscpy_pad(__entry
->name
,
725 bdi_dev_name(inode_to_bdi(inode
)), 32);
726 __entry
->ino
= inode
->i_ino
;
727 __entry
->state
= inode
->i_state
;
728 __entry
->dirtied_when
= inode
->dirtied_when
;
729 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(inode_to_wb(inode
));
732 TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu cgroup_ino=%u",
735 show_inode_state(__entry
->state
),
736 __entry
->dirtied_when
,
737 (jiffies
- __entry
->dirtied_when
) / HZ
,
742 DECLARE_EVENT_CLASS(writeback_congest_waited_template
,
744 TP_PROTO(unsigned int usec_timeout
, unsigned int usec_delayed
),
746 TP_ARGS(usec_timeout
, usec_delayed
),
749 __field( unsigned int, usec_timeout
)
750 __field( unsigned int, usec_delayed
)
754 __entry
->usec_timeout
= usec_timeout
;
755 __entry
->usec_delayed
= usec_delayed
;
758 TP_printk("usec_timeout=%u usec_delayed=%u",
759 __entry
->usec_timeout
,
760 __entry
->usec_delayed
)
763 DEFINE_EVENT(writeback_congest_waited_template
, writeback_congestion_wait
,
765 TP_PROTO(unsigned int usec_timeout
, unsigned int usec_delayed
),
767 TP_ARGS(usec_timeout
, usec_delayed
)
770 DEFINE_EVENT(writeback_congest_waited_template
, writeback_wait_iff_congested
,
772 TP_PROTO(unsigned int usec_timeout
, unsigned int usec_delayed
),
774 TP_ARGS(usec_timeout
, usec_delayed
)
777 DECLARE_EVENT_CLASS(writeback_single_inode_template
,
779 TP_PROTO(struct inode
*inode
,
780 struct writeback_control
*wbc
,
781 unsigned long nr_to_write
784 TP_ARGS(inode
, wbc
, nr_to_write
),
787 __array(char, name
, 32)
788 __field(unsigned long, ino
)
789 __field(unsigned long, state
)
790 __field(unsigned long, dirtied_when
)
791 __field(unsigned long, writeback_index
)
792 __field(long, nr_to_write
)
793 __field(unsigned long, wrote
)
794 __field(unsigned int, cgroup_ino
)
798 strscpy_pad(__entry
->name
,
799 bdi_dev_name(inode_to_bdi(inode
)), 32);
800 __entry
->ino
= inode
->i_ino
;
801 __entry
->state
= inode
->i_state
;
802 __entry
->dirtied_when
= inode
->dirtied_when
;
803 __entry
->writeback_index
= inode
->i_mapping
->writeback_index
;
804 __entry
->nr_to_write
= nr_to_write
;
805 __entry
->wrote
= nr_to_write
- wbc
->nr_to_write
;
806 __entry
->cgroup_ino
= __trace_wbc_assign_cgroup(wbc
);
809 TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu "
810 "index=%lu to_write=%ld wrote=%lu cgroup_ino=%u",
813 show_inode_state(__entry
->state
),
814 __entry
->dirtied_when
,
815 (jiffies
- __entry
->dirtied_when
) / HZ
,
816 __entry
->writeback_index
,
817 __entry
->nr_to_write
,
823 DEFINE_EVENT(writeback_single_inode_template
, writeback_single_inode_start
,
824 TP_PROTO(struct inode
*inode
,
825 struct writeback_control
*wbc
,
826 unsigned long nr_to_write
),
827 TP_ARGS(inode
, wbc
, nr_to_write
)
830 DEFINE_EVENT(writeback_single_inode_template
, writeback_single_inode
,
831 TP_PROTO(struct inode
*inode
,
832 struct writeback_control
*wbc
,
833 unsigned long nr_to_write
),
834 TP_ARGS(inode
, wbc
, nr_to_write
)
837 DECLARE_EVENT_CLASS(writeback_inode_template
,
838 TP_PROTO(struct inode
*inode
),
843 __field( dev_t
, dev
)
844 __field(unsigned long, ino
)
845 __field(unsigned long, state
)
846 __field( __u16
, mode
)
847 __field(unsigned long, dirtied_when
)
851 __entry
->dev
= inode
->i_sb
->s_dev
;
852 __entry
->ino
= inode
->i_ino
;
853 __entry
->state
= inode
->i_state
;
854 __entry
->mode
= inode
->i_mode
;
855 __entry
->dirtied_when
= inode
->dirtied_when
;
858 TP_printk("dev %d,%d ino %lu dirtied %lu state %s mode 0%o",
859 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
860 __entry
->ino
, __entry
->dirtied_when
,
861 show_inode_state(__entry
->state
), __entry
->mode
)
864 DEFINE_EVENT(writeback_inode_template
, writeback_lazytime
,
865 TP_PROTO(struct inode
*inode
),
870 DEFINE_EVENT(writeback_inode_template
, writeback_lazytime_iput
,
871 TP_PROTO(struct inode
*inode
),
876 DEFINE_EVENT(writeback_inode_template
, writeback_dirty_inode_enqueue
,
878 TP_PROTO(struct inode
*inode
),
884 * Inode writeback list tracking.
887 DEFINE_EVENT(writeback_inode_template
, sb_mark_inode_writeback
,
888 TP_PROTO(struct inode
*inode
),
892 DEFINE_EVENT(writeback_inode_template
, sb_clear_inode_writeback
,
893 TP_PROTO(struct inode
*inode
),
897 #endif /* _TRACE_WRITEBACK_H */
899 /* This part must be outside protection */
900 #include <trace/define_trace.h>