1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM f2fs
5 #if !defined(_TRACE_F2FS_H) || defined(TRACE_HEADER_MULTI_READ)
8 #include <linux/tracepoint.h>
10 #define show_dev(dev) MAJOR(dev), MINOR(dev)
11 #define show_dev_ino(entry) show_dev(entry->dev), (unsigned long)entry->ino
13 TRACE_DEFINE_ENUM(NODE
);
14 TRACE_DEFINE_ENUM(DATA
);
15 TRACE_DEFINE_ENUM(META
);
16 TRACE_DEFINE_ENUM(META_FLUSH
);
17 TRACE_DEFINE_ENUM(INMEM
);
18 TRACE_DEFINE_ENUM(INMEM_DROP
);
19 TRACE_DEFINE_ENUM(INMEM_INVALIDATE
);
20 TRACE_DEFINE_ENUM(INMEM_REVOKE
);
21 TRACE_DEFINE_ENUM(IPU
);
22 TRACE_DEFINE_ENUM(OPU
);
23 TRACE_DEFINE_ENUM(HOT
);
24 TRACE_DEFINE_ENUM(WARM
);
25 TRACE_DEFINE_ENUM(COLD
);
26 TRACE_DEFINE_ENUM(CURSEG_HOT_DATA
);
27 TRACE_DEFINE_ENUM(CURSEG_WARM_DATA
);
28 TRACE_DEFINE_ENUM(CURSEG_COLD_DATA
);
29 TRACE_DEFINE_ENUM(CURSEG_HOT_NODE
);
30 TRACE_DEFINE_ENUM(CURSEG_WARM_NODE
);
31 TRACE_DEFINE_ENUM(CURSEG_COLD_NODE
);
32 TRACE_DEFINE_ENUM(NO_CHECK_TYPE
);
33 TRACE_DEFINE_ENUM(GC_GREEDY
);
34 TRACE_DEFINE_ENUM(GC_CB
);
35 TRACE_DEFINE_ENUM(FG_GC
);
36 TRACE_DEFINE_ENUM(BG_GC
);
37 TRACE_DEFINE_ENUM(LFS
);
38 TRACE_DEFINE_ENUM(SSR
);
39 TRACE_DEFINE_ENUM(__REQ_RAHEAD
);
40 TRACE_DEFINE_ENUM(__REQ_SYNC
);
41 TRACE_DEFINE_ENUM(__REQ_IDLE
);
42 TRACE_DEFINE_ENUM(__REQ_PREFLUSH
);
43 TRACE_DEFINE_ENUM(__REQ_FUA
);
44 TRACE_DEFINE_ENUM(__REQ_PRIO
);
45 TRACE_DEFINE_ENUM(__REQ_META
);
46 TRACE_DEFINE_ENUM(CP_UMOUNT
);
47 TRACE_DEFINE_ENUM(CP_FASTBOOT
);
48 TRACE_DEFINE_ENUM(CP_SYNC
);
49 TRACE_DEFINE_ENUM(CP_RECOVERY
);
50 TRACE_DEFINE_ENUM(CP_DISCARD
);
51 TRACE_DEFINE_ENUM(CP_TRIMMED
);
53 #define show_block_type(type) \
54 __print_symbolic(type, \
58 { META_FLUSH, "META_FLUSH" }, \
60 { INMEM_DROP, "INMEM_DROP" }, \
61 { INMEM_INVALIDATE, "INMEM_INVALIDATE" }, \
62 { INMEM_REVOKE, "INMEM_REVOKE" }, \
63 { IPU, "IN-PLACE" }, \
64 { OPU, "OUT-OF-PLACE" })
66 #define show_block_temp(temp) \
67 __print_symbolic(temp, \
72 #define F2FS_OP_FLAGS (REQ_RAHEAD | REQ_SYNC | REQ_META | REQ_PRIO | \
73 REQ_PREFLUSH | REQ_FUA)
74 #define F2FS_BIO_FLAG_MASK(t) (t & F2FS_OP_FLAGS)
76 #define show_bio_type(op,op_flags) show_bio_op(op), \
77 show_bio_op_flags(op_flags)
79 #define show_bio_op(op) \
80 __print_symbolic(op, \
81 { REQ_OP_READ, "READ" }, \
82 { REQ_OP_WRITE, "WRITE" }, \
83 { REQ_OP_FLUSH, "FLUSH" }, \
84 { REQ_OP_DISCARD, "DISCARD" }, \
85 { REQ_OP_ZONE_REPORT, "ZONE_REPORT" }, \
86 { REQ_OP_SECURE_ERASE, "SECURE_ERASE" }, \
87 { REQ_OP_ZONE_RESET, "ZONE_RESET" }, \
88 { REQ_OP_WRITE_SAME, "WRITE_SAME" }, \
89 { REQ_OP_WRITE_ZEROES, "WRITE_ZEROES" })
91 #define show_bio_op_flags(flags) \
92 __print_flags(F2FS_BIO_FLAG_MASK(flags), "|", \
93 { REQ_RAHEAD, "R" }, \
97 { REQ_PREFLUSH, "PF" }, \
100 #define show_data_type(type) \
101 __print_symbolic(type, \
102 { CURSEG_HOT_DATA, "Hot DATA" }, \
103 { CURSEG_WARM_DATA, "Warm DATA" }, \
104 { CURSEG_COLD_DATA, "Cold DATA" }, \
105 { CURSEG_HOT_NODE, "Hot NODE" }, \
106 { CURSEG_WARM_NODE, "Warm NODE" }, \
107 { CURSEG_COLD_NODE, "Cold NODE" }, \
108 { NO_CHECK_TYPE, "No TYPE" })
110 #define show_file_type(type) \
111 __print_symbolic(type, \
115 #define show_gc_type(type) \
116 __print_symbolic(type, \
117 { FG_GC, "Foreground GC" }, \
118 { BG_GC, "Background GC" })
120 #define show_alloc_mode(type) \
121 __print_symbolic(type, \
122 { LFS, "LFS-mode" }, \
125 #define show_victim_policy(type) \
126 __print_symbolic(type, \
127 { GC_GREEDY, "Greedy" }, \
128 { GC_CB, "Cost-Benefit" })
130 #define show_cpreason(type) \
131 __print_flags(type, "|", \
132 { CP_UMOUNT, "Umount" }, \
133 { CP_FASTBOOT, "Fastboot" }, \
134 { CP_SYNC, "Sync" }, \
135 { CP_RECOVERY, "Recovery" }, \
136 { CP_DISCARD, "Discard" }, \
137 { CP_UMOUNT, "Umount" }, \
138 { CP_TRIMMED, "Trimmed" })
140 struct victim_sel_policy
;
141 struct f2fs_map_blocks
;
143 DECLARE_EVENT_CLASS(f2fs__inode
,
145 TP_PROTO(struct inode
*inode
),
153 __field(umode_t
, mode
)
154 __field(loff_t
, size
)
155 __field(unsigned int, nlink
)
156 __field(blkcnt_t
, blocks
)
157 __field(__u8
, advise
)
161 __entry
->dev
= inode
->i_sb
->s_dev
;
162 __entry
->ino
= inode
->i_ino
;
163 __entry
->pino
= F2FS_I(inode
)->i_pino
;
164 __entry
->mode
= inode
->i_mode
;
165 __entry
->nlink
= inode
->i_nlink
;
166 __entry
->size
= inode
->i_size
;
167 __entry
->blocks
= inode
->i_blocks
;
168 __entry
->advise
= F2FS_I(inode
)->i_advise
;
171 TP_printk("dev = (%d,%d), ino = %lu, pino = %lu, i_mode = 0x%hx, "
172 "i_size = %lld, i_nlink = %u, i_blocks = %llu, i_advise = 0x%x",
173 show_dev_ino(__entry
),
174 (unsigned long)__entry
->pino
,
177 (unsigned int)__entry
->nlink
,
178 (unsigned long long)__entry
->blocks
,
179 (unsigned char)__entry
->advise
)
182 DECLARE_EVENT_CLASS(f2fs__inode_exit
,
184 TP_PROTO(struct inode
*inode
, int ret
),
195 __entry
->dev
= inode
->i_sb
->s_dev
;
196 __entry
->ino
= inode
->i_ino
;
200 TP_printk("dev = (%d,%d), ino = %lu, ret = %d",
201 show_dev_ino(__entry
),
205 DEFINE_EVENT(f2fs__inode
, f2fs_sync_file_enter
,
207 TP_PROTO(struct inode
*inode
),
212 TRACE_EVENT(f2fs_sync_file_exit
,
214 TP_PROTO(struct inode
*inode
, int need_cp
, int datasync
, int ret
),
216 TP_ARGS(inode
, need_cp
, datasync
, ret
),
221 __field(int, need_cp
)
222 __field(int, datasync
)
227 __entry
->dev
= inode
->i_sb
->s_dev
;
228 __entry
->ino
= inode
->i_ino
;
229 __entry
->need_cp
= need_cp
;
230 __entry
->datasync
= datasync
;
234 TP_printk("dev = (%d,%d), ino = %lu, checkpoint is %s, "
235 "datasync = %d, ret = %d",
236 show_dev_ino(__entry
),
237 __entry
->need_cp
? "needed" : "not needed",
242 TRACE_EVENT(f2fs_sync_fs
,
244 TP_PROTO(struct super_block
*sb
, int wait
),
255 __entry
->dev
= sb
->s_dev
;
256 __entry
->dirty
= is_sbi_flag_set(F2FS_SB(sb
), SBI_IS_DIRTY
);
257 __entry
->wait
= wait
;
260 TP_printk("dev = (%d,%d), superblock is %s, wait = %d",
261 show_dev(__entry
->dev
),
262 __entry
->dirty
? "dirty" : "not dirty",
266 DEFINE_EVENT(f2fs__inode
, f2fs_iget
,
268 TP_PROTO(struct inode
*inode
),
273 DEFINE_EVENT(f2fs__inode_exit
, f2fs_iget_exit
,
275 TP_PROTO(struct inode
*inode
, int ret
),
280 DEFINE_EVENT(f2fs__inode
, f2fs_evict_inode
,
282 TP_PROTO(struct inode
*inode
),
287 DEFINE_EVENT(f2fs__inode_exit
, f2fs_new_inode
,
289 TP_PROTO(struct inode
*inode
, int ret
),
294 TRACE_EVENT(f2fs_unlink_enter
,
296 TP_PROTO(struct inode
*dir
, struct dentry
*dentry
),
298 TP_ARGS(dir
, dentry
),
303 __field(loff_t
, size
)
304 __field(blkcnt_t
, blocks
)
305 __field(const char *, name
)
309 __entry
->dev
= dir
->i_sb
->s_dev
;
310 __entry
->ino
= dir
->i_ino
;
311 __entry
->size
= dir
->i_size
;
312 __entry
->blocks
= dir
->i_blocks
;
313 __entry
->name
= dentry
->d_name
.name
;
316 TP_printk("dev = (%d,%d), dir ino = %lu, i_size = %lld, "
317 "i_blocks = %llu, name = %s",
318 show_dev_ino(__entry
),
320 (unsigned long long)__entry
->blocks
,
324 DEFINE_EVENT(f2fs__inode_exit
, f2fs_unlink_exit
,
326 TP_PROTO(struct inode
*inode
, int ret
),
331 DEFINE_EVENT(f2fs__inode_exit
, f2fs_drop_inode
,
333 TP_PROTO(struct inode
*inode
, int ret
),
338 DEFINE_EVENT(f2fs__inode
, f2fs_truncate
,
340 TP_PROTO(struct inode
*inode
),
345 TRACE_EVENT(f2fs_truncate_data_blocks_range
,
347 TP_PROTO(struct inode
*inode
, nid_t nid
, unsigned int ofs
, int free
),
349 TP_ARGS(inode
, nid
, ofs
, free
),
355 __field(unsigned int, ofs
)
360 __entry
->dev
= inode
->i_sb
->s_dev
;
361 __entry
->ino
= inode
->i_ino
;
364 __entry
->free
= free
;
367 TP_printk("dev = (%d,%d), ino = %lu, nid = %u, offset = %u, freed = %d",
368 show_dev_ino(__entry
),
369 (unsigned int)__entry
->nid
,
374 DECLARE_EVENT_CLASS(f2fs__truncate_op
,
376 TP_PROTO(struct inode
*inode
, u64 from
),
378 TP_ARGS(inode
, from
),
383 __field(loff_t
, size
)
384 __field(blkcnt_t
, blocks
)
389 __entry
->dev
= inode
->i_sb
->s_dev
;
390 __entry
->ino
= inode
->i_ino
;
391 __entry
->size
= inode
->i_size
;
392 __entry
->blocks
= inode
->i_blocks
;
393 __entry
->from
= from
;
396 TP_printk("dev = (%d,%d), ino = %lu, i_size = %lld, i_blocks = %llu, "
397 "start file offset = %llu",
398 show_dev_ino(__entry
),
400 (unsigned long long)__entry
->blocks
,
401 (unsigned long long)__entry
->from
)
404 DEFINE_EVENT(f2fs__truncate_op
, f2fs_truncate_blocks_enter
,
406 TP_PROTO(struct inode
*inode
, u64 from
),
411 DEFINE_EVENT(f2fs__inode_exit
, f2fs_truncate_blocks_exit
,
413 TP_PROTO(struct inode
*inode
, int ret
),
418 DEFINE_EVENT(f2fs__truncate_op
, f2fs_truncate_inode_blocks_enter
,
420 TP_PROTO(struct inode
*inode
, u64 from
),
425 DEFINE_EVENT(f2fs__inode_exit
, f2fs_truncate_inode_blocks_exit
,
427 TP_PROTO(struct inode
*inode
, int ret
),
432 DECLARE_EVENT_CLASS(f2fs__truncate_node
,
434 TP_PROTO(struct inode
*inode
, nid_t nid
, block_t blk_addr
),
436 TP_ARGS(inode
, nid
, blk_addr
),
442 __field(block_t
, blk_addr
)
446 __entry
->dev
= inode
->i_sb
->s_dev
;
447 __entry
->ino
= inode
->i_ino
;
449 __entry
->blk_addr
= blk_addr
;
452 TP_printk("dev = (%d,%d), ino = %lu, nid = %u, block_address = 0x%llx",
453 show_dev_ino(__entry
),
454 (unsigned int)__entry
->nid
,
455 (unsigned long long)__entry
->blk_addr
)
458 DEFINE_EVENT(f2fs__truncate_node
, f2fs_truncate_nodes_enter
,
460 TP_PROTO(struct inode
*inode
, nid_t nid
, block_t blk_addr
),
462 TP_ARGS(inode
, nid
, blk_addr
)
465 DEFINE_EVENT(f2fs__inode_exit
, f2fs_truncate_nodes_exit
,
467 TP_PROTO(struct inode
*inode
, int ret
),
472 DEFINE_EVENT(f2fs__truncate_node
, f2fs_truncate_node
,
474 TP_PROTO(struct inode
*inode
, nid_t nid
, block_t blk_addr
),
476 TP_ARGS(inode
, nid
, blk_addr
)
479 TRACE_EVENT(f2fs_truncate_partial_nodes
,
481 TP_PROTO(struct inode
*inode
, nid_t nid
[], int depth
, int err
),
483 TP_ARGS(inode
, nid
, depth
, err
),
488 __field(nid_t
, nid
[3])
494 __entry
->dev
= inode
->i_sb
->s_dev
;
495 __entry
->ino
= inode
->i_ino
;
496 __entry
->nid
[0] = nid
[0];
497 __entry
->nid
[1] = nid
[1];
498 __entry
->nid
[2] = nid
[2];
499 __entry
->depth
= depth
;
503 TP_printk("dev = (%d,%d), ino = %lu, "
504 "nid[0] = %u, nid[1] = %u, nid[2] = %u, depth = %d, err = %d",
505 show_dev_ino(__entry
),
506 (unsigned int)__entry
->nid
[0],
507 (unsigned int)__entry
->nid
[1],
508 (unsigned int)__entry
->nid
[2],
513 TRACE_EVENT(f2fs_map_blocks
,
514 TP_PROTO(struct inode
*inode
, struct f2fs_map_blocks
*map
, int ret
),
516 TP_ARGS(inode
, map
, ret
),
521 __field(block_t
, m_lblk
)
522 __field(block_t
, m_pblk
)
523 __field(unsigned int, m_len
)
528 __entry
->dev
= inode
->i_sb
->s_dev
;
529 __entry
->ino
= inode
->i_ino
;
530 __entry
->m_lblk
= map
->m_lblk
;
531 __entry
->m_pblk
= map
->m_pblk
;
532 __entry
->m_len
= map
->m_len
;
536 TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, "
537 "start blkaddr = 0x%llx, len = 0x%llx, err = %d",
538 show_dev_ino(__entry
),
539 (unsigned long long)__entry
->m_lblk
,
540 (unsigned long long)__entry
->m_pblk
,
541 (unsigned long long)__entry
->m_len
,
545 TRACE_EVENT(f2fs_background_gc
,
547 TP_PROTO(struct super_block
*sb
, unsigned int wait_ms
,
548 unsigned int prefree
, unsigned int free
),
550 TP_ARGS(sb
, wait_ms
, prefree
, free
),
554 __field(unsigned int, wait_ms
)
555 __field(unsigned int, prefree
)
556 __field(unsigned int, free
)
560 __entry
->dev
= sb
->s_dev
;
561 __entry
->wait_ms
= wait_ms
;
562 __entry
->prefree
= prefree
;
563 __entry
->free
= free
;
566 TP_printk("dev = (%d,%d), wait_ms = %u, prefree = %u, free = %u",
567 show_dev(__entry
->dev
),
573 TRACE_EVENT(f2fs_gc_begin
,
575 TP_PROTO(struct super_block
*sb
, bool sync
, bool background
,
576 long long dirty_nodes
, long long dirty_dents
,
577 long long dirty_imeta
, unsigned int free_sec
,
578 unsigned int free_seg
, int reserved_seg
,
579 unsigned int prefree_seg
),
581 TP_ARGS(sb
, sync
, background
, dirty_nodes
, dirty_dents
, dirty_imeta
,
582 free_sec
, free_seg
, reserved_seg
, prefree_seg
),
587 __field(bool, background
)
588 __field(long long, dirty_nodes
)
589 __field(long long, dirty_dents
)
590 __field(long long, dirty_imeta
)
591 __field(unsigned int, free_sec
)
592 __field(unsigned int, free_seg
)
593 __field(int, reserved_seg
)
594 __field(unsigned int, prefree_seg
)
598 __entry
->dev
= sb
->s_dev
;
599 __entry
->sync
= sync
;
600 __entry
->background
= background
;
601 __entry
->dirty_nodes
= dirty_nodes
;
602 __entry
->dirty_dents
= dirty_dents
;
603 __entry
->dirty_imeta
= dirty_imeta
;
604 __entry
->free_sec
= free_sec
;
605 __entry
->free_seg
= free_seg
;
606 __entry
->reserved_seg
= reserved_seg
;
607 __entry
->prefree_seg
= prefree_seg
;
610 TP_printk("dev = (%d,%d), sync = %d, background = %d, nodes = %lld, "
611 "dents = %lld, imeta = %lld, free_sec:%u, free_seg:%u, "
612 "rsv_seg:%d, prefree_seg:%u",
613 show_dev(__entry
->dev
),
616 __entry
->dirty_nodes
,
617 __entry
->dirty_dents
,
618 __entry
->dirty_imeta
,
621 __entry
->reserved_seg
,
622 __entry
->prefree_seg
)
625 TRACE_EVENT(f2fs_gc_end
,
627 TP_PROTO(struct super_block
*sb
, int ret
, int seg_freed
,
628 int sec_freed
, long long dirty_nodes
,
629 long long dirty_dents
, long long dirty_imeta
,
630 unsigned int free_sec
, unsigned int free_seg
,
631 int reserved_seg
, unsigned int prefree_seg
),
633 TP_ARGS(sb
, ret
, seg_freed
, sec_freed
, dirty_nodes
, dirty_dents
,
634 dirty_imeta
, free_sec
, free_seg
, reserved_seg
, prefree_seg
),
639 __field(int, seg_freed
)
640 __field(int, sec_freed
)
641 __field(long long, dirty_nodes
)
642 __field(long long, dirty_dents
)
643 __field(long long, dirty_imeta
)
644 __field(unsigned int, free_sec
)
645 __field(unsigned int, free_seg
)
646 __field(int, reserved_seg
)
647 __field(unsigned int, prefree_seg
)
651 __entry
->dev
= sb
->s_dev
;
653 __entry
->seg_freed
= seg_freed
;
654 __entry
->sec_freed
= sec_freed
;
655 __entry
->dirty_nodes
= dirty_nodes
;
656 __entry
->dirty_dents
= dirty_dents
;
657 __entry
->dirty_imeta
= dirty_imeta
;
658 __entry
->free_sec
= free_sec
;
659 __entry
->free_seg
= free_seg
;
660 __entry
->reserved_seg
= reserved_seg
;
661 __entry
->prefree_seg
= prefree_seg
;
664 TP_printk("dev = (%d,%d), ret = %d, seg_freed = %d, sec_freed = %d, "
665 "nodes = %lld, dents = %lld, imeta = %lld, free_sec:%u, "
666 "free_seg:%u, rsv_seg:%d, prefree_seg:%u",
667 show_dev(__entry
->dev
),
671 __entry
->dirty_nodes
,
672 __entry
->dirty_dents
,
673 __entry
->dirty_imeta
,
676 __entry
->reserved_seg
,
677 __entry
->prefree_seg
)
680 TRACE_EVENT(f2fs_get_victim
,
682 TP_PROTO(struct super_block
*sb
, int type
, int gc_type
,
683 struct victim_sel_policy
*p
, unsigned int pre_victim
,
684 unsigned int prefree
, unsigned int free
),
686 TP_ARGS(sb
, type
, gc_type
, p
, pre_victim
, prefree
, free
),
691 __field(int, gc_type
)
692 __field(int, alloc_mode
)
693 __field(int, gc_mode
)
694 __field(unsigned int, victim
)
695 __field(unsigned int, cost
)
696 __field(unsigned int, ofs_unit
)
697 __field(unsigned int, pre_victim
)
698 __field(unsigned int, prefree
)
699 __field(unsigned int, free
)
703 __entry
->dev
= sb
->s_dev
;
704 __entry
->type
= type
;
705 __entry
->gc_type
= gc_type
;
706 __entry
->alloc_mode
= p
->alloc_mode
;
707 __entry
->gc_mode
= p
->gc_mode
;
708 __entry
->victim
= p
->min_segno
;
709 __entry
->cost
= p
->min_cost
;
710 __entry
->ofs_unit
= p
->ofs_unit
;
711 __entry
->pre_victim
= pre_victim
;
712 __entry
->prefree
= prefree
;
713 __entry
->free
= free
;
716 TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), "
717 "victim = %u, cost = %u, ofs_unit = %u, "
718 "pre_victim_secno = %d, prefree = %u, free = %u",
719 show_dev(__entry
->dev
),
720 show_data_type(__entry
->type
),
721 show_gc_type(__entry
->gc_type
),
722 show_alloc_mode(__entry
->alloc_mode
),
723 show_victim_policy(__entry
->gc_mode
),
727 (int)__entry
->pre_victim
,
732 TRACE_EVENT(f2fs_fallocate
,
734 TP_PROTO(struct inode
*inode
, int mode
,
735 loff_t offset
, loff_t len
, int ret
),
737 TP_ARGS(inode
, mode
, offset
, len
, ret
),
743 __field(loff_t
, offset
)
745 __field(loff_t
, size
)
746 __field(blkcnt_t
, blocks
)
751 __entry
->dev
= inode
->i_sb
->s_dev
;
752 __entry
->ino
= inode
->i_ino
;
753 __entry
->mode
= mode
;
754 __entry
->offset
= offset
;
756 __entry
->size
= inode
->i_size
;
757 __entry
->blocks
= inode
->i_blocks
;
761 TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, "
762 "len = %lld, i_size = %lld, i_blocks = %llu, ret = %d",
763 show_dev_ino(__entry
),
765 (unsigned long long)__entry
->offset
,
766 (unsigned long long)__entry
->len
,
767 (unsigned long long)__entry
->size
,
768 (unsigned long long)__entry
->blocks
,
772 TRACE_EVENT(f2fs_direct_IO_enter
,
774 TP_PROTO(struct inode
*inode
, loff_t offset
, unsigned long len
, int rw
),
776 TP_ARGS(inode
, offset
, len
, rw
),
782 __field(unsigned long, len
)
787 __entry
->dev
= inode
->i_sb
->s_dev
;
788 __entry
->ino
= inode
->i_ino
;
789 __entry
->pos
= offset
;
794 TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu rw = %d",
795 show_dev_ino(__entry
),
801 TRACE_EVENT(f2fs_direct_IO_exit
,
803 TP_PROTO(struct inode
*inode
, loff_t offset
, unsigned long len
,
806 TP_ARGS(inode
, offset
, len
, rw
, ret
),
812 __field(unsigned long, len
)
818 __entry
->dev
= inode
->i_sb
->s_dev
;
819 __entry
->ino
= inode
->i_ino
;
820 __entry
->pos
= offset
;
826 TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu "
828 show_dev_ino(__entry
),
835 TRACE_EVENT(f2fs_reserve_new_blocks
,
837 TP_PROTO(struct inode
*inode
, nid_t nid
, unsigned int ofs_in_node
,
840 TP_ARGS(inode
, nid
, ofs_in_node
, count
),
845 __field(unsigned int, ofs_in_node
)
846 __field(blkcnt_t
, count
)
850 __entry
->dev
= inode
->i_sb
->s_dev
;
852 __entry
->ofs_in_node
= ofs_in_node
;
853 __entry
->count
= count
;
856 TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u, count = %llu",
857 show_dev(__entry
->dev
),
858 (unsigned int)__entry
->nid
,
859 __entry
->ofs_in_node
,
860 (unsigned long long)__entry
->count
)
863 DECLARE_EVENT_CLASS(f2fs__submit_page_bio
,
865 TP_PROTO(struct page
*page
, struct f2fs_io_info
*fio
),
872 __field(pgoff_t
, index
)
873 __field(block_t
, old_blkaddr
)
874 __field(block_t
, new_blkaddr
)
876 __field(int, op_flags
)
882 __entry
->dev
= page
->mapping
->host
->i_sb
->s_dev
;
883 __entry
->ino
= page
->mapping
->host
->i_ino
;
884 __entry
->index
= page
->index
;
885 __entry
->old_blkaddr
= fio
->old_blkaddr
;
886 __entry
->new_blkaddr
= fio
->new_blkaddr
;
887 __entry
->op
= fio
->op
;
888 __entry
->op_flags
= fio
->op_flags
;
889 __entry
->temp
= fio
->temp
;
890 __entry
->type
= fio
->type
;
893 TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, "
894 "oldaddr = 0x%llx, newaddr = 0x%llx, rw = %s(%s), type = %s_%s",
895 show_dev_ino(__entry
),
896 (unsigned long)__entry
->index
,
897 (unsigned long long)__entry
->old_blkaddr
,
898 (unsigned long long)__entry
->new_blkaddr
,
899 show_bio_type(__entry
->op
, __entry
->op_flags
),
900 show_block_temp(__entry
->temp
),
901 show_block_type(__entry
->type
))
904 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio
, f2fs_submit_page_bio
,
906 TP_PROTO(struct page
*page
, struct f2fs_io_info
*fio
),
910 TP_CONDITION(page
->mapping
)
913 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio
, f2fs_submit_page_write
,
915 TP_PROTO(struct page
*page
, struct f2fs_io_info
*fio
),
919 TP_CONDITION(page
->mapping
)
922 DECLARE_EVENT_CLASS(f2fs__bio
,
924 TP_PROTO(struct super_block
*sb
, int type
, struct bio
*bio
),
926 TP_ARGS(sb
, type
, bio
),
930 __field(dev_t
, target
)
932 __field(int, op_flags
)
934 __field(sector_t
, sector
)
935 __field(unsigned int, size
)
939 __entry
->dev
= sb
->s_dev
;
940 __entry
->target
= bio_dev(bio
);
941 __entry
->op
= bio_op(bio
);
942 __entry
->op_flags
= bio
->bi_opf
;
943 __entry
->type
= type
;
944 __entry
->sector
= bio
->bi_iter
.bi_sector
;
945 __entry
->size
= bio
->bi_iter
.bi_size
;
948 TP_printk("dev = (%d,%d)/(%d,%d), rw = %s(%s), %s, sector = %lld, size = %u",
949 show_dev(__entry
->target
),
950 show_dev(__entry
->dev
),
951 show_bio_type(__entry
->op
, __entry
->op_flags
),
952 show_block_type(__entry
->type
),
953 (unsigned long long)__entry
->sector
,
957 DEFINE_EVENT_CONDITION(f2fs__bio
, f2fs_prepare_write_bio
,
959 TP_PROTO(struct super_block
*sb
, int type
, struct bio
*bio
),
961 TP_ARGS(sb
, type
, bio
),
966 DEFINE_EVENT_CONDITION(f2fs__bio
, f2fs_prepare_read_bio
,
968 TP_PROTO(struct super_block
*sb
, int type
, struct bio
*bio
),
970 TP_ARGS(sb
, type
, bio
),
975 DEFINE_EVENT_CONDITION(f2fs__bio
, f2fs_submit_read_bio
,
977 TP_PROTO(struct super_block
*sb
, int type
, struct bio
*bio
),
979 TP_ARGS(sb
, type
, bio
),
984 DEFINE_EVENT_CONDITION(f2fs__bio
, f2fs_submit_write_bio
,
986 TP_PROTO(struct super_block
*sb
, int type
, struct bio
*bio
),
988 TP_ARGS(sb
, type
, bio
),
993 TRACE_EVENT(f2fs_write_begin
,
995 TP_PROTO(struct inode
*inode
, loff_t pos
, unsigned int len
,
998 TP_ARGS(inode
, pos
, len
, flags
),
1003 __field(loff_t
, pos
)
1004 __field(unsigned int, len
)
1005 __field(unsigned int, flags
)
1009 __entry
->dev
= inode
->i_sb
->s_dev
;
1010 __entry
->ino
= inode
->i_ino
;
1013 __entry
->flags
= flags
;
1016 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u",
1017 show_dev_ino(__entry
),
1018 (unsigned long long)__entry
->pos
,
1023 TRACE_EVENT(f2fs_write_end
,
1025 TP_PROTO(struct inode
*inode
, loff_t pos
, unsigned int len
,
1026 unsigned int copied
),
1028 TP_ARGS(inode
, pos
, len
, copied
),
1033 __field(loff_t
, pos
)
1034 __field(unsigned int, len
)
1035 __field(unsigned int, copied
)
1039 __entry
->dev
= inode
->i_sb
->s_dev
;
1040 __entry
->ino
= inode
->i_ino
;
1043 __entry
->copied
= copied
;
1046 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u",
1047 show_dev_ino(__entry
),
1048 (unsigned long long)__entry
->pos
,
1053 DECLARE_EVENT_CLASS(f2fs__page
,
1055 TP_PROTO(struct page
*page
, int type
),
1057 TP_ARGS(page
, type
),
1064 __field(pgoff_t
, index
)
1066 __field(int, uptodate
)
1070 __entry
->dev
= page
->mapping
->host
->i_sb
->s_dev
;
1071 __entry
->ino
= page
->mapping
->host
->i_ino
;
1072 __entry
->type
= type
;
1073 __entry
->dir
= S_ISDIR(page
->mapping
->host
->i_mode
);
1074 __entry
->index
= page
->index
;
1075 __entry
->dirty
= PageDirty(page
);
1076 __entry
->uptodate
= PageUptodate(page
);
1079 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, "
1080 "dirty = %d, uptodate = %d",
1081 show_dev_ino(__entry
),
1082 show_block_type(__entry
->type
),
1083 show_file_type(__entry
->dir
),
1084 (unsigned long)__entry
->index
,
1089 DEFINE_EVENT(f2fs__page
, f2fs_writepage
,
1091 TP_PROTO(struct page
*page
, int type
),
1096 DEFINE_EVENT(f2fs__page
, f2fs_do_write_data_page
,
1098 TP_PROTO(struct page
*page
, int type
),
1103 DEFINE_EVENT(f2fs__page
, f2fs_readpage
,
1105 TP_PROTO(struct page
*page
, int type
),
1110 DEFINE_EVENT(f2fs__page
, f2fs_set_page_dirty
,
1112 TP_PROTO(struct page
*page
, int type
),
1117 DEFINE_EVENT(f2fs__page
, f2fs_vm_page_mkwrite
,
1119 TP_PROTO(struct page
*page
, int type
),
1124 DEFINE_EVENT(f2fs__page
, f2fs_register_inmem_page
,
1126 TP_PROTO(struct page
*page
, int type
),
1131 DEFINE_EVENT(f2fs__page
, f2fs_commit_inmem_page
,
1133 TP_PROTO(struct page
*page
, int type
),
1138 TRACE_EVENT(f2fs_writepages
,
1140 TP_PROTO(struct inode
*inode
, struct writeback_control
*wbc
, int type
),
1142 TP_ARGS(inode
, wbc
, type
),
1149 __field(long, nr_to_write
)
1150 __field(long, pages_skipped
)
1151 __field(loff_t
, range_start
)
1152 __field(loff_t
, range_end
)
1153 __field(pgoff_t
, writeback_index
)
1154 __field(int, sync_mode
)
1155 __field(char, for_kupdate
)
1156 __field(char, for_background
)
1157 __field(char, tagged_writepages
)
1158 __field(char, for_reclaim
)
1159 __field(char, range_cyclic
)
1160 __field(char, for_sync
)
1164 __entry
->dev
= inode
->i_sb
->s_dev
;
1165 __entry
->ino
= inode
->i_ino
;
1166 __entry
->type
= type
;
1167 __entry
->dir
= S_ISDIR(inode
->i_mode
);
1168 __entry
->nr_to_write
= wbc
->nr_to_write
;
1169 __entry
->pages_skipped
= wbc
->pages_skipped
;
1170 __entry
->range_start
= wbc
->range_start
;
1171 __entry
->range_end
= wbc
->range_end
;
1172 __entry
->writeback_index
= inode
->i_mapping
->writeback_index
;
1173 __entry
->sync_mode
= wbc
->sync_mode
;
1174 __entry
->for_kupdate
= wbc
->for_kupdate
;
1175 __entry
->for_background
= wbc
->for_background
;
1176 __entry
->tagged_writepages
= wbc
->tagged_writepages
;
1177 __entry
->for_reclaim
= wbc
->for_reclaim
;
1178 __entry
->range_cyclic
= wbc
->range_cyclic
;
1179 __entry
->for_sync
= wbc
->for_sync
;
1182 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
1183 "skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
1184 "kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
1185 show_dev_ino(__entry
),
1186 show_block_type(__entry
->type
),
1187 show_file_type(__entry
->dir
),
1188 __entry
->nr_to_write
,
1189 __entry
->pages_skipped
,
1190 __entry
->range_start
,
1192 (unsigned long)__entry
->writeback_index
,
1194 __entry
->for_kupdate
,
1195 __entry
->for_background
,
1196 __entry
->tagged_writepages
,
1197 __entry
->for_reclaim
,
1198 __entry
->range_cyclic
,
1202 TRACE_EVENT(f2fs_readpages
,
1204 TP_PROTO(struct inode
*inode
, struct page
*page
, unsigned int nrpage
),
1206 TP_ARGS(inode
, page
, nrpage
),
1211 __field(pgoff_t
, start
)
1212 __field(unsigned int, nrpage
)
1216 __entry
->dev
= inode
->i_sb
->s_dev
;
1217 __entry
->ino
= inode
->i_ino
;
1218 __entry
->start
= page
->index
;
1219 __entry
->nrpage
= nrpage
;
1222 TP_printk("dev = (%d,%d), ino = %lu, start = %lu nrpage = %u",
1223 show_dev_ino(__entry
),
1224 (unsigned long)__entry
->start
,
1228 TRACE_EVENT(f2fs_write_checkpoint
,
1230 TP_PROTO(struct super_block
*sb
, int reason
, char *msg
),
1232 TP_ARGS(sb
, reason
, msg
),
1236 __field(int, reason
)
1237 __field(char *, msg
)
1241 __entry
->dev
= sb
->s_dev
;
1242 __entry
->reason
= reason
;
1246 TP_printk("dev = (%d,%d), checkpoint for %s, state = %s",
1247 show_dev(__entry
->dev
),
1248 show_cpreason(__entry
->reason
),
1252 DECLARE_EVENT_CLASS(f2fs_discard
,
1254 TP_PROTO(struct block_device
*dev
, block_t blkstart
, block_t blklen
),
1256 TP_ARGS(dev
, blkstart
, blklen
),
1260 __field(block_t
, blkstart
)
1261 __field(block_t
, blklen
)
1265 __entry
->dev
= dev
->bd_dev
;
1266 __entry
->blkstart
= blkstart
;
1267 __entry
->blklen
= blklen
;
1270 TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx",
1271 show_dev(__entry
->dev
),
1272 (unsigned long long)__entry
->blkstart
,
1273 (unsigned long long)__entry
->blklen
)
1276 DEFINE_EVENT(f2fs_discard
, f2fs_queue_discard
,
1278 TP_PROTO(struct block_device
*dev
, block_t blkstart
, block_t blklen
),
1280 TP_ARGS(dev
, blkstart
, blklen
)
1283 DEFINE_EVENT(f2fs_discard
, f2fs_issue_discard
,
1285 TP_PROTO(struct block_device
*dev
, block_t blkstart
, block_t blklen
),
1287 TP_ARGS(dev
, blkstart
, blklen
)
1290 TRACE_EVENT(f2fs_issue_reset_zone
,
1292 TP_PROTO(struct block_device
*dev
, block_t blkstart
),
1294 TP_ARGS(dev
, blkstart
),
1298 __field(block_t
, blkstart
)
1302 __entry
->dev
= dev
->bd_dev
;
1303 __entry
->blkstart
= blkstart
;
1306 TP_printk("dev = (%d,%d), reset zone at block = 0x%llx",
1307 show_dev(__entry
->dev
),
1308 (unsigned long long)__entry
->blkstart
)
1311 TRACE_EVENT(f2fs_issue_flush
,
1313 TP_PROTO(struct block_device
*dev
, unsigned int nobarrier
,
1314 unsigned int flush_merge
, int ret
),
1316 TP_ARGS(dev
, nobarrier
, flush_merge
, ret
),
1320 __field(unsigned int, nobarrier
)
1321 __field(unsigned int, flush_merge
)
1326 __entry
->dev
= dev
->bd_dev
;
1327 __entry
->nobarrier
= nobarrier
;
1328 __entry
->flush_merge
= flush_merge
;
1332 TP_printk("dev = (%d,%d), %s %s, ret = %d",
1333 show_dev(__entry
->dev
),
1334 __entry
->nobarrier
? "skip (nobarrier)" : "issue",
1335 __entry
->flush_merge
? " with flush_merge" : "",
1339 TRACE_EVENT(f2fs_lookup_extent_tree_start
,
1341 TP_PROTO(struct inode
*inode
, unsigned int pgofs
),
1343 TP_ARGS(inode
, pgofs
),
1348 __field(unsigned int, pgofs
)
1352 __entry
->dev
= inode
->i_sb
->s_dev
;
1353 __entry
->ino
= inode
->i_ino
;
1354 __entry
->pgofs
= pgofs
;
1357 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u",
1358 show_dev_ino(__entry
),
1362 TRACE_EVENT_CONDITION(f2fs_lookup_extent_tree_end
,
1364 TP_PROTO(struct inode
*inode
, unsigned int pgofs
,
1365 struct extent_info
*ei
),
1367 TP_ARGS(inode
, pgofs
, ei
),
1374 __field(unsigned int, pgofs
)
1375 __field(unsigned int, fofs
)
1377 __field(unsigned int, len
)
1381 __entry
->dev
= inode
->i_sb
->s_dev
;
1382 __entry
->ino
= inode
->i_ino
;
1383 __entry
->pgofs
= pgofs
;
1384 __entry
->fofs
= ei
->fofs
;
1385 __entry
->blk
= ei
->blk
;
1386 __entry
->len
= ei
->len
;
1389 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1390 "ext_info(fofs: %u, blk: %u, len: %u)",
1391 show_dev_ino(__entry
),
1398 TRACE_EVENT(f2fs_update_extent_tree_range
,
1400 TP_PROTO(struct inode
*inode
, unsigned int pgofs
, block_t blkaddr
,
1403 TP_ARGS(inode
, pgofs
, blkaddr
, len
),
1408 __field(unsigned int, pgofs
)
1410 __field(unsigned int, len
)
1414 __entry
->dev
= inode
->i_sb
->s_dev
;
1415 __entry
->ino
= inode
->i_ino
;
1416 __entry
->pgofs
= pgofs
;
1417 __entry
->blk
= blkaddr
;
1421 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1422 "blkaddr = %u, len = %u",
1423 show_dev_ino(__entry
),
1429 TRACE_EVENT(f2fs_shrink_extent_tree
,
1431 TP_PROTO(struct f2fs_sb_info
*sbi
, unsigned int node_cnt
,
1432 unsigned int tree_cnt
),
1434 TP_ARGS(sbi
, node_cnt
, tree_cnt
),
1438 __field(unsigned int, node_cnt
)
1439 __field(unsigned int, tree_cnt
)
1443 __entry
->dev
= sbi
->sb
->s_dev
;
1444 __entry
->node_cnt
= node_cnt
;
1445 __entry
->tree_cnt
= tree_cnt
;
1448 TP_printk("dev = (%d,%d), shrunk: node_cnt = %u, tree_cnt = %u",
1449 show_dev(__entry
->dev
),
1454 TRACE_EVENT(f2fs_destroy_extent_tree
,
1456 TP_PROTO(struct inode
*inode
, unsigned int node_cnt
),
1458 TP_ARGS(inode
, node_cnt
),
1463 __field(unsigned int, node_cnt
)
1467 __entry
->dev
= inode
->i_sb
->s_dev
;
1468 __entry
->ino
= inode
->i_ino
;
1469 __entry
->node_cnt
= node_cnt
;
1472 TP_printk("dev = (%d,%d), ino = %lu, destroyed: node_cnt = %u",
1473 show_dev_ino(__entry
),
1477 DECLARE_EVENT_CLASS(f2fs_sync_dirty_inodes
,
1479 TP_PROTO(struct super_block
*sb
, int type
, s64 count
),
1481 TP_ARGS(sb
, type
, count
),
1490 __entry
->dev
= sb
->s_dev
;
1491 __entry
->type
= type
;
1492 __entry
->count
= count
;
1495 TP_printk("dev = (%d,%d), %s, dirty count = %lld",
1496 show_dev(__entry
->dev
),
1497 show_file_type(__entry
->type
),
1501 DEFINE_EVENT(f2fs_sync_dirty_inodes
, f2fs_sync_dirty_inodes_enter
,
1503 TP_PROTO(struct super_block
*sb
, int type
, s64 count
),
1505 TP_ARGS(sb
, type
, count
)
1508 DEFINE_EVENT(f2fs_sync_dirty_inodes
, f2fs_sync_dirty_inodes_exit
,
1510 TP_PROTO(struct super_block
*sb
, int type
, s64 count
),
1512 TP_ARGS(sb
, type
, count
)
1515 #endif /* _TRACE_F2FS_H */
1517 /* This part must be outside protection */
1518 #include <trace/define_trace.h>