i2c: mxs: use MXS_DMA_CTRL_WAIT4END instead of DMA_CTRL_ACK
[linux/fpc-iii.git] / include / trace / events / writeback.h
blob67434278b81dd5cd7528ee74e1b1b7c084abb3ca
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
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"}, \
17 {I_NEW, "I_NEW"}, \
18 {I_WILL_FREE, "I_WILL_FREE"}, \
19 {I_FREEING, "I_FREEING"}, \
20 {I_CLEAR, "I_CLEAR"}, \
21 {I_SYNC, "I_SYNC"}, \
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 */
28 #undef EM
29 #undef EMe
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")
43 WB_WORK_REASON
46 * Now redefine the EM() and EMe() macros to map the enums to the strings
47 * that will be printed in the output.
49 #undef EM
50 #undef EMe
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),
62 TP_STRUCT__entry (
63 __array(char, name, 32)
64 __field(unsigned long, ino)
65 __field(pgoff_t, index)
68 TP_fast_assign(
69 strscpy_pad(__entry->name,
70 bdi_dev_name(mapping ? inode_to_bdi(mapping->host) :
71 NULL), 32);
72 __entry->ino = mapping ? mapping->host->i_ino : 0;
73 __entry->index = page->index;
76 TP_printk("bdi %s: ino=%lu index=%lu",
77 __entry->name,
78 __entry->ino,
79 __entry->index
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),
103 TP_STRUCT__entry (
104 __array(char, name, 32)
105 __field(unsigned long, ino)
106 __field(unsigned long, state)
107 __field(unsigned long, flags)
110 TP_fast_assign(
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",
121 __entry->name,
122 __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 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)
159 if (wbc->wb)
160 return __trace_wb_assign_cgroup(wbc->wb);
161 else
162 return -1U;
164 #else /* CONFIG_CGROUP_WRITEBACK */
166 static inline unsigned int __trace_wb_assign_cgroup(struct bdi_writeback *wb)
168 return -1U;
171 static inline unsigned int __trace_wbc_assign_cgroup(struct writeback_control *wbc)
173 return -1U;
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),
187 TP_STRUCT__entry(
188 __array(char, name, 32)
189 __field(unsigned long, ino)
190 __field(unsigned int, cgroup_ino)
191 __field(unsigned int, history)
194 TP_fast_assign(
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",
202 __entry->name,
203 __entry->ino,
204 __entry->cgroup_ino,
205 __entry->history
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),
216 TP_STRUCT__entry(
217 __array(char, name, 32)
218 __field(unsigned long, ino)
219 __field(unsigned int, old_cgroup_ino)
220 __field(unsigned int, new_cgroup_ino)
223 TP_fast_assign(
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",
231 __entry->name,
232 __entry->ino,
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),
242 TP_ARGS(page, wb),
244 TP_STRUCT__entry(
245 __array(char, name, 32)
246 __field(u64, bdi_id)
247 __field(unsigned long, ino)
248 __field(unsigned int, memcg_id)
249 __field(unsigned int, cgroup_ino)
250 __field(unsigned int, page_cgroup_ino)
253 TP_fast_assign(
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",
266 __entry->name,
267 __entry->bdi_id,
268 __entry->ino,
269 __entry->memcg_id,
270 __entry->cgroup_ino,
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),
282 TP_STRUCT__entry(
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)
289 TP_fast_assign(
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",
297 __entry->name,
298 __entry->cgroup_ino,
299 __entry->frn_bdi_id,
300 __entry->frn_memcg_id
303 #endif
305 DECLARE_EVENT_CLASS(writeback_write_inode_template,
307 TP_PROTO(struct inode *inode, struct writeback_control *wbc),
309 TP_ARGS(inode, wbc),
311 TP_STRUCT__entry (
312 __array(char, name, 32)
313 __field(unsigned long, ino)
314 __field(int, sync_mode)
315 __field(unsigned int, cgroup_ino)
318 TP_fast_assign(
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",
327 __entry->name,
328 __entry->ino,
329 __entry->sync_mode,
330 __entry->cgroup_ino
334 DEFINE_EVENT(writeback_write_inode_template, writeback_write_inode_start,
336 TP_PROTO(struct inode *inode, struct writeback_control *wbc),
338 TP_ARGS(inode, wbc)
341 DEFINE_EVENT(writeback_write_inode_template, writeback_write_inode,
343 TP_PROTO(struct inode *inode, struct writeback_control *wbc),
345 TP_ARGS(inode, wbc)
348 DECLARE_EVENT_CLASS(writeback_work_class,
349 TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work),
350 TP_ARGS(wb, work),
351 TP_STRUCT__entry(
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)
359 __field(int, reason)
360 __field(unsigned int, cgroup_ino)
362 TP_fast_assign(
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",
375 __entry->name,
376 MAJOR(__entry->sb_dev), MINOR(__entry->sb_dev),
377 __entry->nr_pages,
378 __entry->sync_mode,
379 __entry->for_kupdate,
380 __entry->range_cyclic,
381 __entry->for_background,
382 __print_symbolic(__entry->reason, WB_WORK_REASON),
383 __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), \
389 TP_ARGS(wb, 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),
399 TP_STRUCT__entry(
400 __field(long, pages)
402 TP_fast_assign(
403 __entry->pages = pages_written;
405 TP_printk("%ld", __entry->pages)
408 DECLARE_EVENT_CLASS(writeback_class,
409 TP_PROTO(struct bdi_writeback *wb),
410 TP_ARGS(wb),
411 TP_STRUCT__entry(
412 __array(char, name, 32)
413 __field(unsigned int, cgroup_ino)
415 TP_fast_assign(
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",
420 __entry->name,
421 __entry->cgroup_ino
424 #define DEFINE_WRITEBACK_EVENT(name) \
425 DEFINE_EVENT(writeback_class, name, \
426 TP_PROTO(struct bdi_writeback *wb), \
427 TP_ARGS(wb))
429 DEFINE_WRITEBACK_EVENT(writeback_wake_background);
431 TRACE_EVENT(writeback_bdi_register,
432 TP_PROTO(struct backing_dev_info *bdi),
433 TP_ARGS(bdi),
434 TP_STRUCT__entry(
435 __array(char, name, 32)
437 TP_fast_assign(
438 strscpy_pad(__entry->name, bdi_dev_name(bdi), 32);
440 TP_printk("bdi %s",
441 __entry->name
445 DECLARE_EVENT_CLASS(wbc_class,
446 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi),
447 TP_ARGS(wbc, bdi),
448 TP_STRUCT__entry(
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)
462 TP_fast_assign(
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",
479 __entry->name,
480 __entry->nr_to_write,
481 __entry->pages_skipped,
482 __entry->sync_mode,
483 __entry->for_kupdate,
484 __entry->for_background,
485 __entry->for_reclaim,
486 __entry->range_cyclic,
487 __entry->range_start,
488 __entry->range_end,
489 __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), \
496 TP_ARGS(wbc, 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,
503 int moved),
504 TP_ARGS(wb, work, dirtied_before, moved),
505 TP_STRUCT__entry(
506 __array(char, name, 32)
507 __field(unsigned long, older)
508 __field(long, age)
509 __field(int, moved)
510 __field(int, reason)
511 __field(unsigned int, cgroup_ino)
513 TP_fast_assign(
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",
522 __entry->name,
523 __entry->older, /* dirtied_before in jiffies */
524 __entry->age, /* dirtied_before in relative milliseconds */
525 __entry->moved,
526 __print_symbolic(__entry->reason, WB_WORK_REASON),
527 __entry->cgroup_ino
531 TRACE_EVENT(global_dirty_state,
533 TP_PROTO(unsigned long background_thresh,
534 unsigned long dirty_thresh
537 TP_ARGS(background_thresh,
538 dirty_thresh
541 TP_STRUCT__entry(
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)
552 TP_fast_assign(
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",
566 __entry->nr_dirty,
567 __entry->nr_writeback,
568 __entry->nr_unstable,
569 __entry->background_thresh,
570 __entry->dirty_thresh,
571 __entry->dirty_limit,
572 __entry->nr_dirtied,
573 __entry->nr_written
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),
587 TP_STRUCT__entry(
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)
598 TP_fast_assign(
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);
610 TP_printk("bdi %s: "
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",
614 __entry->bdi,
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 */
621 __entry->cgroup_ino
625 TRACE_EVENT(balance_dirty_pages,
627 TP_PROTO(struct bdi_writeback *wb,
628 unsigned long thresh,
629 unsigned long bg_thresh,
630 unsigned long dirty,
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,
637 long pause,
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),
644 TP_STRUCT__entry(
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)
662 TP_fast_assign(
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 +
668 freerun) / 2;
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);
686 TP_printk("bdi %s: "
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",
692 __entry->bdi,
693 __entry->limit,
694 __entry->setpoint,
695 __entry->dirty,
696 __entry->bdi_setpoint,
697 __entry->bdi_dirty,
698 __entry->dirty_ratelimit,
699 __entry->task_ratelimit,
700 __entry->dirtied,
701 __entry->dirtied_pause,
702 __entry->paused, /* ms */
703 __entry->pause, /* ms */
704 __entry->period, /* ms */
705 __entry->think, /* ms */
706 __entry->cgroup_ino
710 TRACE_EVENT(writeback_sb_inodes_requeue,
712 TP_PROTO(struct inode *inode),
713 TP_ARGS(inode),
715 TP_STRUCT__entry(
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)
723 TP_fast_assign(
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",
733 __entry->name,
734 __entry->ino,
735 show_inode_state(__entry->state),
736 __entry->dirtied_when,
737 (jiffies - __entry->dirtied_when) / HZ,
738 __entry->cgroup_ino
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),
748 TP_STRUCT__entry(
749 __field( unsigned int, usec_timeout )
750 __field( unsigned int, usec_delayed )
753 TP_fast_assign(
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),
786 TP_STRUCT__entry(
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)
797 TP_fast_assign(
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",
811 __entry->name,
812 __entry->ino,
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,
818 __entry->wrote,
819 __entry->cgroup_ino
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),
840 TP_ARGS(inode),
842 TP_STRUCT__entry(
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 )
850 TP_fast_assign(
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),
867 TP_ARGS(inode)
870 DEFINE_EVENT(writeback_inode_template, writeback_lazytime_iput,
871 TP_PROTO(struct inode *inode),
873 TP_ARGS(inode)
876 DEFINE_EVENT(writeback_inode_template, writeback_dirty_inode_enqueue,
878 TP_PROTO(struct inode *inode),
880 TP_ARGS(inode)
884 * Inode writeback list tracking.
887 DEFINE_EVENT(writeback_inode_template, sb_mark_inode_writeback,
888 TP_PROTO(struct inode *inode),
889 TP_ARGS(inode)
892 DEFINE_EVENT(writeback_inode_template, sb_clear_inode_writeback,
893 TP_PROTO(struct inode *inode),
894 TP_ARGS(inode)
897 #endif /* _TRACE_WRITEBACK_H */
899 /* This part must be outside protection */
900 #include <trace/define_trace.h>