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 #define show_fsync_cpreason(type) \
141 __print_symbolic(type, \
142 { CP_NO_NEEDED, "no needed" }, \
143 { CP_NON_REGULAR, "non regular" }, \
144 { CP_HARDLINK, "hardlink" }, \
145 { CP_SB_NEED_CP, "sb needs cp" }, \
146 { CP_WRONG_PINO, "wrong pino" }, \
147 { CP_NO_SPC_ROLL, "no space roll forward" }, \
148 { CP_NODE_NEED_CP, "node needs cp" }, \
149 { CP_FASTBOOT_MODE, "fastboot mode" }, \
150 { CP_SPEC_LOG_NUM, "log type is 2" }, \
151 { CP_RECOVER_DIR, "dir needs recovery" })
153 struct victim_sel_policy
;
154 struct f2fs_map_blocks
;
156 DECLARE_EVENT_CLASS(f2fs__inode
,
158 TP_PROTO(struct inode
*inode
),
166 __field(umode_t
, mode
)
167 __field(loff_t
, size
)
168 __field(unsigned int, nlink
)
169 __field(blkcnt_t
, blocks
)
170 __field(__u8
, advise
)
174 __entry
->dev
= inode
->i_sb
->s_dev
;
175 __entry
->ino
= inode
->i_ino
;
176 __entry
->pino
= F2FS_I(inode
)->i_pino
;
177 __entry
->mode
= inode
->i_mode
;
178 __entry
->nlink
= inode
->i_nlink
;
179 __entry
->size
= inode
->i_size
;
180 __entry
->blocks
= inode
->i_blocks
;
181 __entry
->advise
= F2FS_I(inode
)->i_advise
;
184 TP_printk("dev = (%d,%d), ino = %lu, pino = %lu, i_mode = 0x%hx, "
185 "i_size = %lld, i_nlink = %u, i_blocks = %llu, i_advise = 0x%x",
186 show_dev_ino(__entry
),
187 (unsigned long)__entry
->pino
,
190 (unsigned int)__entry
->nlink
,
191 (unsigned long long)__entry
->blocks
,
192 (unsigned char)__entry
->advise
)
195 DECLARE_EVENT_CLASS(f2fs__inode_exit
,
197 TP_PROTO(struct inode
*inode
, int ret
),
208 __entry
->dev
= inode
->i_sb
->s_dev
;
209 __entry
->ino
= inode
->i_ino
;
213 TP_printk("dev = (%d,%d), ino = %lu, ret = %d",
214 show_dev_ino(__entry
),
218 DEFINE_EVENT(f2fs__inode
, f2fs_sync_file_enter
,
220 TP_PROTO(struct inode
*inode
),
225 TRACE_EVENT(f2fs_sync_file_exit
,
227 TP_PROTO(struct inode
*inode
, int cp_reason
, int datasync
, int ret
),
229 TP_ARGS(inode
, cp_reason
, datasync
, ret
),
234 __field(int, cp_reason
)
235 __field(int, datasync
)
240 __entry
->dev
= inode
->i_sb
->s_dev
;
241 __entry
->ino
= inode
->i_ino
;
242 __entry
->cp_reason
= cp_reason
;
243 __entry
->datasync
= datasync
;
247 TP_printk("dev = (%d,%d), ino = %lu, cp_reason: %s, "
248 "datasync = %d, ret = %d",
249 show_dev_ino(__entry
),
250 show_fsync_cpreason(__entry
->cp_reason
),
255 TRACE_EVENT(f2fs_sync_fs
,
257 TP_PROTO(struct super_block
*sb
, int wait
),
268 __entry
->dev
= sb
->s_dev
;
269 __entry
->dirty
= is_sbi_flag_set(F2FS_SB(sb
), SBI_IS_DIRTY
);
270 __entry
->wait
= wait
;
273 TP_printk("dev = (%d,%d), superblock is %s, wait = %d",
274 show_dev(__entry
->dev
),
275 __entry
->dirty
? "dirty" : "not dirty",
279 DEFINE_EVENT(f2fs__inode
, f2fs_iget
,
281 TP_PROTO(struct inode
*inode
),
286 DEFINE_EVENT(f2fs__inode_exit
, f2fs_iget_exit
,
288 TP_PROTO(struct inode
*inode
, int ret
),
293 DEFINE_EVENT(f2fs__inode
, f2fs_evict_inode
,
295 TP_PROTO(struct inode
*inode
),
300 DEFINE_EVENT(f2fs__inode_exit
, f2fs_new_inode
,
302 TP_PROTO(struct inode
*inode
, int ret
),
307 TRACE_EVENT(f2fs_unlink_enter
,
309 TP_PROTO(struct inode
*dir
, struct dentry
*dentry
),
311 TP_ARGS(dir
, dentry
),
316 __field(loff_t
, size
)
317 __field(blkcnt_t
, blocks
)
318 __field(const char *, name
)
322 __entry
->dev
= dir
->i_sb
->s_dev
;
323 __entry
->ino
= dir
->i_ino
;
324 __entry
->size
= dir
->i_size
;
325 __entry
->blocks
= dir
->i_blocks
;
326 __entry
->name
= dentry
->d_name
.name
;
329 TP_printk("dev = (%d,%d), dir ino = %lu, i_size = %lld, "
330 "i_blocks = %llu, name = %s",
331 show_dev_ino(__entry
),
333 (unsigned long long)__entry
->blocks
,
337 DEFINE_EVENT(f2fs__inode_exit
, f2fs_unlink_exit
,
339 TP_PROTO(struct inode
*inode
, int ret
),
344 DEFINE_EVENT(f2fs__inode_exit
, f2fs_drop_inode
,
346 TP_PROTO(struct inode
*inode
, int ret
),
351 DEFINE_EVENT(f2fs__inode
, f2fs_truncate
,
353 TP_PROTO(struct inode
*inode
),
358 TRACE_EVENT(f2fs_truncate_data_blocks_range
,
360 TP_PROTO(struct inode
*inode
, nid_t nid
, unsigned int ofs
, int free
),
362 TP_ARGS(inode
, nid
, ofs
, free
),
368 __field(unsigned int, ofs
)
373 __entry
->dev
= inode
->i_sb
->s_dev
;
374 __entry
->ino
= inode
->i_ino
;
377 __entry
->free
= free
;
380 TP_printk("dev = (%d,%d), ino = %lu, nid = %u, offset = %u, freed = %d",
381 show_dev_ino(__entry
),
382 (unsigned int)__entry
->nid
,
387 DECLARE_EVENT_CLASS(f2fs__truncate_op
,
389 TP_PROTO(struct inode
*inode
, u64 from
),
391 TP_ARGS(inode
, from
),
396 __field(loff_t
, size
)
397 __field(blkcnt_t
, blocks
)
402 __entry
->dev
= inode
->i_sb
->s_dev
;
403 __entry
->ino
= inode
->i_ino
;
404 __entry
->size
= inode
->i_size
;
405 __entry
->blocks
= inode
->i_blocks
;
406 __entry
->from
= from
;
409 TP_printk("dev = (%d,%d), ino = %lu, i_size = %lld, i_blocks = %llu, "
410 "start file offset = %llu",
411 show_dev_ino(__entry
),
413 (unsigned long long)__entry
->blocks
,
414 (unsigned long long)__entry
->from
)
417 DEFINE_EVENT(f2fs__truncate_op
, f2fs_truncate_blocks_enter
,
419 TP_PROTO(struct inode
*inode
, u64 from
),
424 DEFINE_EVENT(f2fs__inode_exit
, f2fs_truncate_blocks_exit
,
426 TP_PROTO(struct inode
*inode
, int ret
),
431 DEFINE_EVENT(f2fs__truncate_op
, f2fs_truncate_inode_blocks_enter
,
433 TP_PROTO(struct inode
*inode
, u64 from
),
438 DEFINE_EVENT(f2fs__inode_exit
, f2fs_truncate_inode_blocks_exit
,
440 TP_PROTO(struct inode
*inode
, int ret
),
445 DECLARE_EVENT_CLASS(f2fs__truncate_node
,
447 TP_PROTO(struct inode
*inode
, nid_t nid
, block_t blk_addr
),
449 TP_ARGS(inode
, nid
, blk_addr
),
455 __field(block_t
, blk_addr
)
459 __entry
->dev
= inode
->i_sb
->s_dev
;
460 __entry
->ino
= inode
->i_ino
;
462 __entry
->blk_addr
= blk_addr
;
465 TP_printk("dev = (%d,%d), ino = %lu, nid = %u, block_address = 0x%llx",
466 show_dev_ino(__entry
),
467 (unsigned int)__entry
->nid
,
468 (unsigned long long)__entry
->blk_addr
)
471 DEFINE_EVENT(f2fs__truncate_node
, f2fs_truncate_nodes_enter
,
473 TP_PROTO(struct inode
*inode
, nid_t nid
, block_t blk_addr
),
475 TP_ARGS(inode
, nid
, blk_addr
)
478 DEFINE_EVENT(f2fs__inode_exit
, f2fs_truncate_nodes_exit
,
480 TP_PROTO(struct inode
*inode
, int ret
),
485 DEFINE_EVENT(f2fs__truncate_node
, f2fs_truncate_node
,
487 TP_PROTO(struct inode
*inode
, nid_t nid
, block_t blk_addr
),
489 TP_ARGS(inode
, nid
, blk_addr
)
492 TRACE_EVENT(f2fs_truncate_partial_nodes
,
494 TP_PROTO(struct inode
*inode
, nid_t nid
[], int depth
, int err
),
496 TP_ARGS(inode
, nid
, depth
, err
),
501 __field(nid_t
, nid
[3])
507 __entry
->dev
= inode
->i_sb
->s_dev
;
508 __entry
->ino
= inode
->i_ino
;
509 __entry
->nid
[0] = nid
[0];
510 __entry
->nid
[1] = nid
[1];
511 __entry
->nid
[2] = nid
[2];
512 __entry
->depth
= depth
;
516 TP_printk("dev = (%d,%d), ino = %lu, "
517 "nid[0] = %u, nid[1] = %u, nid[2] = %u, depth = %d, err = %d",
518 show_dev_ino(__entry
),
519 (unsigned int)__entry
->nid
[0],
520 (unsigned int)__entry
->nid
[1],
521 (unsigned int)__entry
->nid
[2],
526 TRACE_EVENT(f2fs_map_blocks
,
527 TP_PROTO(struct inode
*inode
, struct f2fs_map_blocks
*map
, int ret
),
529 TP_ARGS(inode
, map
, ret
),
534 __field(block_t
, m_lblk
)
535 __field(block_t
, m_pblk
)
536 __field(unsigned int, m_len
)
541 __entry
->dev
= inode
->i_sb
->s_dev
;
542 __entry
->ino
= inode
->i_ino
;
543 __entry
->m_lblk
= map
->m_lblk
;
544 __entry
->m_pblk
= map
->m_pblk
;
545 __entry
->m_len
= map
->m_len
;
549 TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, "
550 "start blkaddr = 0x%llx, len = 0x%llx, err = %d",
551 show_dev_ino(__entry
),
552 (unsigned long long)__entry
->m_lblk
,
553 (unsigned long long)__entry
->m_pblk
,
554 (unsigned long long)__entry
->m_len
,
558 TRACE_EVENT(f2fs_background_gc
,
560 TP_PROTO(struct super_block
*sb
, unsigned int wait_ms
,
561 unsigned int prefree
, unsigned int free
),
563 TP_ARGS(sb
, wait_ms
, prefree
, free
),
567 __field(unsigned int, wait_ms
)
568 __field(unsigned int, prefree
)
569 __field(unsigned int, free
)
573 __entry
->dev
= sb
->s_dev
;
574 __entry
->wait_ms
= wait_ms
;
575 __entry
->prefree
= prefree
;
576 __entry
->free
= free
;
579 TP_printk("dev = (%d,%d), wait_ms = %u, prefree = %u, free = %u",
580 show_dev(__entry
->dev
),
586 TRACE_EVENT(f2fs_gc_begin
,
588 TP_PROTO(struct super_block
*sb
, bool sync
, bool background
,
589 long long dirty_nodes
, long long dirty_dents
,
590 long long dirty_imeta
, unsigned int free_sec
,
591 unsigned int free_seg
, int reserved_seg
,
592 unsigned int prefree_seg
),
594 TP_ARGS(sb
, sync
, background
, dirty_nodes
, dirty_dents
, dirty_imeta
,
595 free_sec
, free_seg
, reserved_seg
, prefree_seg
),
600 __field(bool, background
)
601 __field(long long, dirty_nodes
)
602 __field(long long, dirty_dents
)
603 __field(long long, dirty_imeta
)
604 __field(unsigned int, free_sec
)
605 __field(unsigned int, free_seg
)
606 __field(int, reserved_seg
)
607 __field(unsigned int, prefree_seg
)
611 __entry
->dev
= sb
->s_dev
;
612 __entry
->sync
= sync
;
613 __entry
->background
= background
;
614 __entry
->dirty_nodes
= dirty_nodes
;
615 __entry
->dirty_dents
= dirty_dents
;
616 __entry
->dirty_imeta
= dirty_imeta
;
617 __entry
->free_sec
= free_sec
;
618 __entry
->free_seg
= free_seg
;
619 __entry
->reserved_seg
= reserved_seg
;
620 __entry
->prefree_seg
= prefree_seg
;
623 TP_printk("dev = (%d,%d), sync = %d, background = %d, nodes = %lld, "
624 "dents = %lld, imeta = %lld, free_sec:%u, free_seg:%u, "
625 "rsv_seg:%d, prefree_seg:%u",
626 show_dev(__entry
->dev
),
629 __entry
->dirty_nodes
,
630 __entry
->dirty_dents
,
631 __entry
->dirty_imeta
,
634 __entry
->reserved_seg
,
635 __entry
->prefree_seg
)
638 TRACE_EVENT(f2fs_gc_end
,
640 TP_PROTO(struct super_block
*sb
, int ret
, int seg_freed
,
641 int sec_freed
, long long dirty_nodes
,
642 long long dirty_dents
, long long dirty_imeta
,
643 unsigned int free_sec
, unsigned int free_seg
,
644 int reserved_seg
, unsigned int prefree_seg
),
646 TP_ARGS(sb
, ret
, seg_freed
, sec_freed
, dirty_nodes
, dirty_dents
,
647 dirty_imeta
, free_sec
, free_seg
, reserved_seg
, prefree_seg
),
652 __field(int, seg_freed
)
653 __field(int, sec_freed
)
654 __field(long long, dirty_nodes
)
655 __field(long long, dirty_dents
)
656 __field(long long, dirty_imeta
)
657 __field(unsigned int, free_sec
)
658 __field(unsigned int, free_seg
)
659 __field(int, reserved_seg
)
660 __field(unsigned int, prefree_seg
)
664 __entry
->dev
= sb
->s_dev
;
666 __entry
->seg_freed
= seg_freed
;
667 __entry
->sec_freed
= sec_freed
;
668 __entry
->dirty_nodes
= dirty_nodes
;
669 __entry
->dirty_dents
= dirty_dents
;
670 __entry
->dirty_imeta
= dirty_imeta
;
671 __entry
->free_sec
= free_sec
;
672 __entry
->free_seg
= free_seg
;
673 __entry
->reserved_seg
= reserved_seg
;
674 __entry
->prefree_seg
= prefree_seg
;
677 TP_printk("dev = (%d,%d), ret = %d, seg_freed = %d, sec_freed = %d, "
678 "nodes = %lld, dents = %lld, imeta = %lld, free_sec:%u, "
679 "free_seg:%u, rsv_seg:%d, prefree_seg:%u",
680 show_dev(__entry
->dev
),
684 __entry
->dirty_nodes
,
685 __entry
->dirty_dents
,
686 __entry
->dirty_imeta
,
689 __entry
->reserved_seg
,
690 __entry
->prefree_seg
)
693 TRACE_EVENT(f2fs_get_victim
,
695 TP_PROTO(struct super_block
*sb
, int type
, int gc_type
,
696 struct victim_sel_policy
*p
, unsigned int pre_victim
,
697 unsigned int prefree
, unsigned int free
),
699 TP_ARGS(sb
, type
, gc_type
, p
, pre_victim
, prefree
, free
),
704 __field(int, gc_type
)
705 __field(int, alloc_mode
)
706 __field(int, gc_mode
)
707 __field(unsigned int, victim
)
708 __field(unsigned int, cost
)
709 __field(unsigned int, ofs_unit
)
710 __field(unsigned int, pre_victim
)
711 __field(unsigned int, prefree
)
712 __field(unsigned int, free
)
716 __entry
->dev
= sb
->s_dev
;
717 __entry
->type
= type
;
718 __entry
->gc_type
= gc_type
;
719 __entry
->alloc_mode
= p
->alloc_mode
;
720 __entry
->gc_mode
= p
->gc_mode
;
721 __entry
->victim
= p
->min_segno
;
722 __entry
->cost
= p
->min_cost
;
723 __entry
->ofs_unit
= p
->ofs_unit
;
724 __entry
->pre_victim
= pre_victim
;
725 __entry
->prefree
= prefree
;
726 __entry
->free
= free
;
729 TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), "
730 "victim = %u, cost = %u, ofs_unit = %u, "
731 "pre_victim_secno = %d, prefree = %u, free = %u",
732 show_dev(__entry
->dev
),
733 show_data_type(__entry
->type
),
734 show_gc_type(__entry
->gc_type
),
735 show_alloc_mode(__entry
->alloc_mode
),
736 show_victim_policy(__entry
->gc_mode
),
740 (int)__entry
->pre_victim
,
745 TRACE_EVENT(f2fs_lookup_start
,
747 TP_PROTO(struct inode
*dir
, struct dentry
*dentry
, unsigned int flags
),
749 TP_ARGS(dir
, dentry
, flags
),
754 __field(const char *, name
)
755 __field(unsigned int, flags
)
759 __entry
->dev
= dir
->i_sb
->s_dev
;
760 __entry
->ino
= dir
->i_ino
;
761 __entry
->name
= dentry
->d_name
.name
;
762 __entry
->flags
= flags
;
765 TP_printk("dev = (%d,%d), pino = %lu, name:%s, flags:%u",
766 show_dev_ino(__entry
),
771 TRACE_EVENT(f2fs_lookup_end
,
773 TP_PROTO(struct inode
*dir
, struct dentry
*dentry
, nid_t ino
,
776 TP_ARGS(dir
, dentry
, ino
, err
),
781 __field(const char *, name
)
787 __entry
->dev
= dir
->i_sb
->s_dev
;
788 __entry
->ino
= dir
->i_ino
;
789 __entry
->name
= dentry
->d_name
.name
;
794 TP_printk("dev = (%d,%d), pino = %lu, name:%s, ino:%u, err:%d",
795 show_dev_ino(__entry
),
801 TRACE_EVENT(f2fs_readdir
,
803 TP_PROTO(struct inode
*dir
, loff_t start_pos
, loff_t end_pos
, int err
),
805 TP_ARGS(dir
, start_pos
, end_pos
, err
),
810 __field(loff_t
, start
)
816 __entry
->dev
= dir
->i_sb
->s_dev
;
817 __entry
->ino
= dir
->i_ino
;
818 __entry
->start
= start_pos
;
819 __entry
->end
= end_pos
;
823 TP_printk("dev = (%d,%d), ino = %lu, start_pos:%llu, end_pos:%llu, err:%d",
824 show_dev_ino(__entry
),
830 TRACE_EVENT(f2fs_fallocate
,
832 TP_PROTO(struct inode
*inode
, int mode
,
833 loff_t offset
, loff_t len
, int ret
),
835 TP_ARGS(inode
, mode
, offset
, len
, ret
),
841 __field(loff_t
, offset
)
843 __field(loff_t
, size
)
844 __field(blkcnt_t
, blocks
)
849 __entry
->dev
= inode
->i_sb
->s_dev
;
850 __entry
->ino
= inode
->i_ino
;
851 __entry
->mode
= mode
;
852 __entry
->offset
= offset
;
854 __entry
->size
= inode
->i_size
;
855 __entry
->blocks
= inode
->i_blocks
;
859 TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, "
860 "len = %lld, i_size = %lld, i_blocks = %llu, ret = %d",
861 show_dev_ino(__entry
),
863 (unsigned long long)__entry
->offset
,
864 (unsigned long long)__entry
->len
,
865 (unsigned long long)__entry
->size
,
866 (unsigned long long)__entry
->blocks
,
870 TRACE_EVENT(f2fs_direct_IO_enter
,
872 TP_PROTO(struct inode
*inode
, loff_t offset
, unsigned long len
, int rw
),
874 TP_ARGS(inode
, offset
, len
, rw
),
880 __field(unsigned long, len
)
885 __entry
->dev
= inode
->i_sb
->s_dev
;
886 __entry
->ino
= inode
->i_ino
;
887 __entry
->pos
= offset
;
892 TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu rw = %d",
893 show_dev_ino(__entry
),
899 TRACE_EVENT(f2fs_direct_IO_exit
,
901 TP_PROTO(struct inode
*inode
, loff_t offset
, unsigned long len
,
904 TP_ARGS(inode
, offset
, len
, rw
, ret
),
910 __field(unsigned long, len
)
916 __entry
->dev
= inode
->i_sb
->s_dev
;
917 __entry
->ino
= inode
->i_ino
;
918 __entry
->pos
= offset
;
924 TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu "
926 show_dev_ino(__entry
),
933 TRACE_EVENT(f2fs_reserve_new_blocks
,
935 TP_PROTO(struct inode
*inode
, nid_t nid
, unsigned int ofs_in_node
,
938 TP_ARGS(inode
, nid
, ofs_in_node
, count
),
943 __field(unsigned int, ofs_in_node
)
944 __field(blkcnt_t
, count
)
948 __entry
->dev
= inode
->i_sb
->s_dev
;
950 __entry
->ofs_in_node
= ofs_in_node
;
951 __entry
->count
= count
;
954 TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u, count = %llu",
955 show_dev(__entry
->dev
),
956 (unsigned int)__entry
->nid
,
957 __entry
->ofs_in_node
,
958 (unsigned long long)__entry
->count
)
961 DECLARE_EVENT_CLASS(f2fs__submit_page_bio
,
963 TP_PROTO(struct page
*page
, struct f2fs_io_info
*fio
),
970 __field(pgoff_t
, index
)
971 __field(block_t
, old_blkaddr
)
972 __field(block_t
, new_blkaddr
)
974 __field(int, op_flags
)
980 __entry
->dev
= page
->mapping
->host
->i_sb
->s_dev
;
981 __entry
->ino
= page
->mapping
->host
->i_ino
;
982 __entry
->index
= page
->index
;
983 __entry
->old_blkaddr
= fio
->old_blkaddr
;
984 __entry
->new_blkaddr
= fio
->new_blkaddr
;
985 __entry
->op
= fio
->op
;
986 __entry
->op_flags
= fio
->op_flags
;
987 __entry
->temp
= fio
->temp
;
988 __entry
->type
= fio
->type
;
991 TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, "
992 "oldaddr = 0x%llx, newaddr = 0x%llx, rw = %s(%s), type = %s_%s",
993 show_dev_ino(__entry
),
994 (unsigned long)__entry
->index
,
995 (unsigned long long)__entry
->old_blkaddr
,
996 (unsigned long long)__entry
->new_blkaddr
,
997 show_bio_type(__entry
->op
, __entry
->op_flags
),
998 show_block_temp(__entry
->temp
),
999 show_block_type(__entry
->type
))
1002 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio
, f2fs_submit_page_bio
,
1004 TP_PROTO(struct page
*page
, struct f2fs_io_info
*fio
),
1008 TP_CONDITION(page
->mapping
)
1011 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio
, f2fs_submit_page_write
,
1013 TP_PROTO(struct page
*page
, struct f2fs_io_info
*fio
),
1017 TP_CONDITION(page
->mapping
)
1020 DECLARE_EVENT_CLASS(f2fs__bio
,
1022 TP_PROTO(struct super_block
*sb
, int type
, struct bio
*bio
),
1024 TP_ARGS(sb
, type
, bio
),
1028 __field(dev_t
, target
)
1030 __field(int, op_flags
)
1032 __field(sector_t
, sector
)
1033 __field(unsigned int, size
)
1037 __entry
->dev
= sb
->s_dev
;
1038 __entry
->target
= bio_dev(bio
);
1039 __entry
->op
= bio_op(bio
);
1040 __entry
->op_flags
= bio
->bi_opf
;
1041 __entry
->type
= type
;
1042 __entry
->sector
= bio
->bi_iter
.bi_sector
;
1043 __entry
->size
= bio
->bi_iter
.bi_size
;
1046 TP_printk("dev = (%d,%d)/(%d,%d), rw = %s(%s), %s, sector = %lld, size = %u",
1047 show_dev(__entry
->target
),
1048 show_dev(__entry
->dev
),
1049 show_bio_type(__entry
->op
, __entry
->op_flags
),
1050 show_block_type(__entry
->type
),
1051 (unsigned long long)__entry
->sector
,
1055 DEFINE_EVENT_CONDITION(f2fs__bio
, f2fs_prepare_write_bio
,
1057 TP_PROTO(struct super_block
*sb
, int type
, struct bio
*bio
),
1059 TP_ARGS(sb
, type
, bio
),
1064 DEFINE_EVENT_CONDITION(f2fs__bio
, f2fs_prepare_read_bio
,
1066 TP_PROTO(struct super_block
*sb
, int type
, struct bio
*bio
),
1068 TP_ARGS(sb
, type
, bio
),
1073 DEFINE_EVENT_CONDITION(f2fs__bio
, f2fs_submit_read_bio
,
1075 TP_PROTO(struct super_block
*sb
, int type
, struct bio
*bio
),
1077 TP_ARGS(sb
, type
, bio
),
1082 DEFINE_EVENT_CONDITION(f2fs__bio
, f2fs_submit_write_bio
,
1084 TP_PROTO(struct super_block
*sb
, int type
, struct bio
*bio
),
1086 TP_ARGS(sb
, type
, bio
),
1091 TRACE_EVENT(f2fs_write_begin
,
1093 TP_PROTO(struct inode
*inode
, loff_t pos
, unsigned int len
,
1094 unsigned int flags
),
1096 TP_ARGS(inode
, pos
, len
, flags
),
1101 __field(loff_t
, pos
)
1102 __field(unsigned int, len
)
1103 __field(unsigned int, flags
)
1107 __entry
->dev
= inode
->i_sb
->s_dev
;
1108 __entry
->ino
= inode
->i_ino
;
1111 __entry
->flags
= flags
;
1114 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u",
1115 show_dev_ino(__entry
),
1116 (unsigned long long)__entry
->pos
,
1121 TRACE_EVENT(f2fs_write_end
,
1123 TP_PROTO(struct inode
*inode
, loff_t pos
, unsigned int len
,
1124 unsigned int copied
),
1126 TP_ARGS(inode
, pos
, len
, copied
),
1131 __field(loff_t
, pos
)
1132 __field(unsigned int, len
)
1133 __field(unsigned int, copied
)
1137 __entry
->dev
= inode
->i_sb
->s_dev
;
1138 __entry
->ino
= inode
->i_ino
;
1141 __entry
->copied
= copied
;
1144 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u",
1145 show_dev_ino(__entry
),
1146 (unsigned long long)__entry
->pos
,
1151 DECLARE_EVENT_CLASS(f2fs__page
,
1153 TP_PROTO(struct page
*page
, int type
),
1155 TP_ARGS(page
, type
),
1162 __field(pgoff_t
, index
)
1164 __field(int, uptodate
)
1168 __entry
->dev
= page
->mapping
->host
->i_sb
->s_dev
;
1169 __entry
->ino
= page
->mapping
->host
->i_ino
;
1170 __entry
->type
= type
;
1171 __entry
->dir
= S_ISDIR(page
->mapping
->host
->i_mode
);
1172 __entry
->index
= page
->index
;
1173 __entry
->dirty
= PageDirty(page
);
1174 __entry
->uptodate
= PageUptodate(page
);
1177 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, "
1178 "dirty = %d, uptodate = %d",
1179 show_dev_ino(__entry
),
1180 show_block_type(__entry
->type
),
1181 show_file_type(__entry
->dir
),
1182 (unsigned long)__entry
->index
,
1187 DEFINE_EVENT(f2fs__page
, f2fs_writepage
,
1189 TP_PROTO(struct page
*page
, int type
),
1194 DEFINE_EVENT(f2fs__page
, f2fs_do_write_data_page
,
1196 TP_PROTO(struct page
*page
, int type
),
1201 DEFINE_EVENT(f2fs__page
, f2fs_readpage
,
1203 TP_PROTO(struct page
*page
, int type
),
1208 DEFINE_EVENT(f2fs__page
, f2fs_set_page_dirty
,
1210 TP_PROTO(struct page
*page
, int type
),
1215 DEFINE_EVENT(f2fs__page
, f2fs_vm_page_mkwrite
,
1217 TP_PROTO(struct page
*page
, int type
),
1222 DEFINE_EVENT(f2fs__page
, f2fs_register_inmem_page
,
1224 TP_PROTO(struct page
*page
, int type
),
1229 DEFINE_EVENT(f2fs__page
, f2fs_commit_inmem_page
,
1231 TP_PROTO(struct page
*page
, int type
),
1236 TRACE_EVENT(f2fs_writepages
,
1238 TP_PROTO(struct inode
*inode
, struct writeback_control
*wbc
, int type
),
1240 TP_ARGS(inode
, wbc
, type
),
1247 __field(long, nr_to_write
)
1248 __field(long, pages_skipped
)
1249 __field(loff_t
, range_start
)
1250 __field(loff_t
, range_end
)
1251 __field(pgoff_t
, writeback_index
)
1252 __field(int, sync_mode
)
1253 __field(char, for_kupdate
)
1254 __field(char, for_background
)
1255 __field(char, tagged_writepages
)
1256 __field(char, for_reclaim
)
1257 __field(char, range_cyclic
)
1258 __field(char, for_sync
)
1262 __entry
->dev
= inode
->i_sb
->s_dev
;
1263 __entry
->ino
= inode
->i_ino
;
1264 __entry
->type
= type
;
1265 __entry
->dir
= S_ISDIR(inode
->i_mode
);
1266 __entry
->nr_to_write
= wbc
->nr_to_write
;
1267 __entry
->pages_skipped
= wbc
->pages_skipped
;
1268 __entry
->range_start
= wbc
->range_start
;
1269 __entry
->range_end
= wbc
->range_end
;
1270 __entry
->writeback_index
= inode
->i_mapping
->writeback_index
;
1271 __entry
->sync_mode
= wbc
->sync_mode
;
1272 __entry
->for_kupdate
= wbc
->for_kupdate
;
1273 __entry
->for_background
= wbc
->for_background
;
1274 __entry
->tagged_writepages
= wbc
->tagged_writepages
;
1275 __entry
->for_reclaim
= wbc
->for_reclaim
;
1276 __entry
->range_cyclic
= wbc
->range_cyclic
;
1277 __entry
->for_sync
= wbc
->for_sync
;
1280 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
1281 "skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
1282 "kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
1283 show_dev_ino(__entry
),
1284 show_block_type(__entry
->type
),
1285 show_file_type(__entry
->dir
),
1286 __entry
->nr_to_write
,
1287 __entry
->pages_skipped
,
1288 __entry
->range_start
,
1290 (unsigned long)__entry
->writeback_index
,
1292 __entry
->for_kupdate
,
1293 __entry
->for_background
,
1294 __entry
->tagged_writepages
,
1295 __entry
->for_reclaim
,
1296 __entry
->range_cyclic
,
1300 TRACE_EVENT(f2fs_readpages
,
1302 TP_PROTO(struct inode
*inode
, struct page
*page
, unsigned int nrpage
),
1304 TP_ARGS(inode
, page
, nrpage
),
1309 __field(pgoff_t
, start
)
1310 __field(unsigned int, nrpage
)
1314 __entry
->dev
= inode
->i_sb
->s_dev
;
1315 __entry
->ino
= inode
->i_ino
;
1316 __entry
->start
= page
->index
;
1317 __entry
->nrpage
= nrpage
;
1320 TP_printk("dev = (%d,%d), ino = %lu, start = %lu nrpage = %u",
1321 show_dev_ino(__entry
),
1322 (unsigned long)__entry
->start
,
1326 TRACE_EVENT(f2fs_write_checkpoint
,
1328 TP_PROTO(struct super_block
*sb
, int reason
, char *msg
),
1330 TP_ARGS(sb
, reason
, msg
),
1334 __field(int, reason
)
1335 __field(char *, msg
)
1339 __entry
->dev
= sb
->s_dev
;
1340 __entry
->reason
= reason
;
1344 TP_printk("dev = (%d,%d), checkpoint for %s, state = %s",
1345 show_dev(__entry
->dev
),
1346 show_cpreason(__entry
->reason
),
1350 DECLARE_EVENT_CLASS(f2fs_discard
,
1352 TP_PROTO(struct block_device
*dev
, block_t blkstart
, block_t blklen
),
1354 TP_ARGS(dev
, blkstart
, blklen
),
1358 __field(block_t
, blkstart
)
1359 __field(block_t
, blklen
)
1363 __entry
->dev
= dev
->bd_dev
;
1364 __entry
->blkstart
= blkstart
;
1365 __entry
->blklen
= blklen
;
1368 TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx",
1369 show_dev(__entry
->dev
),
1370 (unsigned long long)__entry
->blkstart
,
1371 (unsigned long long)__entry
->blklen
)
1374 DEFINE_EVENT(f2fs_discard
, f2fs_queue_discard
,
1376 TP_PROTO(struct block_device
*dev
, block_t blkstart
, block_t blklen
),
1378 TP_ARGS(dev
, blkstart
, blklen
)
1381 DEFINE_EVENT(f2fs_discard
, f2fs_issue_discard
,
1383 TP_PROTO(struct block_device
*dev
, block_t blkstart
, block_t blklen
),
1385 TP_ARGS(dev
, blkstart
, blklen
)
1388 DEFINE_EVENT(f2fs_discard
, f2fs_remove_discard
,
1390 TP_PROTO(struct block_device
*dev
, block_t blkstart
, block_t blklen
),
1392 TP_ARGS(dev
, blkstart
, blklen
)
1395 TRACE_EVENT(f2fs_issue_reset_zone
,
1397 TP_PROTO(struct block_device
*dev
, block_t blkstart
),
1399 TP_ARGS(dev
, blkstart
),
1403 __field(block_t
, blkstart
)
1407 __entry
->dev
= dev
->bd_dev
;
1408 __entry
->blkstart
= blkstart
;
1411 TP_printk("dev = (%d,%d), reset zone at block = 0x%llx",
1412 show_dev(__entry
->dev
),
1413 (unsigned long long)__entry
->blkstart
)
1416 TRACE_EVENT(f2fs_issue_flush
,
1418 TP_PROTO(struct block_device
*dev
, unsigned int nobarrier
,
1419 unsigned int flush_merge
, int ret
),
1421 TP_ARGS(dev
, nobarrier
, flush_merge
, ret
),
1425 __field(unsigned int, nobarrier
)
1426 __field(unsigned int, flush_merge
)
1431 __entry
->dev
= dev
->bd_dev
;
1432 __entry
->nobarrier
= nobarrier
;
1433 __entry
->flush_merge
= flush_merge
;
1437 TP_printk("dev = (%d,%d), %s %s, ret = %d",
1438 show_dev(__entry
->dev
),
1439 __entry
->nobarrier
? "skip (nobarrier)" : "issue",
1440 __entry
->flush_merge
? " with flush_merge" : "",
1444 TRACE_EVENT(f2fs_lookup_extent_tree_start
,
1446 TP_PROTO(struct inode
*inode
, unsigned int pgofs
),
1448 TP_ARGS(inode
, pgofs
),
1453 __field(unsigned int, pgofs
)
1457 __entry
->dev
= inode
->i_sb
->s_dev
;
1458 __entry
->ino
= inode
->i_ino
;
1459 __entry
->pgofs
= pgofs
;
1462 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u",
1463 show_dev_ino(__entry
),
1467 TRACE_EVENT_CONDITION(f2fs_lookup_extent_tree_end
,
1469 TP_PROTO(struct inode
*inode
, unsigned int pgofs
,
1470 struct extent_info
*ei
),
1472 TP_ARGS(inode
, pgofs
, ei
),
1479 __field(unsigned int, pgofs
)
1480 __field(unsigned int, fofs
)
1482 __field(unsigned int, len
)
1486 __entry
->dev
= inode
->i_sb
->s_dev
;
1487 __entry
->ino
= inode
->i_ino
;
1488 __entry
->pgofs
= pgofs
;
1489 __entry
->fofs
= ei
->fofs
;
1490 __entry
->blk
= ei
->blk
;
1491 __entry
->len
= ei
->len
;
1494 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1495 "ext_info(fofs: %u, blk: %u, len: %u)",
1496 show_dev_ino(__entry
),
1503 TRACE_EVENT(f2fs_update_extent_tree_range
,
1505 TP_PROTO(struct inode
*inode
, unsigned int pgofs
, block_t blkaddr
,
1508 TP_ARGS(inode
, pgofs
, blkaddr
, len
),
1513 __field(unsigned int, pgofs
)
1515 __field(unsigned int, len
)
1519 __entry
->dev
= inode
->i_sb
->s_dev
;
1520 __entry
->ino
= inode
->i_ino
;
1521 __entry
->pgofs
= pgofs
;
1522 __entry
->blk
= blkaddr
;
1526 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1527 "blkaddr = %u, len = %u",
1528 show_dev_ino(__entry
),
1534 TRACE_EVENT(f2fs_shrink_extent_tree
,
1536 TP_PROTO(struct f2fs_sb_info
*sbi
, unsigned int node_cnt
,
1537 unsigned int tree_cnt
),
1539 TP_ARGS(sbi
, node_cnt
, tree_cnt
),
1543 __field(unsigned int, node_cnt
)
1544 __field(unsigned int, tree_cnt
)
1548 __entry
->dev
= sbi
->sb
->s_dev
;
1549 __entry
->node_cnt
= node_cnt
;
1550 __entry
->tree_cnt
= tree_cnt
;
1553 TP_printk("dev = (%d,%d), shrunk: node_cnt = %u, tree_cnt = %u",
1554 show_dev(__entry
->dev
),
1559 TRACE_EVENT(f2fs_destroy_extent_tree
,
1561 TP_PROTO(struct inode
*inode
, unsigned int node_cnt
),
1563 TP_ARGS(inode
, node_cnt
),
1568 __field(unsigned int, node_cnt
)
1572 __entry
->dev
= inode
->i_sb
->s_dev
;
1573 __entry
->ino
= inode
->i_ino
;
1574 __entry
->node_cnt
= node_cnt
;
1577 TP_printk("dev = (%d,%d), ino = %lu, destroyed: node_cnt = %u",
1578 show_dev_ino(__entry
),
1582 DECLARE_EVENT_CLASS(f2fs_sync_dirty_inodes
,
1584 TP_PROTO(struct super_block
*sb
, int type
, s64 count
),
1586 TP_ARGS(sb
, type
, count
),
1595 __entry
->dev
= sb
->s_dev
;
1596 __entry
->type
= type
;
1597 __entry
->count
= count
;
1600 TP_printk("dev = (%d,%d), %s, dirty count = %lld",
1601 show_dev(__entry
->dev
),
1602 show_file_type(__entry
->type
),
1606 DEFINE_EVENT(f2fs_sync_dirty_inodes
, f2fs_sync_dirty_inodes_enter
,
1608 TP_PROTO(struct super_block
*sb
, int type
, s64 count
),
1610 TP_ARGS(sb
, type
, count
)
1613 DEFINE_EVENT(f2fs_sync_dirty_inodes
, f2fs_sync_dirty_inodes_exit
,
1615 TP_PROTO(struct super_block
*sb
, int type
, s64 count
),
1617 TP_ARGS(sb
, type
, count
)
1620 #endif /* _TRACE_F2FS_H */
1622 /* This part must be outside protection */
1623 #include <trace/define_trace.h>