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)
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",
78 (unsigned long)__entry
->ino
,
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)
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",
122 (unsigned long)__entry
->ino
,
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 ino_t
__trace_wb_assign_cgroup(struct bdi_writeback
*wb
)
154 return cgroup_ino(wb
->memcg_css
->cgroup
);
157 static inline ino_t
__trace_wbc_assign_cgroup(struct writeback_control
*wbc
)
160 return __trace_wb_assign_cgroup(wbc
->wb
);
164 #else /* CONFIG_CGROUP_WRITEBACK */
166 static inline ino_t
__trace_wb_assign_cgroup(struct bdi_writeback
*wb
)
171 static inline ino_t
__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)
190 __field(ino_t
, 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=%lu history=0x%x",
203 (unsigned long)__entry
->ino
,
204 (unsigned long)__entry
->cgroup_ino
,
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)
219 __field(ino_t
, old_cgroup_ino
)
220 __field(ino_t
, 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=%lu new_cgroup_ino=%lu",
232 (unsigned long)__entry
->ino
,
233 (unsigned long)__entry
->old_cgroup_ino
,
234 (unsigned long)__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)
248 __field(unsigned int, memcg_id
)
249 __field(ino_t
, cgroup_ino
)
250 __field(ino_t
, 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
= cgroup_ino(page
->mem_cgroup
->css
.cgroup
);
265 TP_printk("bdi %s[%llu]: ino=%lu memcg_id=%u cgroup_ino=%lu page_cgroup_ino=%lu",
268 (unsigned long)__entry
->ino
,
270 (unsigned long)__entry
->cgroup_ino
,
271 (unsigned long)__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(ino_t
, 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=%lu frn_bdi_id=%u frn_memcg_id=%u",
298 (unsigned long)__entry
->cgroup_ino
,
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)
314 __field(int, sync_mode
)
315 __field(ino_t
, 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=%lu",
328 (unsigned long)__entry
->ino
,
330 (unsigned long)__entry
->cgroup_ino
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(ino_t
, 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=%lu",
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
),
383 (unsigned long)__entry
->cgroup_ino
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(ino_t
, 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=%lu",
421 (unsigned long)__entry
->cgroup_ino
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(ino_t
, 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=%lu",
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
,
489 (unsigned long)__entry
->cgroup_ino
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
,
503 TP_ARGS(wb
, work
, moved
),
505 __array(char, name
, 32)
506 __field(unsigned long, older
)
510 __field(ino_t
, cgroup_ino
)
513 unsigned long *older_than_this
= work
->older_than_this
;
514 strscpy_pad(__entry
->name
, bdi_dev_name(wb
->bdi
), 32);
515 __entry
->older
= older_than_this
? *older_than_this
: 0;
516 __entry
->age
= older_than_this
?
517 (jiffies
- *older_than_this
) * 1000 / HZ
: -1;
518 __entry
->moved
= moved
;
519 __entry
->reason
= work
->reason
;
520 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
522 TP_printk("bdi %s: older=%lu age=%ld enqueue=%d reason=%s cgroup_ino=%lu",
524 __entry
->older
, /* older_than_this in jiffies */
525 __entry
->age
, /* older_than_this in relative milliseconds */
527 __print_symbolic(__entry
->reason
, WB_WORK_REASON
),
528 (unsigned long)__entry
->cgroup_ino
532 TRACE_EVENT(global_dirty_state
,
534 TP_PROTO(unsigned long background_thresh
,
535 unsigned long dirty_thresh
538 TP_ARGS(background_thresh
,
543 __field(unsigned long, nr_dirty
)
544 __field(unsigned long, nr_writeback
)
545 __field(unsigned long, nr_unstable
)
546 __field(unsigned long, background_thresh
)
547 __field(unsigned long, dirty_thresh
)
548 __field(unsigned long, dirty_limit
)
549 __field(unsigned long, nr_dirtied
)
550 __field(unsigned long, nr_written
)
554 __entry
->nr_dirty
= global_node_page_state(NR_FILE_DIRTY
);
555 __entry
->nr_writeback
= global_node_page_state(NR_WRITEBACK
);
556 __entry
->nr_unstable
= global_node_page_state(NR_UNSTABLE_NFS
);
557 __entry
->nr_dirtied
= global_node_page_state(NR_DIRTIED
);
558 __entry
->nr_written
= global_node_page_state(NR_WRITTEN
);
559 __entry
->background_thresh
= background_thresh
;
560 __entry
->dirty_thresh
= dirty_thresh
;
561 __entry
->dirty_limit
= global_wb_domain
.dirty_limit
;
564 TP_printk("dirty=%lu writeback=%lu unstable=%lu "
565 "bg_thresh=%lu thresh=%lu limit=%lu "
566 "dirtied=%lu written=%lu",
568 __entry
->nr_writeback
,
569 __entry
->nr_unstable
,
570 __entry
->background_thresh
,
571 __entry
->dirty_thresh
,
572 __entry
->dirty_limit
,
578 #define KBps(x) ((x) << (PAGE_SHIFT - 10))
580 TRACE_EVENT(bdi_dirty_ratelimit
,
582 TP_PROTO(struct bdi_writeback
*wb
,
583 unsigned long dirty_rate
,
584 unsigned long task_ratelimit
),
586 TP_ARGS(wb
, dirty_rate
, task_ratelimit
),
589 __array(char, bdi
, 32)
590 __field(unsigned long, write_bw
)
591 __field(unsigned long, avg_write_bw
)
592 __field(unsigned long, dirty_rate
)
593 __field(unsigned long, dirty_ratelimit
)
594 __field(unsigned long, task_ratelimit
)
595 __field(unsigned long, balanced_dirty_ratelimit
)
596 __field(ino_t
, cgroup_ino
)
600 strscpy_pad(__entry
->bdi
, bdi_dev_name(wb
->bdi
), 32);
601 __entry
->write_bw
= KBps(wb
->write_bandwidth
);
602 __entry
->avg_write_bw
= KBps(wb
->avg_write_bandwidth
);
603 __entry
->dirty_rate
= KBps(dirty_rate
);
604 __entry
->dirty_ratelimit
= KBps(wb
->dirty_ratelimit
);
605 __entry
->task_ratelimit
= KBps(task_ratelimit
);
606 __entry
->balanced_dirty_ratelimit
=
607 KBps(wb
->balanced_dirty_ratelimit
);
608 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
612 "write_bw=%lu awrite_bw=%lu dirty_rate=%lu "
613 "dirty_ratelimit=%lu task_ratelimit=%lu "
614 "balanced_dirty_ratelimit=%lu cgroup_ino=%lu",
616 __entry
->write_bw
, /* write bandwidth */
617 __entry
->avg_write_bw
, /* avg write bandwidth */
618 __entry
->dirty_rate
, /* bdi dirty rate */
619 __entry
->dirty_ratelimit
, /* base ratelimit */
620 __entry
->task_ratelimit
, /* ratelimit with position control */
621 __entry
->balanced_dirty_ratelimit
, /* the balanced ratelimit */
622 (unsigned long)__entry
->cgroup_ino
626 TRACE_EVENT(balance_dirty_pages
,
628 TP_PROTO(struct bdi_writeback
*wb
,
629 unsigned long thresh
,
630 unsigned long bg_thresh
,
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 unsigned long period
,
639 unsigned long start_time
),
641 TP_ARGS(wb
, thresh
, bg_thresh
, dirty
, bdi_thresh
, bdi_dirty
,
642 dirty_ratelimit
, task_ratelimit
,
643 dirtied
, period
, pause
, start_time
),
646 __array( char, bdi
, 32)
647 __field(unsigned long, limit
)
648 __field(unsigned long, setpoint
)
649 __field(unsigned long, dirty
)
650 __field(unsigned long, bdi_setpoint
)
651 __field(unsigned long, bdi_dirty
)
652 __field(unsigned long, dirty_ratelimit
)
653 __field(unsigned long, task_ratelimit
)
654 __field(unsigned int, dirtied
)
655 __field(unsigned int, dirtied_pause
)
656 __field(unsigned long, paused
)
657 __field( long, pause
)
658 __field(unsigned long, period
)
659 __field( long, think
)
660 __field(ino_t
, cgroup_ino
)
664 unsigned long freerun
= (thresh
+ bg_thresh
) / 2;
665 strscpy_pad(__entry
->bdi
, bdi_dev_name(wb
->bdi
), 32);
667 __entry
->limit
= global_wb_domain
.dirty_limit
;
668 __entry
->setpoint
= (global_wb_domain
.dirty_limit
+
670 __entry
->dirty
= dirty
;
671 __entry
->bdi_setpoint
= __entry
->setpoint
*
672 bdi_thresh
/ (thresh
+ 1);
673 __entry
->bdi_dirty
= bdi_dirty
;
674 __entry
->dirty_ratelimit
= KBps(dirty_ratelimit
);
675 __entry
->task_ratelimit
= KBps(task_ratelimit
);
676 __entry
->dirtied
= dirtied
;
677 __entry
->dirtied_pause
= current
->nr_dirtied_pause
;
678 __entry
->think
= current
->dirty_paused_when
== 0 ? 0 :
679 (long)(jiffies
- current
->dirty_paused_when
) * 1000/HZ
;
680 __entry
->period
= period
* 1000 / HZ
;
681 __entry
->pause
= pause
* 1000 / HZ
;
682 __entry
->paused
= (jiffies
- start_time
) * 1000 / HZ
;
683 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
688 "limit=%lu setpoint=%lu dirty=%lu "
689 "bdi_setpoint=%lu bdi_dirty=%lu "
690 "dirty_ratelimit=%lu task_ratelimit=%lu "
691 "dirtied=%u dirtied_pause=%u "
692 "paused=%lu pause=%ld period=%lu think=%ld cgroup_ino=%lu",
697 __entry
->bdi_setpoint
,
699 __entry
->dirty_ratelimit
,
700 __entry
->task_ratelimit
,
702 __entry
->dirtied_pause
,
703 __entry
->paused
, /* ms */
704 __entry
->pause
, /* ms */
705 __entry
->period
, /* ms */
706 __entry
->think
, /* ms */
707 (unsigned long)__entry
->cgroup_ino
711 TRACE_EVENT(writeback_sb_inodes_requeue
,
713 TP_PROTO(struct inode
*inode
),
717 __array(char, name
, 32)
719 __field(unsigned long, state
)
720 __field(unsigned long, dirtied_when
)
721 __field(ino_t
, cgroup_ino
)
725 strscpy_pad(__entry
->name
,
726 bdi_dev_name(inode_to_bdi(inode
)), 32);
727 __entry
->ino
= inode
->i_ino
;
728 __entry
->state
= inode
->i_state
;
729 __entry
->dirtied_when
= inode
->dirtied_when
;
730 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(inode_to_wb(inode
));
733 TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu cgroup_ino=%lu",
735 (unsigned long)__entry
->ino
,
736 show_inode_state(__entry
->state
),
737 __entry
->dirtied_when
,
738 (jiffies
- __entry
->dirtied_when
) / HZ
,
739 (unsigned long)__entry
->cgroup_ino
743 DECLARE_EVENT_CLASS(writeback_congest_waited_template
,
745 TP_PROTO(unsigned int usec_timeout
, unsigned int usec_delayed
),
747 TP_ARGS(usec_timeout
, usec_delayed
),
750 __field( unsigned int, usec_timeout
)
751 __field( unsigned int, usec_delayed
)
755 __entry
->usec_timeout
= usec_timeout
;
756 __entry
->usec_delayed
= usec_delayed
;
759 TP_printk("usec_timeout=%u usec_delayed=%u",
760 __entry
->usec_timeout
,
761 __entry
->usec_delayed
)
764 DEFINE_EVENT(writeback_congest_waited_template
, writeback_congestion_wait
,
766 TP_PROTO(unsigned int usec_timeout
, unsigned int usec_delayed
),
768 TP_ARGS(usec_timeout
, usec_delayed
)
771 DEFINE_EVENT(writeback_congest_waited_template
, writeback_wait_iff_congested
,
773 TP_PROTO(unsigned int usec_timeout
, unsigned int usec_delayed
),
775 TP_ARGS(usec_timeout
, usec_delayed
)
778 DECLARE_EVENT_CLASS(writeback_single_inode_template
,
780 TP_PROTO(struct inode
*inode
,
781 struct writeback_control
*wbc
,
782 unsigned long nr_to_write
785 TP_ARGS(inode
, wbc
, nr_to_write
),
788 __array(char, name
, 32)
790 __field(unsigned long, state
)
791 __field(unsigned long, dirtied_when
)
792 __field(unsigned long, writeback_index
)
793 __field(long, nr_to_write
)
794 __field(unsigned long, wrote
)
795 __field(ino_t
, cgroup_ino
)
799 strscpy_pad(__entry
->name
,
800 bdi_dev_name(inode_to_bdi(inode
)), 32);
801 __entry
->ino
= inode
->i_ino
;
802 __entry
->state
= inode
->i_state
;
803 __entry
->dirtied_when
= inode
->dirtied_when
;
804 __entry
->writeback_index
= inode
->i_mapping
->writeback_index
;
805 __entry
->nr_to_write
= nr_to_write
;
806 __entry
->wrote
= nr_to_write
- wbc
->nr_to_write
;
807 __entry
->cgroup_ino
= __trace_wbc_assign_cgroup(wbc
);
810 TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu "
811 "index=%lu to_write=%ld wrote=%lu cgroup_ino=%lu",
813 (unsigned long)__entry
->ino
,
814 show_inode_state(__entry
->state
),
815 __entry
->dirtied_when
,
816 (jiffies
- __entry
->dirtied_when
) / HZ
,
817 __entry
->writeback_index
,
818 __entry
->nr_to_write
,
820 (unsigned long)__entry
->cgroup_ino
824 DEFINE_EVENT(writeback_single_inode_template
, writeback_single_inode_start
,
825 TP_PROTO(struct inode
*inode
,
826 struct writeback_control
*wbc
,
827 unsigned long nr_to_write
),
828 TP_ARGS(inode
, wbc
, nr_to_write
)
831 DEFINE_EVENT(writeback_single_inode_template
, writeback_single_inode
,
832 TP_PROTO(struct inode
*inode
,
833 struct writeback_control
*wbc
,
834 unsigned long nr_to_write
),
835 TP_ARGS(inode
, wbc
, nr_to_write
)
838 DECLARE_EVENT_CLASS(writeback_inode_template
,
839 TP_PROTO(struct inode
*inode
),
844 __field( dev_t
, dev
)
845 __field( ino_t
, ino
)
846 __field(unsigned long, state
)
847 __field( __u16
, mode
)
848 __field(unsigned long, dirtied_when
)
852 __entry
->dev
= inode
->i_sb
->s_dev
;
853 __entry
->ino
= inode
->i_ino
;
854 __entry
->state
= inode
->i_state
;
855 __entry
->mode
= inode
->i_mode
;
856 __entry
->dirtied_when
= inode
->dirtied_when
;
859 TP_printk("dev %d,%d ino %lu dirtied %lu state %s mode 0%o",
860 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
861 (unsigned long)__entry
->ino
, __entry
->dirtied_when
,
862 show_inode_state(__entry
->state
), __entry
->mode
)
865 DEFINE_EVENT(writeback_inode_template
, writeback_lazytime
,
866 TP_PROTO(struct inode
*inode
),
871 DEFINE_EVENT(writeback_inode_template
, writeback_lazytime_iput
,
872 TP_PROTO(struct inode
*inode
),
877 DEFINE_EVENT(writeback_inode_template
, writeback_dirty_inode_enqueue
,
879 TP_PROTO(struct inode
*inode
),
885 * Inode writeback list tracking.
888 DEFINE_EVENT(writeback_inode_template
, sb_mark_inode_writeback
,
889 TP_PROTO(struct inode
*inode
),
893 DEFINE_EVENT(writeback_inode_template
, sb_clear_inode_writeback
,
894 TP_PROTO(struct inode
*inode
),
898 #endif /* _TRACE_WRITEBACK_H */
900 /* This part must be outside protection */
901 #include <trace/define_trace.h>