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_REFERENCED, "I_REFERENCED"} \
26 /* enums need to be exported to user space */
29 #define EM(a,b) TRACE_DEFINE_ENUM(a);
30 #define EMe(a,b) TRACE_DEFINE_ENUM(a);
32 #define WB_WORK_REASON \
33 EM( WB_REASON_BACKGROUND, "background") \
34 EM( WB_REASON_VMSCAN, "vmscan") \
35 EM( WB_REASON_SYNC, "sync") \
36 EM( WB_REASON_PERIODIC, "periodic") \
37 EM( WB_REASON_LAPTOP_TIMER, "laptop_timer") \
38 EM( WB_REASON_FS_FREE_SPACE, "fs_free_space") \
39 EMe(WB_REASON_FORKER_THREAD, "forker_thread")
44 * Now redefine the EM() and EMe() macros to map the enums to the strings
45 * that will be printed in the output.
49 #define EM(a,b) { a, b },
50 #define EMe(a,b) { a, b }
52 struct wb_writeback_work
;
54 DECLARE_EVENT_CLASS(writeback_page_template
,
56 TP_PROTO(struct page
*page
, struct address_space
*mapping
),
58 TP_ARGS(page
, mapping
),
61 __array(char, name
, 32)
63 __field(pgoff_t
, index
)
67 strscpy_pad(__entry
->name
,
68 bdi_dev_name(mapping
? inode_to_bdi(mapping
->host
) :
70 __entry
->ino
= mapping
? mapping
->host
->i_ino
: 0;
71 __entry
->index
= page
->index
;
74 TP_printk("bdi %s: ino=%lu index=%lu",
76 (unsigned long)__entry
->ino
,
81 DEFINE_EVENT(writeback_page_template
, writeback_dirty_page
,
83 TP_PROTO(struct page
*page
, struct address_space
*mapping
),
85 TP_ARGS(page
, mapping
)
88 DEFINE_EVENT(writeback_page_template
, wait_on_page_writeback
,
90 TP_PROTO(struct page
*page
, struct address_space
*mapping
),
92 TP_ARGS(page
, mapping
)
95 DECLARE_EVENT_CLASS(writeback_dirty_inode_template
,
97 TP_PROTO(struct inode
*inode
, int flags
),
99 TP_ARGS(inode
, flags
),
102 __array(char, name
, 32)
104 __field(unsigned long, state
)
105 __field(unsigned long, flags
)
109 struct backing_dev_info
*bdi
= inode_to_bdi(inode
);
111 /* may be called for files on pseudo FSes w/ unregistered bdi */
112 strscpy_pad(__entry
->name
, bdi_dev_name(bdi
), 32);
113 __entry
->ino
= inode
->i_ino
;
114 __entry
->state
= inode
->i_state
;
115 __entry
->flags
= flags
;
118 TP_printk("bdi %s: ino=%lu state=%s flags=%s",
120 (unsigned long)__entry
->ino
,
121 show_inode_state(__entry
->state
),
122 show_inode_state(__entry
->flags
)
126 DEFINE_EVENT(writeback_dirty_inode_template
, writeback_mark_inode_dirty
,
128 TP_PROTO(struct inode
*inode
, int flags
),
130 TP_ARGS(inode
, flags
)
133 DEFINE_EVENT(writeback_dirty_inode_template
, writeback_dirty_inode_start
,
135 TP_PROTO(struct inode
*inode
, int flags
),
137 TP_ARGS(inode
, flags
)
140 DEFINE_EVENT(writeback_dirty_inode_template
, writeback_dirty_inode
,
142 TP_PROTO(struct inode
*inode
, int flags
),
144 TP_ARGS(inode
, flags
)
147 #ifdef CREATE_TRACE_POINTS
148 #ifdef CONFIG_CGROUP_WRITEBACK
150 static inline ino_t
__trace_wb_assign_cgroup(struct bdi_writeback
*wb
)
152 return cgroup_ino(wb
->memcg_css
->cgroup
);
155 static inline ino_t
__trace_wbc_assign_cgroup(struct writeback_control
*wbc
)
158 return __trace_wb_assign_cgroup(wbc
->wb
);
162 #else /* CONFIG_CGROUP_WRITEBACK */
164 static inline ino_t
__trace_wb_assign_cgroup(struct bdi_writeback
*wb
)
169 static inline ino_t
__trace_wbc_assign_cgroup(struct writeback_control
*wbc
)
174 #endif /* CONFIG_CGROUP_WRITEBACK */
175 #endif /* CREATE_TRACE_POINTS */
177 #ifdef CONFIG_CGROUP_WRITEBACK
178 TRACE_EVENT(inode_foreign_history
,
180 TP_PROTO(struct inode
*inode
, struct writeback_control
*wbc
,
181 unsigned int history
),
183 TP_ARGS(inode
, wbc
, history
),
186 __array(char, name
, 32)
188 __field(ino_t
, cgroup_ino
)
189 __field(unsigned int, history
)
193 strscpy_pad(__entry
->name
, bdi_dev_name(inode_to_bdi(inode
)), 32);
194 __entry
->ino
= inode
->i_ino
;
195 __entry
->cgroup_ino
= __trace_wbc_assign_cgroup(wbc
);
196 __entry
->history
= history
;
199 TP_printk("bdi %s: ino=%lu cgroup_ino=%lu history=0x%x",
201 (unsigned long)__entry
->ino
,
202 (unsigned long)__entry
->cgroup_ino
,
207 TRACE_EVENT(inode_switch_wbs
,
209 TP_PROTO(struct inode
*inode
, struct bdi_writeback
*old_wb
,
210 struct bdi_writeback
*new_wb
),
212 TP_ARGS(inode
, old_wb
, new_wb
),
215 __array(char, name
, 32)
217 __field(ino_t
, old_cgroup_ino
)
218 __field(ino_t
, new_cgroup_ino
)
222 strscpy_pad(__entry
->name
, bdi_dev_name(old_wb
->bdi
), 32);
223 __entry
->ino
= inode
->i_ino
;
224 __entry
->old_cgroup_ino
= __trace_wb_assign_cgroup(old_wb
);
225 __entry
->new_cgroup_ino
= __trace_wb_assign_cgroup(new_wb
);
228 TP_printk("bdi %s: ino=%lu old_cgroup_ino=%lu new_cgroup_ino=%lu",
230 (unsigned long)__entry
->ino
,
231 (unsigned long)__entry
->old_cgroup_ino
,
232 (unsigned long)__entry
->new_cgroup_ino
236 TRACE_EVENT(track_foreign_dirty
,
238 TP_PROTO(struct page
*page
, struct bdi_writeback
*wb
),
243 __array(char, name
, 32)
246 __field(unsigned int, memcg_id
)
247 __field(ino_t
, cgroup_ino
)
248 __field(ino_t
, page_cgroup_ino
)
252 struct address_space
*mapping
= page_mapping(page
);
253 struct inode
*inode
= mapping
? mapping
->host
: NULL
;
255 strscpy_pad(__entry
->name
, bdi_dev_name(wb
->bdi
), 32);
256 __entry
->bdi_id
= wb
->bdi
->id
;
257 __entry
->ino
= inode
? inode
->i_ino
: 0;
258 __entry
->memcg_id
= wb
->memcg_css
->id
;
259 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
260 __entry
->page_cgroup_ino
= cgroup_ino(page_memcg(page
)->css
.cgroup
);
263 TP_printk("bdi %s[%llu]: ino=%lu memcg_id=%u cgroup_ino=%lu page_cgroup_ino=%lu",
266 (unsigned long)__entry
->ino
,
268 (unsigned long)__entry
->cgroup_ino
,
269 (unsigned long)__entry
->page_cgroup_ino
273 TRACE_EVENT(flush_foreign
,
275 TP_PROTO(struct bdi_writeback
*wb
, unsigned int frn_bdi_id
,
276 unsigned int frn_memcg_id
),
278 TP_ARGS(wb
, frn_bdi_id
, frn_memcg_id
),
281 __array(char, name
, 32)
282 __field(ino_t
, cgroup_ino
)
283 __field(unsigned int, frn_bdi_id
)
284 __field(unsigned int, frn_memcg_id
)
288 strscpy_pad(__entry
->name
, bdi_dev_name(wb
->bdi
), 32);
289 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
290 __entry
->frn_bdi_id
= frn_bdi_id
;
291 __entry
->frn_memcg_id
= frn_memcg_id
;
294 TP_printk("bdi %s: cgroup_ino=%lu frn_bdi_id=%u frn_memcg_id=%u",
296 (unsigned long)__entry
->cgroup_ino
,
298 __entry
->frn_memcg_id
303 DECLARE_EVENT_CLASS(writeback_write_inode_template
,
305 TP_PROTO(struct inode
*inode
, struct writeback_control
*wbc
),
310 __array(char, name
, 32)
312 __field(int, sync_mode
)
313 __field(ino_t
, cgroup_ino
)
317 strscpy_pad(__entry
->name
,
318 bdi_dev_name(inode_to_bdi(inode
)), 32);
319 __entry
->ino
= inode
->i_ino
;
320 __entry
->sync_mode
= wbc
->sync_mode
;
321 __entry
->cgroup_ino
= __trace_wbc_assign_cgroup(wbc
);
324 TP_printk("bdi %s: ino=%lu sync_mode=%d cgroup_ino=%lu",
326 (unsigned long)__entry
->ino
,
328 (unsigned long)__entry
->cgroup_ino
332 DEFINE_EVENT(writeback_write_inode_template
, writeback_write_inode_start
,
334 TP_PROTO(struct inode
*inode
, struct writeback_control
*wbc
),
339 DEFINE_EVENT(writeback_write_inode_template
, writeback_write_inode
,
341 TP_PROTO(struct inode
*inode
, struct writeback_control
*wbc
),
346 DECLARE_EVENT_CLASS(writeback_work_class
,
347 TP_PROTO(struct bdi_writeback
*wb
, struct wb_writeback_work
*work
),
350 __array(char, name
, 32)
351 __field(long, nr_pages
)
352 __field(dev_t
, sb_dev
)
353 __field(int, sync_mode
)
354 __field(int, for_kupdate
)
355 __field(int, range_cyclic
)
356 __field(int, for_background
)
358 __field(ino_t
, cgroup_ino
)
361 strscpy_pad(__entry
->name
, bdi_dev_name(wb
->bdi
), 32);
362 __entry
->nr_pages
= work
->nr_pages
;
363 __entry
->sb_dev
= work
->sb
? work
->sb
->s_dev
: 0;
364 __entry
->sync_mode
= work
->sync_mode
;
365 __entry
->for_kupdate
= work
->for_kupdate
;
366 __entry
->range_cyclic
= work
->range_cyclic
;
367 __entry
->for_background
= work
->for_background
;
368 __entry
->reason
= work
->reason
;
369 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
371 TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d "
372 "kupdate=%d range_cyclic=%d background=%d reason=%s cgroup_ino=%lu",
374 MAJOR(__entry
->sb_dev
), MINOR(__entry
->sb_dev
),
377 __entry
->for_kupdate
,
378 __entry
->range_cyclic
,
379 __entry
->for_background
,
380 __print_symbolic(__entry
->reason
, WB_WORK_REASON
),
381 (unsigned long)__entry
->cgroup_ino
384 #define DEFINE_WRITEBACK_WORK_EVENT(name) \
385 DEFINE_EVENT(writeback_work_class, name, \
386 TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work), \
388 DEFINE_WRITEBACK_WORK_EVENT(writeback_queue
);
389 DEFINE_WRITEBACK_WORK_EVENT(writeback_exec
);
390 DEFINE_WRITEBACK_WORK_EVENT(writeback_start
);
391 DEFINE_WRITEBACK_WORK_EVENT(writeback_written
);
392 DEFINE_WRITEBACK_WORK_EVENT(writeback_wait
);
394 TRACE_EVENT(writeback_pages_written
,
395 TP_PROTO(long pages_written
),
396 TP_ARGS(pages_written
),
401 __entry
->pages
= pages_written
;
403 TP_printk("%ld", __entry
->pages
)
406 DECLARE_EVENT_CLASS(writeback_class
,
407 TP_PROTO(struct bdi_writeback
*wb
),
410 __array(char, name
, 32)
411 __field(ino_t
, cgroup_ino
)
414 strscpy_pad(__entry
->name
, bdi_dev_name(wb
->bdi
), 32);
415 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
417 TP_printk("bdi %s: cgroup_ino=%lu",
419 (unsigned long)__entry
->cgroup_ino
422 #define DEFINE_WRITEBACK_EVENT(name) \
423 DEFINE_EVENT(writeback_class, name, \
424 TP_PROTO(struct bdi_writeback *wb), \
427 DEFINE_WRITEBACK_EVENT(writeback_wake_background
);
429 TRACE_EVENT(writeback_bdi_register
,
430 TP_PROTO(struct backing_dev_info
*bdi
),
433 __array(char, name
, 32)
436 strscpy_pad(__entry
->name
, bdi_dev_name(bdi
), 32);
443 DECLARE_EVENT_CLASS(wbc_class
,
444 TP_PROTO(struct writeback_control
*wbc
, struct backing_dev_info
*bdi
),
447 __array(char, name
, 32)
448 __field(long, nr_to_write
)
449 __field(long, pages_skipped
)
450 __field(int, sync_mode
)
451 __field(int, for_kupdate
)
452 __field(int, for_background
)
453 __field(int, for_reclaim
)
454 __field(int, range_cyclic
)
455 __field(long, range_start
)
456 __field(long, range_end
)
457 __field(ino_t
, cgroup_ino
)
461 strscpy_pad(__entry
->name
, bdi_dev_name(bdi
), 32);
462 __entry
->nr_to_write
= wbc
->nr_to_write
;
463 __entry
->pages_skipped
= wbc
->pages_skipped
;
464 __entry
->sync_mode
= wbc
->sync_mode
;
465 __entry
->for_kupdate
= wbc
->for_kupdate
;
466 __entry
->for_background
= wbc
->for_background
;
467 __entry
->for_reclaim
= wbc
->for_reclaim
;
468 __entry
->range_cyclic
= wbc
->range_cyclic
;
469 __entry
->range_start
= (long)wbc
->range_start
;
470 __entry
->range_end
= (long)wbc
->range_end
;
471 __entry
->cgroup_ino
= __trace_wbc_assign_cgroup(wbc
);
474 TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d "
475 "bgrd=%d reclm=%d cyclic=%d "
476 "start=0x%lx end=0x%lx cgroup_ino=%lu",
478 __entry
->nr_to_write
,
479 __entry
->pages_skipped
,
481 __entry
->for_kupdate
,
482 __entry
->for_background
,
483 __entry
->for_reclaim
,
484 __entry
->range_cyclic
,
485 __entry
->range_start
,
487 (unsigned long)__entry
->cgroup_ino
491 #define DEFINE_WBC_EVENT(name) \
492 DEFINE_EVENT(wbc_class, name, \
493 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \
495 DEFINE_WBC_EVENT(wbc_writepage
);
497 TRACE_EVENT(writeback_queue_io
,
498 TP_PROTO(struct bdi_writeback
*wb
,
499 struct wb_writeback_work
*work
,
500 unsigned long dirtied_before
,
502 TP_ARGS(wb
, work
, dirtied_before
, moved
),
504 __array(char, name
, 32)
505 __field(unsigned long, older
)
509 __field(ino_t
, cgroup_ino
)
512 strscpy_pad(__entry
->name
, bdi_dev_name(wb
->bdi
), 32);
513 __entry
->older
= dirtied_before
;
514 __entry
->age
= (jiffies
- dirtied_before
) * 1000 / HZ
;
515 __entry
->moved
= moved
;
516 __entry
->reason
= work
->reason
;
517 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
519 TP_printk("bdi %s: older=%lu age=%ld enqueue=%d reason=%s cgroup_ino=%lu",
521 __entry
->older
, /* dirtied_before in jiffies */
522 __entry
->age
, /* dirtied_before in relative milliseconds */
524 __print_symbolic(__entry
->reason
, WB_WORK_REASON
),
525 (unsigned long)__entry
->cgroup_ino
529 TRACE_EVENT(global_dirty_state
,
531 TP_PROTO(unsigned long background_thresh
,
532 unsigned long dirty_thresh
535 TP_ARGS(background_thresh
,
540 __field(unsigned long, nr_dirty
)
541 __field(unsigned long, nr_writeback
)
542 __field(unsigned long, background_thresh
)
543 __field(unsigned long, dirty_thresh
)
544 __field(unsigned long, dirty_limit
)
545 __field(unsigned long, nr_dirtied
)
546 __field(unsigned long, nr_written
)
550 __entry
->nr_dirty
= global_node_page_state(NR_FILE_DIRTY
);
551 __entry
->nr_writeback
= global_node_page_state(NR_WRITEBACK
);
552 __entry
->nr_dirtied
= global_node_page_state(NR_DIRTIED
);
553 __entry
->nr_written
= global_node_page_state(NR_WRITTEN
);
554 __entry
->background_thresh
= background_thresh
;
555 __entry
->dirty_thresh
= dirty_thresh
;
556 __entry
->dirty_limit
= global_wb_domain
.dirty_limit
;
559 TP_printk("dirty=%lu writeback=%lu "
560 "bg_thresh=%lu thresh=%lu limit=%lu "
561 "dirtied=%lu written=%lu",
563 __entry
->nr_writeback
,
564 __entry
->background_thresh
,
565 __entry
->dirty_thresh
,
566 __entry
->dirty_limit
,
572 #define KBps(x) ((x) << (PAGE_SHIFT - 10))
574 TRACE_EVENT(bdi_dirty_ratelimit
,
576 TP_PROTO(struct bdi_writeback
*wb
,
577 unsigned long dirty_rate
,
578 unsigned long task_ratelimit
),
580 TP_ARGS(wb
, dirty_rate
, task_ratelimit
),
583 __array(char, bdi
, 32)
584 __field(unsigned long, write_bw
)
585 __field(unsigned long, avg_write_bw
)
586 __field(unsigned long, dirty_rate
)
587 __field(unsigned long, dirty_ratelimit
)
588 __field(unsigned long, task_ratelimit
)
589 __field(unsigned long, balanced_dirty_ratelimit
)
590 __field(ino_t
, cgroup_ino
)
594 strscpy_pad(__entry
->bdi
, bdi_dev_name(wb
->bdi
), 32);
595 __entry
->write_bw
= KBps(wb
->write_bandwidth
);
596 __entry
->avg_write_bw
= KBps(wb
->avg_write_bandwidth
);
597 __entry
->dirty_rate
= KBps(dirty_rate
);
598 __entry
->dirty_ratelimit
= KBps(wb
->dirty_ratelimit
);
599 __entry
->task_ratelimit
= KBps(task_ratelimit
);
600 __entry
->balanced_dirty_ratelimit
=
601 KBps(wb
->balanced_dirty_ratelimit
);
602 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
606 "write_bw=%lu awrite_bw=%lu dirty_rate=%lu "
607 "dirty_ratelimit=%lu task_ratelimit=%lu "
608 "balanced_dirty_ratelimit=%lu cgroup_ino=%lu",
610 __entry
->write_bw
, /* write bandwidth */
611 __entry
->avg_write_bw
, /* avg write bandwidth */
612 __entry
->dirty_rate
, /* bdi dirty rate */
613 __entry
->dirty_ratelimit
, /* base ratelimit */
614 __entry
->task_ratelimit
, /* ratelimit with position control */
615 __entry
->balanced_dirty_ratelimit
, /* the balanced ratelimit */
616 (unsigned long)__entry
->cgroup_ino
620 TRACE_EVENT(balance_dirty_pages
,
622 TP_PROTO(struct bdi_writeback
*wb
,
623 unsigned long thresh
,
624 unsigned long bg_thresh
,
626 unsigned long bdi_thresh
,
627 unsigned long bdi_dirty
,
628 unsigned long dirty_ratelimit
,
629 unsigned long task_ratelimit
,
630 unsigned long dirtied
,
631 unsigned long period
,
633 unsigned long start_time
),
635 TP_ARGS(wb
, thresh
, bg_thresh
, dirty
, bdi_thresh
, bdi_dirty
,
636 dirty_ratelimit
, task_ratelimit
,
637 dirtied
, period
, pause
, start_time
),
640 __array( char, bdi
, 32)
641 __field(unsigned long, limit
)
642 __field(unsigned long, setpoint
)
643 __field(unsigned long, dirty
)
644 __field(unsigned long, bdi_setpoint
)
645 __field(unsigned long, bdi_dirty
)
646 __field(unsigned long, dirty_ratelimit
)
647 __field(unsigned long, task_ratelimit
)
648 __field(unsigned int, dirtied
)
649 __field(unsigned int, dirtied_pause
)
650 __field(unsigned long, paused
)
651 __field( long, pause
)
652 __field(unsigned long, period
)
653 __field( long, think
)
654 __field(ino_t
, cgroup_ino
)
658 unsigned long freerun
= (thresh
+ bg_thresh
) / 2;
659 strscpy_pad(__entry
->bdi
, bdi_dev_name(wb
->bdi
), 32);
661 __entry
->limit
= global_wb_domain
.dirty_limit
;
662 __entry
->setpoint
= (global_wb_domain
.dirty_limit
+
664 __entry
->dirty
= dirty
;
665 __entry
->bdi_setpoint
= __entry
->setpoint
*
666 bdi_thresh
/ (thresh
+ 1);
667 __entry
->bdi_dirty
= bdi_dirty
;
668 __entry
->dirty_ratelimit
= KBps(dirty_ratelimit
);
669 __entry
->task_ratelimit
= KBps(task_ratelimit
);
670 __entry
->dirtied
= dirtied
;
671 __entry
->dirtied_pause
= current
->nr_dirtied_pause
;
672 __entry
->think
= current
->dirty_paused_when
== 0 ? 0 :
673 (long)(jiffies
- current
->dirty_paused_when
) * 1000/HZ
;
674 __entry
->period
= period
* 1000 / HZ
;
675 __entry
->pause
= pause
* 1000 / HZ
;
676 __entry
->paused
= (jiffies
- start_time
) * 1000 / HZ
;
677 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
682 "limit=%lu setpoint=%lu dirty=%lu "
683 "bdi_setpoint=%lu bdi_dirty=%lu "
684 "dirty_ratelimit=%lu task_ratelimit=%lu "
685 "dirtied=%u dirtied_pause=%u "
686 "paused=%lu pause=%ld period=%lu think=%ld cgroup_ino=%lu",
691 __entry
->bdi_setpoint
,
693 __entry
->dirty_ratelimit
,
694 __entry
->task_ratelimit
,
696 __entry
->dirtied_pause
,
697 __entry
->paused
, /* ms */
698 __entry
->pause
, /* ms */
699 __entry
->period
, /* ms */
700 __entry
->think
, /* ms */
701 (unsigned long)__entry
->cgroup_ino
705 TRACE_EVENT(writeback_sb_inodes_requeue
,
707 TP_PROTO(struct inode
*inode
),
711 __array(char, name
, 32)
713 __field(unsigned long, state
)
714 __field(unsigned long, dirtied_when
)
715 __field(ino_t
, cgroup_ino
)
719 strscpy_pad(__entry
->name
,
720 bdi_dev_name(inode_to_bdi(inode
)), 32);
721 __entry
->ino
= inode
->i_ino
;
722 __entry
->state
= inode
->i_state
;
723 __entry
->dirtied_when
= inode
->dirtied_when
;
724 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(inode_to_wb(inode
));
727 TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu cgroup_ino=%lu",
729 (unsigned long)__entry
->ino
,
730 show_inode_state(__entry
->state
),
731 __entry
->dirtied_when
,
732 (jiffies
- __entry
->dirtied_when
) / HZ
,
733 (unsigned long)__entry
->cgroup_ino
737 DECLARE_EVENT_CLASS(writeback_congest_waited_template
,
739 TP_PROTO(unsigned int usec_timeout
, unsigned int usec_delayed
),
741 TP_ARGS(usec_timeout
, usec_delayed
),
744 __field( unsigned int, usec_timeout
)
745 __field( unsigned int, usec_delayed
)
749 __entry
->usec_timeout
= usec_timeout
;
750 __entry
->usec_delayed
= usec_delayed
;
753 TP_printk("usec_timeout=%u usec_delayed=%u",
754 __entry
->usec_timeout
,
755 __entry
->usec_delayed
)
758 DEFINE_EVENT(writeback_congest_waited_template
, writeback_congestion_wait
,
760 TP_PROTO(unsigned int usec_timeout
, unsigned int usec_delayed
),
762 TP_ARGS(usec_timeout
, usec_delayed
)
765 DEFINE_EVENT(writeback_congest_waited_template
, writeback_wait_iff_congested
,
767 TP_PROTO(unsigned int usec_timeout
, unsigned int usec_delayed
),
769 TP_ARGS(usec_timeout
, usec_delayed
)
772 DECLARE_EVENT_CLASS(writeback_single_inode_template
,
774 TP_PROTO(struct inode
*inode
,
775 struct writeback_control
*wbc
,
776 unsigned long nr_to_write
779 TP_ARGS(inode
, wbc
, nr_to_write
),
782 __array(char, name
, 32)
784 __field(unsigned long, state
)
785 __field(unsigned long, dirtied_when
)
786 __field(unsigned long, writeback_index
)
787 __field(long, nr_to_write
)
788 __field(unsigned long, wrote
)
789 __field(ino_t
, cgroup_ino
)
793 strscpy_pad(__entry
->name
,
794 bdi_dev_name(inode_to_bdi(inode
)), 32);
795 __entry
->ino
= inode
->i_ino
;
796 __entry
->state
= inode
->i_state
;
797 __entry
->dirtied_when
= inode
->dirtied_when
;
798 __entry
->writeback_index
= inode
->i_mapping
->writeback_index
;
799 __entry
->nr_to_write
= nr_to_write
;
800 __entry
->wrote
= nr_to_write
- wbc
->nr_to_write
;
801 __entry
->cgroup_ino
= __trace_wbc_assign_cgroup(wbc
);
804 TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu "
805 "index=%lu to_write=%ld wrote=%lu cgroup_ino=%lu",
807 (unsigned long)__entry
->ino
,
808 show_inode_state(__entry
->state
),
809 __entry
->dirtied_when
,
810 (jiffies
- __entry
->dirtied_when
) / HZ
,
811 __entry
->writeback_index
,
812 __entry
->nr_to_write
,
814 (unsigned long)__entry
->cgroup_ino
818 DEFINE_EVENT(writeback_single_inode_template
, writeback_single_inode_start
,
819 TP_PROTO(struct inode
*inode
,
820 struct writeback_control
*wbc
,
821 unsigned long nr_to_write
),
822 TP_ARGS(inode
, wbc
, nr_to_write
)
825 DEFINE_EVENT(writeback_single_inode_template
, writeback_single_inode
,
826 TP_PROTO(struct inode
*inode
,
827 struct writeback_control
*wbc
,
828 unsigned long nr_to_write
),
829 TP_ARGS(inode
, wbc
, nr_to_write
)
832 DECLARE_EVENT_CLASS(writeback_inode_template
,
833 TP_PROTO(struct inode
*inode
),
838 __field( dev_t
, dev
)
839 __field( ino_t
, ino
)
840 __field(unsigned long, state
)
841 __field( __u16
, mode
)
842 __field(unsigned long, dirtied_when
)
846 __entry
->dev
= inode
->i_sb
->s_dev
;
847 __entry
->ino
= inode
->i_ino
;
848 __entry
->state
= inode
->i_state
;
849 __entry
->mode
= inode
->i_mode
;
850 __entry
->dirtied_when
= inode
->dirtied_when
;
853 TP_printk("dev %d,%d ino %lu dirtied %lu state %s mode 0%o",
854 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
855 (unsigned long)__entry
->ino
, __entry
->dirtied_when
,
856 show_inode_state(__entry
->state
), __entry
->mode
)
859 DEFINE_EVENT(writeback_inode_template
, writeback_lazytime
,
860 TP_PROTO(struct inode
*inode
),
865 DEFINE_EVENT(writeback_inode_template
, writeback_lazytime_iput
,
866 TP_PROTO(struct inode
*inode
),
871 DEFINE_EVENT(writeback_inode_template
, writeback_dirty_inode_enqueue
,
873 TP_PROTO(struct inode
*inode
),
879 * Inode writeback list tracking.
882 DEFINE_EVENT(writeback_inode_template
, sb_mark_inode_writeback
,
883 TP_PROTO(struct inode
*inode
),
887 DEFINE_EVENT(writeback_inode_template
, sb_clear_inode_writeback
,
888 TP_PROTO(struct inode
*inode
),
892 #endif /* _TRACE_WRITEBACK_H */
894 /* This part must be outside protection */
895 #include <trace/define_trace.h>