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"}, \
24 {I_LINKABLE, "I_LINKABLE"}, \
25 {I_WB_SWITCH, "I_WB_SWITCH"}, \
26 {I_OVL_INUSE, "I_OVL_INUSE"}, \
27 {I_CREATING, "I_CREATING"}, \
28 {I_DONTCACHE, "I_DONTCACHE"}, \
29 {I_SYNC_QUEUED, "I_SYNC_QUEUED"}, \
30 {I_PINNING_NETFS_WB, "I_PINNING_NETFS_WB"}, \
31 {I_LRU_ISOLATING, "I_LRU_ISOLATING"} \
34 /* enums need to be exported to user space */
37 #define EM(a,b) TRACE_DEFINE_ENUM(a);
38 #define EMe(a,b) TRACE_DEFINE_ENUM(a);
40 #define WB_WORK_REASON \
41 EM( WB_REASON_BACKGROUND, "background") \
42 EM( WB_REASON_VMSCAN, "vmscan") \
43 EM( WB_REASON_SYNC, "sync") \
44 EM( WB_REASON_PERIODIC, "periodic") \
45 EM( WB_REASON_LAPTOP_TIMER, "laptop_timer") \
46 EM( WB_REASON_FS_FREE_SPACE, "fs_free_space") \
47 EM( WB_REASON_FORKER_THREAD, "forker_thread") \
48 EMe(WB_REASON_FOREIGN_FLUSH, "foreign_flush")
53 * Now redefine the EM() and EMe() macros to map the enums to the strings
54 * that will be printed in the output.
58 #define EM(a,b) { a, b },
59 #define EMe(a,b) { a, b }
61 struct wb_writeback_work
;
63 DECLARE_EVENT_CLASS(writeback_folio_template
,
65 TP_PROTO(struct folio
*folio
, struct address_space
*mapping
),
67 TP_ARGS(folio
, mapping
),
70 __array(char, name
, 32)
72 __field(pgoff_t
, index
)
76 strscpy_pad(__entry
->name
,
77 bdi_dev_name(mapping
? inode_to_bdi(mapping
->host
) :
79 __entry
->ino
= (mapping
&& mapping
->host
) ? mapping
->host
->i_ino
: 0;
80 __entry
->index
= folio
->index
;
83 TP_printk("bdi %s: ino=%lu index=%lu",
85 (unsigned long)__entry
->ino
,
90 DEFINE_EVENT(writeback_folio_template
, writeback_dirty_folio
,
92 TP_PROTO(struct folio
*folio
, struct address_space
*mapping
),
94 TP_ARGS(folio
, mapping
)
97 DEFINE_EVENT(writeback_folio_template
, folio_wait_writeback
,
99 TP_PROTO(struct folio
*folio
, struct address_space
*mapping
),
101 TP_ARGS(folio
, mapping
)
104 DECLARE_EVENT_CLASS(writeback_dirty_inode_template
,
106 TP_PROTO(struct inode
*inode
, int flags
),
108 TP_ARGS(inode
, flags
),
111 __array(char, name
, 32)
113 __field(unsigned long, state
)
114 __field(unsigned long, flags
)
118 struct backing_dev_info
*bdi
= inode_to_bdi(inode
);
120 /* may be called for files on pseudo FSes w/ unregistered bdi */
121 strscpy_pad(__entry
->name
, bdi_dev_name(bdi
), 32);
122 __entry
->ino
= inode
->i_ino
;
123 __entry
->state
= inode
->i_state
;
124 __entry
->flags
= flags
;
127 TP_printk("bdi %s: ino=%lu state=%s flags=%s",
129 (unsigned long)__entry
->ino
,
130 show_inode_state(__entry
->state
),
131 show_inode_state(__entry
->flags
)
135 DEFINE_EVENT(writeback_dirty_inode_template
, writeback_mark_inode_dirty
,
137 TP_PROTO(struct inode
*inode
, int flags
),
139 TP_ARGS(inode
, flags
)
142 DEFINE_EVENT(writeback_dirty_inode_template
, writeback_dirty_inode_start
,
144 TP_PROTO(struct inode
*inode
, int flags
),
146 TP_ARGS(inode
, flags
)
149 DEFINE_EVENT(writeback_dirty_inode_template
, writeback_dirty_inode
,
151 TP_PROTO(struct inode
*inode
, int flags
),
153 TP_ARGS(inode
, flags
)
156 #ifdef CREATE_TRACE_POINTS
157 #ifdef CONFIG_CGROUP_WRITEBACK
159 static inline ino_t
__trace_wb_assign_cgroup(struct bdi_writeback
*wb
)
161 return cgroup_ino(wb
->memcg_css
->cgroup
);
164 static inline ino_t
__trace_wbc_assign_cgroup(struct writeback_control
*wbc
)
167 return __trace_wb_assign_cgroup(wbc
->wb
);
171 #else /* CONFIG_CGROUP_WRITEBACK */
173 static inline ino_t
__trace_wb_assign_cgroup(struct bdi_writeback
*wb
)
178 static inline ino_t
__trace_wbc_assign_cgroup(struct writeback_control
*wbc
)
183 #endif /* CONFIG_CGROUP_WRITEBACK */
184 #endif /* CREATE_TRACE_POINTS */
186 #ifdef CONFIG_CGROUP_WRITEBACK
187 TRACE_EVENT(inode_foreign_history
,
189 TP_PROTO(struct inode
*inode
, struct writeback_control
*wbc
,
190 unsigned int history
),
192 TP_ARGS(inode
, wbc
, history
),
195 __array(char, name
, 32)
197 __field(ino_t
, cgroup_ino
)
198 __field(unsigned int, history
)
202 strscpy_pad(__entry
->name
, bdi_dev_name(inode_to_bdi(inode
)), 32);
203 __entry
->ino
= inode
->i_ino
;
204 __entry
->cgroup_ino
= __trace_wbc_assign_cgroup(wbc
);
205 __entry
->history
= history
;
208 TP_printk("bdi %s: ino=%lu cgroup_ino=%lu history=0x%x",
210 (unsigned long)__entry
->ino
,
211 (unsigned long)__entry
->cgroup_ino
,
216 TRACE_EVENT(inode_switch_wbs
,
218 TP_PROTO(struct inode
*inode
, struct bdi_writeback
*old_wb
,
219 struct bdi_writeback
*new_wb
),
221 TP_ARGS(inode
, old_wb
, new_wb
),
224 __array(char, name
, 32)
226 __field(ino_t
, old_cgroup_ino
)
227 __field(ino_t
, new_cgroup_ino
)
231 strscpy_pad(__entry
->name
, bdi_dev_name(old_wb
->bdi
), 32);
232 __entry
->ino
= inode
->i_ino
;
233 __entry
->old_cgroup_ino
= __trace_wb_assign_cgroup(old_wb
);
234 __entry
->new_cgroup_ino
= __trace_wb_assign_cgroup(new_wb
);
237 TP_printk("bdi %s: ino=%lu old_cgroup_ino=%lu new_cgroup_ino=%lu",
239 (unsigned long)__entry
->ino
,
240 (unsigned long)__entry
->old_cgroup_ino
,
241 (unsigned long)__entry
->new_cgroup_ino
245 TRACE_EVENT(track_foreign_dirty
,
247 TP_PROTO(struct folio
*folio
, struct bdi_writeback
*wb
),
252 __array(char, name
, 32)
255 __field(unsigned int, memcg_id
)
256 __field(ino_t
, cgroup_ino
)
257 __field(ino_t
, page_cgroup_ino
)
261 struct address_space
*mapping
= folio_mapping(folio
);
262 struct inode
*inode
= mapping
? mapping
->host
: NULL
;
264 strscpy_pad(__entry
->name
, bdi_dev_name(wb
->bdi
), 32);
265 __entry
->bdi_id
= wb
->bdi
->id
;
266 __entry
->ino
= inode
? inode
->i_ino
: 0;
267 __entry
->memcg_id
= wb
->memcg_css
->id
;
268 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
269 __entry
->page_cgroup_ino
= cgroup_ino(folio_memcg(folio
)->css
.cgroup
);
272 TP_printk("bdi %s[%llu]: ino=%lu memcg_id=%u cgroup_ino=%lu page_cgroup_ino=%lu",
275 (unsigned long)__entry
->ino
,
277 (unsigned long)__entry
->cgroup_ino
,
278 (unsigned long)__entry
->page_cgroup_ino
282 TRACE_EVENT(flush_foreign
,
284 TP_PROTO(struct bdi_writeback
*wb
, unsigned int frn_bdi_id
,
285 unsigned int frn_memcg_id
),
287 TP_ARGS(wb
, frn_bdi_id
, frn_memcg_id
),
290 __array(char, name
, 32)
291 __field(ino_t
, cgroup_ino
)
292 __field(unsigned int, frn_bdi_id
)
293 __field(unsigned int, frn_memcg_id
)
297 strscpy_pad(__entry
->name
, bdi_dev_name(wb
->bdi
), 32);
298 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
299 __entry
->frn_bdi_id
= frn_bdi_id
;
300 __entry
->frn_memcg_id
= frn_memcg_id
;
303 TP_printk("bdi %s: cgroup_ino=%lu frn_bdi_id=%u frn_memcg_id=%u",
305 (unsigned long)__entry
->cgroup_ino
,
307 __entry
->frn_memcg_id
312 DECLARE_EVENT_CLASS(writeback_write_inode_template
,
314 TP_PROTO(struct inode
*inode
, struct writeback_control
*wbc
),
319 __array(char, name
, 32)
321 __field(int, sync_mode
)
322 __field(ino_t
, cgroup_ino
)
326 strscpy_pad(__entry
->name
,
327 bdi_dev_name(inode_to_bdi(inode
)), 32);
328 __entry
->ino
= inode
->i_ino
;
329 __entry
->sync_mode
= wbc
->sync_mode
;
330 __entry
->cgroup_ino
= __trace_wbc_assign_cgroup(wbc
);
333 TP_printk("bdi %s: ino=%lu sync_mode=%d cgroup_ino=%lu",
335 (unsigned long)__entry
->ino
,
337 (unsigned long)__entry
->cgroup_ino
341 DEFINE_EVENT(writeback_write_inode_template
, writeback_write_inode_start
,
343 TP_PROTO(struct inode
*inode
, struct writeback_control
*wbc
),
348 DEFINE_EVENT(writeback_write_inode_template
, writeback_write_inode
,
350 TP_PROTO(struct inode
*inode
, struct writeback_control
*wbc
),
355 DECLARE_EVENT_CLASS(writeback_work_class
,
356 TP_PROTO(struct bdi_writeback
*wb
, struct wb_writeback_work
*work
),
359 __array(char, name
, 32)
360 __field(long, nr_pages
)
361 __field(dev_t
, sb_dev
)
362 __field(int, sync_mode
)
363 __field(int, for_kupdate
)
364 __field(int, range_cyclic
)
365 __field(int, for_background
)
367 __field(ino_t
, cgroup_ino
)
370 strscpy_pad(__entry
->name
, bdi_dev_name(wb
->bdi
), 32);
371 __entry
->nr_pages
= work
->nr_pages
;
372 __entry
->sb_dev
= work
->sb
? work
->sb
->s_dev
: 0;
373 __entry
->sync_mode
= work
->sync_mode
;
374 __entry
->for_kupdate
= work
->for_kupdate
;
375 __entry
->range_cyclic
= work
->range_cyclic
;
376 __entry
->for_background
= work
->for_background
;
377 __entry
->reason
= work
->reason
;
378 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
380 TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d "
381 "kupdate=%d range_cyclic=%d background=%d reason=%s cgroup_ino=%lu",
383 MAJOR(__entry
->sb_dev
), MINOR(__entry
->sb_dev
),
386 __entry
->for_kupdate
,
387 __entry
->range_cyclic
,
388 __entry
->for_background
,
389 __print_symbolic(__entry
->reason
, WB_WORK_REASON
),
390 (unsigned long)__entry
->cgroup_ino
393 #define DEFINE_WRITEBACK_WORK_EVENT(name) \
394 DEFINE_EVENT(writeback_work_class, name, \
395 TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work), \
397 DEFINE_WRITEBACK_WORK_EVENT(writeback_queue
);
398 DEFINE_WRITEBACK_WORK_EVENT(writeback_exec
);
399 DEFINE_WRITEBACK_WORK_EVENT(writeback_start
);
400 DEFINE_WRITEBACK_WORK_EVENT(writeback_written
);
401 DEFINE_WRITEBACK_WORK_EVENT(writeback_wait
);
403 TRACE_EVENT(writeback_pages_written
,
404 TP_PROTO(long pages_written
),
405 TP_ARGS(pages_written
),
410 __entry
->pages
= pages_written
;
412 TP_printk("%ld", __entry
->pages
)
415 DECLARE_EVENT_CLASS(writeback_class
,
416 TP_PROTO(struct bdi_writeback
*wb
),
419 __array(char, name
, 32)
420 __field(ino_t
, cgroup_ino
)
423 strscpy_pad(__entry
->name
, bdi_dev_name(wb
->bdi
), 32);
424 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
426 TP_printk("bdi %s: cgroup_ino=%lu",
428 (unsigned long)__entry
->cgroup_ino
431 #define DEFINE_WRITEBACK_EVENT(name) \
432 DEFINE_EVENT(writeback_class, name, \
433 TP_PROTO(struct bdi_writeback *wb), \
436 DEFINE_WRITEBACK_EVENT(writeback_wake_background
);
438 TRACE_EVENT(writeback_bdi_register
,
439 TP_PROTO(struct backing_dev_info
*bdi
),
442 __array(char, name
, 32)
445 strscpy_pad(__entry
->name
, bdi_dev_name(bdi
), 32);
452 DECLARE_EVENT_CLASS(wbc_class
,
453 TP_PROTO(struct writeback_control
*wbc
, struct backing_dev_info
*bdi
),
456 __array(char, name
, 32)
457 __field(long, nr_to_write
)
458 __field(long, pages_skipped
)
459 __field(int, sync_mode
)
460 __field(int, for_kupdate
)
461 __field(int, for_background
)
462 __field(int, for_reclaim
)
463 __field(int, range_cyclic
)
464 __field(long, range_start
)
465 __field(long, range_end
)
466 __field(ino_t
, cgroup_ino
)
470 strscpy_pad(__entry
->name
, bdi_dev_name(bdi
), 32);
471 __entry
->nr_to_write
= wbc
->nr_to_write
;
472 __entry
->pages_skipped
= wbc
->pages_skipped
;
473 __entry
->sync_mode
= wbc
->sync_mode
;
474 __entry
->for_kupdate
= wbc
->for_kupdate
;
475 __entry
->for_background
= wbc
->for_background
;
476 __entry
->for_reclaim
= wbc
->for_reclaim
;
477 __entry
->range_cyclic
= wbc
->range_cyclic
;
478 __entry
->range_start
= (long)wbc
->range_start
;
479 __entry
->range_end
= (long)wbc
->range_end
;
480 __entry
->cgroup_ino
= __trace_wbc_assign_cgroup(wbc
);
483 TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d "
484 "bgrd=%d reclm=%d cyclic=%d "
485 "start=0x%lx end=0x%lx cgroup_ino=%lu",
487 __entry
->nr_to_write
,
488 __entry
->pages_skipped
,
490 __entry
->for_kupdate
,
491 __entry
->for_background
,
492 __entry
->for_reclaim
,
493 __entry
->range_cyclic
,
494 __entry
->range_start
,
496 (unsigned long)__entry
->cgroup_ino
500 #define DEFINE_WBC_EVENT(name) \
501 DEFINE_EVENT(wbc_class, name, \
502 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \
504 DEFINE_WBC_EVENT(wbc_writepage
);
506 TRACE_EVENT(writeback_queue_io
,
507 TP_PROTO(struct bdi_writeback
*wb
,
508 struct wb_writeback_work
*work
,
509 unsigned long dirtied_before
,
511 TP_ARGS(wb
, work
, dirtied_before
, moved
),
513 __array(char, name
, 32)
514 __field(unsigned long, older
)
518 __field(ino_t
, cgroup_ino
)
521 strscpy_pad(__entry
->name
, bdi_dev_name(wb
->bdi
), 32);
522 __entry
->older
= dirtied_before
;
523 __entry
->age
= (jiffies
- dirtied_before
) * 1000 / HZ
;
524 __entry
->moved
= moved
;
525 __entry
->reason
= work
->reason
;
526 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
528 TP_printk("bdi %s: older=%lu age=%ld enqueue=%d reason=%s cgroup_ino=%lu",
530 __entry
->older
, /* dirtied_before in jiffies */
531 __entry
->age
, /* dirtied_before in relative milliseconds */
533 __print_symbolic(__entry
->reason
, WB_WORK_REASON
),
534 (unsigned long)__entry
->cgroup_ino
538 TRACE_EVENT(global_dirty_state
,
540 TP_PROTO(unsigned long background_thresh
,
541 unsigned long dirty_thresh
544 TP_ARGS(background_thresh
,
549 __field(unsigned long, nr_dirty
)
550 __field(unsigned long, nr_writeback
)
551 __field(unsigned long, background_thresh
)
552 __field(unsigned long, dirty_thresh
)
553 __field(unsigned long, dirty_limit
)
554 __field(unsigned long, nr_dirtied
)
555 __field(unsigned long, nr_written
)
559 __entry
->nr_dirty
= global_node_page_state(NR_FILE_DIRTY
);
560 __entry
->nr_writeback
= global_node_page_state(NR_WRITEBACK
);
561 __entry
->nr_dirtied
= global_node_page_state(NR_DIRTIED
);
562 __entry
->nr_written
= global_node_page_state(NR_WRITTEN
);
563 __entry
->background_thresh
= background_thresh
;
564 __entry
->dirty_thresh
= dirty_thresh
;
565 __entry
->dirty_limit
= global_wb_domain
.dirty_limit
;
568 TP_printk("dirty=%lu writeback=%lu "
569 "bg_thresh=%lu thresh=%lu limit=%lu "
570 "dirtied=%lu written=%lu",
572 __entry
->nr_writeback
,
573 __entry
->background_thresh
,
574 __entry
->dirty_thresh
,
575 __entry
->dirty_limit
,
581 #define KBps(x) ((x) << (PAGE_SHIFT - 10))
583 TRACE_EVENT(bdi_dirty_ratelimit
,
585 TP_PROTO(struct bdi_writeback
*wb
,
586 unsigned long dirty_rate
,
587 unsigned long task_ratelimit
),
589 TP_ARGS(wb
, dirty_rate
, task_ratelimit
),
592 __array(char, bdi
, 32)
593 __field(unsigned long, write_bw
)
594 __field(unsigned long, avg_write_bw
)
595 __field(unsigned long, dirty_rate
)
596 __field(unsigned long, dirty_ratelimit
)
597 __field(unsigned long, task_ratelimit
)
598 __field(unsigned long, balanced_dirty_ratelimit
)
599 __field(ino_t
, cgroup_ino
)
603 strscpy_pad(__entry
->bdi
, bdi_dev_name(wb
->bdi
), 32);
604 __entry
->write_bw
= KBps(wb
->write_bandwidth
);
605 __entry
->avg_write_bw
= KBps(wb
->avg_write_bandwidth
);
606 __entry
->dirty_rate
= KBps(dirty_rate
);
607 __entry
->dirty_ratelimit
= KBps(wb
->dirty_ratelimit
);
608 __entry
->task_ratelimit
= KBps(task_ratelimit
);
609 __entry
->balanced_dirty_ratelimit
=
610 KBps(wb
->balanced_dirty_ratelimit
);
611 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
615 "write_bw=%lu awrite_bw=%lu dirty_rate=%lu "
616 "dirty_ratelimit=%lu task_ratelimit=%lu "
617 "balanced_dirty_ratelimit=%lu cgroup_ino=%lu",
619 __entry
->write_bw
, /* write bandwidth */
620 __entry
->avg_write_bw
, /* avg write bandwidth */
621 __entry
->dirty_rate
, /* bdi dirty rate */
622 __entry
->dirty_ratelimit
, /* base ratelimit */
623 __entry
->task_ratelimit
, /* ratelimit with position control */
624 __entry
->balanced_dirty_ratelimit
, /* the balanced ratelimit */
625 (unsigned long)__entry
->cgroup_ino
629 TRACE_EVENT(balance_dirty_pages
,
631 TP_PROTO(struct bdi_writeback
*wb
,
632 unsigned long thresh
,
633 unsigned long bg_thresh
,
635 unsigned long bdi_thresh
,
636 unsigned long bdi_dirty
,
637 unsigned long dirty_ratelimit
,
638 unsigned long task_ratelimit
,
639 unsigned long dirtied
,
640 unsigned long period
,
642 unsigned long start_time
),
644 TP_ARGS(wb
, thresh
, bg_thresh
, dirty
, bdi_thresh
, bdi_dirty
,
645 dirty_ratelimit
, task_ratelimit
,
646 dirtied
, period
, pause
, start_time
),
649 __array( char, bdi
, 32)
650 __field(unsigned long, limit
)
651 __field(unsigned long, setpoint
)
652 __field(unsigned long, dirty
)
653 __field(unsigned long, bdi_setpoint
)
654 __field(unsigned long, bdi_dirty
)
655 __field(unsigned long, dirty_ratelimit
)
656 __field(unsigned long, task_ratelimit
)
657 __field(unsigned int, dirtied
)
658 __field(unsigned int, dirtied_pause
)
659 __field(unsigned long, paused
)
660 __field( long, pause
)
661 __field(unsigned long, period
)
662 __field( long, think
)
663 __field(ino_t
, cgroup_ino
)
667 unsigned long freerun
= (thresh
+ bg_thresh
) / 2;
668 strscpy_pad(__entry
->bdi
, bdi_dev_name(wb
->bdi
), 32);
670 __entry
->limit
= global_wb_domain
.dirty_limit
;
671 __entry
->setpoint
= (global_wb_domain
.dirty_limit
+
673 __entry
->dirty
= dirty
;
674 __entry
->bdi_setpoint
= __entry
->setpoint
*
675 bdi_thresh
/ (thresh
+ 1);
676 __entry
->bdi_dirty
= bdi_dirty
;
677 __entry
->dirty_ratelimit
= KBps(dirty_ratelimit
);
678 __entry
->task_ratelimit
= KBps(task_ratelimit
);
679 __entry
->dirtied
= dirtied
;
680 __entry
->dirtied_pause
= current
->nr_dirtied_pause
;
681 __entry
->think
= current
->dirty_paused_when
== 0 ? 0 :
682 (long)(jiffies
- current
->dirty_paused_when
) * 1000/HZ
;
683 __entry
->period
= period
* 1000 / HZ
;
684 __entry
->pause
= pause
* 1000 / HZ
;
685 __entry
->paused
= (jiffies
- start_time
) * 1000 / HZ
;
686 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(wb
);
691 "limit=%lu setpoint=%lu dirty=%lu "
692 "bdi_setpoint=%lu bdi_dirty=%lu "
693 "dirty_ratelimit=%lu task_ratelimit=%lu "
694 "dirtied=%u dirtied_pause=%u "
695 "paused=%lu pause=%ld period=%lu think=%ld cgroup_ino=%lu",
700 __entry
->bdi_setpoint
,
702 __entry
->dirty_ratelimit
,
703 __entry
->task_ratelimit
,
705 __entry
->dirtied_pause
,
706 __entry
->paused
, /* ms */
707 __entry
->pause
, /* ms */
708 __entry
->period
, /* ms */
709 __entry
->think
, /* ms */
710 (unsigned long)__entry
->cgroup_ino
714 TRACE_EVENT(writeback_sb_inodes_requeue
,
716 TP_PROTO(struct inode
*inode
),
720 __array(char, name
, 32)
722 __field(unsigned long, state
)
723 __field(unsigned long, dirtied_when
)
724 __field(ino_t
, cgroup_ino
)
728 strscpy_pad(__entry
->name
,
729 bdi_dev_name(inode_to_bdi(inode
)), 32);
730 __entry
->ino
= inode
->i_ino
;
731 __entry
->state
= inode
->i_state
;
732 __entry
->dirtied_when
= inode
->dirtied_when
;
733 __entry
->cgroup_ino
= __trace_wb_assign_cgroup(inode_to_wb(inode
));
736 TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu cgroup_ino=%lu",
738 (unsigned long)__entry
->ino
,
739 show_inode_state(__entry
->state
),
740 __entry
->dirtied_when
,
741 (jiffies
- __entry
->dirtied_when
) / HZ
,
742 (unsigned long)__entry
->cgroup_ino
746 DECLARE_EVENT_CLASS(writeback_single_inode_template
,
748 TP_PROTO(struct inode
*inode
,
749 struct writeback_control
*wbc
,
750 unsigned long nr_to_write
753 TP_ARGS(inode
, wbc
, nr_to_write
),
756 __array(char, name
, 32)
758 __field(unsigned long, state
)
759 __field(unsigned long, dirtied_when
)
760 __field(unsigned long, writeback_index
)
761 __field(long, nr_to_write
)
762 __field(unsigned long, wrote
)
763 __field(ino_t
, cgroup_ino
)
767 strscpy_pad(__entry
->name
,
768 bdi_dev_name(inode_to_bdi(inode
)), 32);
769 __entry
->ino
= inode
->i_ino
;
770 __entry
->state
= inode
->i_state
;
771 __entry
->dirtied_when
= inode
->dirtied_when
;
772 __entry
->writeback_index
= inode
->i_mapping
->writeback_index
;
773 __entry
->nr_to_write
= nr_to_write
;
774 __entry
->wrote
= nr_to_write
- wbc
->nr_to_write
;
775 __entry
->cgroup_ino
= __trace_wbc_assign_cgroup(wbc
);
778 TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu "
779 "index=%lu to_write=%ld wrote=%lu cgroup_ino=%lu",
781 (unsigned long)__entry
->ino
,
782 show_inode_state(__entry
->state
),
783 __entry
->dirtied_when
,
784 (jiffies
- __entry
->dirtied_when
) / HZ
,
785 __entry
->writeback_index
,
786 __entry
->nr_to_write
,
788 (unsigned long)__entry
->cgroup_ino
792 DEFINE_EVENT(writeback_single_inode_template
, writeback_single_inode_start
,
793 TP_PROTO(struct inode
*inode
,
794 struct writeback_control
*wbc
,
795 unsigned long nr_to_write
),
796 TP_ARGS(inode
, wbc
, nr_to_write
)
799 DEFINE_EVENT(writeback_single_inode_template
, writeback_single_inode
,
800 TP_PROTO(struct inode
*inode
,
801 struct writeback_control
*wbc
,
802 unsigned long nr_to_write
),
803 TP_ARGS(inode
, wbc
, nr_to_write
)
806 DECLARE_EVENT_CLASS(writeback_inode_template
,
807 TP_PROTO(struct inode
*inode
),
812 __field( dev_t
, dev
)
813 __field( ino_t
, ino
)
814 __field(unsigned long, state
)
815 __field( __u16
, mode
)
816 __field(unsigned long, dirtied_when
)
820 __entry
->dev
= inode
->i_sb
->s_dev
;
821 __entry
->ino
= inode
->i_ino
;
822 __entry
->state
= inode
->i_state
;
823 __entry
->mode
= inode
->i_mode
;
824 __entry
->dirtied_when
= inode
->dirtied_when
;
827 TP_printk("dev %d,%d ino %lu dirtied %lu state %s mode 0%o",
828 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
829 (unsigned long)__entry
->ino
, __entry
->dirtied_when
,
830 show_inode_state(__entry
->state
), __entry
->mode
)
833 DEFINE_EVENT(writeback_inode_template
, writeback_lazytime
,
834 TP_PROTO(struct inode
*inode
),
839 DEFINE_EVENT(writeback_inode_template
, writeback_lazytime_iput
,
840 TP_PROTO(struct inode
*inode
),
845 DEFINE_EVENT(writeback_inode_template
, writeback_dirty_inode_enqueue
,
847 TP_PROTO(struct inode
*inode
),
853 * Inode writeback list tracking.
856 DEFINE_EVENT(writeback_inode_template
, sb_mark_inode_writeback
,
857 TP_PROTO(struct inode
*inode
),
861 DEFINE_EVENT(writeback_inode_template
, sb_clear_inode_writeback
,
862 TP_PROTO(struct inode
*inode
),
866 #endif /* _TRACE_WRITEBACK_H */
868 /* This part must be outside protection */
869 #include <trace/define_trace.h>