2 #define TRACE_SYSTEM f2fs
4 #if !defined(_TRACE_F2FS_H) || defined(TRACE_HEADER_MULTI_READ)
7 #include <linux/tracepoint.h>
9 #define show_dev(dev) MAJOR(dev), MINOR(dev)
10 #define show_dev_ino(entry) show_dev(entry->dev), (unsigned long)entry->ino
12 TRACE_DEFINE_ENUM(NODE
);
13 TRACE_DEFINE_ENUM(DATA
);
14 TRACE_DEFINE_ENUM(META
);
15 TRACE_DEFINE_ENUM(META_FLUSH
);
16 TRACE_DEFINE_ENUM(INMEM
);
17 TRACE_DEFINE_ENUM(INMEM_DROP
);
18 TRACE_DEFINE_ENUM(INMEM_INVALIDATE
);
19 TRACE_DEFINE_ENUM(INMEM_REVOKE
);
20 TRACE_DEFINE_ENUM(IPU
);
21 TRACE_DEFINE_ENUM(OPU
);
22 TRACE_DEFINE_ENUM(HOT
);
23 TRACE_DEFINE_ENUM(WARM
);
24 TRACE_DEFINE_ENUM(COLD
);
25 TRACE_DEFINE_ENUM(CURSEG_HOT_DATA
);
26 TRACE_DEFINE_ENUM(CURSEG_WARM_DATA
);
27 TRACE_DEFINE_ENUM(CURSEG_COLD_DATA
);
28 TRACE_DEFINE_ENUM(CURSEG_HOT_NODE
);
29 TRACE_DEFINE_ENUM(CURSEG_WARM_NODE
);
30 TRACE_DEFINE_ENUM(CURSEG_COLD_NODE
);
31 TRACE_DEFINE_ENUM(NO_CHECK_TYPE
);
32 TRACE_DEFINE_ENUM(GC_GREEDY
);
33 TRACE_DEFINE_ENUM(GC_CB
);
34 TRACE_DEFINE_ENUM(FG_GC
);
35 TRACE_DEFINE_ENUM(BG_GC
);
36 TRACE_DEFINE_ENUM(LFS
);
37 TRACE_DEFINE_ENUM(SSR
);
38 TRACE_DEFINE_ENUM(__REQ_RAHEAD
);
39 TRACE_DEFINE_ENUM(__REQ_SYNC
);
40 TRACE_DEFINE_ENUM(__REQ_IDLE
);
41 TRACE_DEFINE_ENUM(__REQ_PREFLUSH
);
42 TRACE_DEFINE_ENUM(__REQ_FUA
);
43 TRACE_DEFINE_ENUM(__REQ_PRIO
);
44 TRACE_DEFINE_ENUM(__REQ_META
);
45 TRACE_DEFINE_ENUM(CP_UMOUNT
);
46 TRACE_DEFINE_ENUM(CP_FASTBOOT
);
47 TRACE_DEFINE_ENUM(CP_SYNC
);
48 TRACE_DEFINE_ENUM(CP_RECOVERY
);
49 TRACE_DEFINE_ENUM(CP_DISCARD
);
50 TRACE_DEFINE_ENUM(CP_TRIMMED
);
52 #define show_block_type(type) \
53 __print_symbolic(type, \
57 { META_FLUSH, "META_FLUSH" }, \
59 { INMEM_DROP, "INMEM_DROP" }, \
60 { INMEM_INVALIDATE, "INMEM_INVALIDATE" }, \
61 { INMEM_REVOKE, "INMEM_REVOKE" }, \
62 { IPU, "IN-PLACE" }, \
63 { OPU, "OUT-OF-PLACE" })
65 #define show_block_temp(temp) \
66 __print_symbolic(temp, \
71 #define F2FS_OP_FLAGS (REQ_RAHEAD | REQ_SYNC | REQ_META | REQ_PRIO | \
72 REQ_PREFLUSH | REQ_FUA)
73 #define F2FS_BIO_FLAG_MASK(t) (t & F2FS_OP_FLAGS)
75 #define show_bio_type(op,op_flags) show_bio_op(op), \
76 show_bio_op_flags(op_flags)
78 #define show_bio_op(op) \
79 __print_symbolic(op, \
80 { REQ_OP_READ, "READ" }, \
81 { REQ_OP_WRITE, "WRITE" }, \
82 { REQ_OP_FLUSH, "FLUSH" }, \
83 { REQ_OP_DISCARD, "DISCARD" }, \
84 { REQ_OP_ZONE_REPORT, "ZONE_REPORT" }, \
85 { REQ_OP_SECURE_ERASE, "SECURE_ERASE" }, \
86 { REQ_OP_ZONE_RESET, "ZONE_RESET" }, \
87 { REQ_OP_WRITE_SAME, "WRITE_SAME" }, \
88 { REQ_OP_WRITE_ZEROES, "WRITE_ZEROES" })
90 #define show_bio_op_flags(flags) \
91 __print_flags(F2FS_BIO_FLAG_MASK(flags), "|", \
92 { REQ_RAHEAD, "R" }, \
96 { REQ_PREFLUSH, "PF" }, \
99 #define show_data_type(type) \
100 __print_symbolic(type, \
101 { CURSEG_HOT_DATA, "Hot DATA" }, \
102 { CURSEG_WARM_DATA, "Warm DATA" }, \
103 { CURSEG_COLD_DATA, "Cold DATA" }, \
104 { CURSEG_HOT_NODE, "Hot NODE" }, \
105 { CURSEG_WARM_NODE, "Warm NODE" }, \
106 { CURSEG_COLD_NODE, "Cold NODE" }, \
107 { NO_CHECK_TYPE, "No TYPE" })
109 #define show_file_type(type) \
110 __print_symbolic(type, \
114 #define show_gc_type(type) \
115 __print_symbolic(type, \
116 { FG_GC, "Foreground GC" }, \
117 { BG_GC, "Background GC" })
119 #define show_alloc_mode(type) \
120 __print_symbolic(type, \
121 { LFS, "LFS-mode" }, \
124 #define show_victim_policy(type) \
125 __print_symbolic(type, \
126 { GC_GREEDY, "Greedy" }, \
127 { GC_CB, "Cost-Benefit" })
129 #define show_cpreason(type) \
130 __print_flags(type, "|", \
131 { CP_UMOUNT, "Umount" }, \
132 { CP_FASTBOOT, "Fastboot" }, \
133 { CP_SYNC, "Sync" }, \
134 { CP_RECOVERY, "Recovery" }, \
135 { CP_DISCARD, "Discard" }, \
136 { CP_UMOUNT, "Umount" }, \
137 { CP_TRIMMED, "Trimmed" })
139 struct victim_sel_policy
;
140 struct f2fs_map_blocks
;
142 DECLARE_EVENT_CLASS(f2fs__inode
,
144 TP_PROTO(struct inode
*inode
),
152 __field(umode_t
, mode
)
153 __field(loff_t
, size
)
154 __field(unsigned int, nlink
)
155 __field(blkcnt_t
, blocks
)
156 __field(__u8
, advise
)
160 __entry
->dev
= inode
->i_sb
->s_dev
;
161 __entry
->ino
= inode
->i_ino
;
162 __entry
->pino
= F2FS_I(inode
)->i_pino
;
163 __entry
->mode
= inode
->i_mode
;
164 __entry
->nlink
= inode
->i_nlink
;
165 __entry
->size
= inode
->i_size
;
166 __entry
->blocks
= inode
->i_blocks
;
167 __entry
->advise
= F2FS_I(inode
)->i_advise
;
170 TP_printk("dev = (%d,%d), ino = %lu, pino = %lu, i_mode = 0x%hx, "
171 "i_size = %lld, i_nlink = %u, i_blocks = %llu, i_advise = 0x%x",
172 show_dev_ino(__entry
),
173 (unsigned long)__entry
->pino
,
176 (unsigned int)__entry
->nlink
,
177 (unsigned long long)__entry
->blocks
,
178 (unsigned char)__entry
->advise
)
181 DECLARE_EVENT_CLASS(f2fs__inode_exit
,
183 TP_PROTO(struct inode
*inode
, int ret
),
194 __entry
->dev
= inode
->i_sb
->s_dev
;
195 __entry
->ino
= inode
->i_ino
;
199 TP_printk("dev = (%d,%d), ino = %lu, ret = %d",
200 show_dev_ino(__entry
),
204 DEFINE_EVENT(f2fs__inode
, f2fs_sync_file_enter
,
206 TP_PROTO(struct inode
*inode
),
211 TRACE_EVENT(f2fs_sync_file_exit
,
213 TP_PROTO(struct inode
*inode
, int need_cp
, int datasync
, int ret
),
215 TP_ARGS(inode
, need_cp
, datasync
, ret
),
220 __field(int, need_cp
)
221 __field(int, datasync
)
226 __entry
->dev
= inode
->i_sb
->s_dev
;
227 __entry
->ino
= inode
->i_ino
;
228 __entry
->need_cp
= need_cp
;
229 __entry
->datasync
= datasync
;
233 TP_printk("dev = (%d,%d), ino = %lu, checkpoint is %s, "
234 "datasync = %d, ret = %d",
235 show_dev_ino(__entry
),
236 __entry
->need_cp
? "needed" : "not needed",
241 TRACE_EVENT(f2fs_sync_fs
,
243 TP_PROTO(struct super_block
*sb
, int wait
),
254 __entry
->dev
= sb
->s_dev
;
255 __entry
->dirty
= is_sbi_flag_set(F2FS_SB(sb
), SBI_IS_DIRTY
);
256 __entry
->wait
= wait
;
259 TP_printk("dev = (%d,%d), superblock is %s, wait = %d",
260 show_dev(__entry
->dev
),
261 __entry
->dirty
? "dirty" : "not dirty",
265 DEFINE_EVENT(f2fs__inode
, f2fs_iget
,
267 TP_PROTO(struct inode
*inode
),
272 DEFINE_EVENT(f2fs__inode_exit
, f2fs_iget_exit
,
274 TP_PROTO(struct inode
*inode
, int ret
),
279 DEFINE_EVENT(f2fs__inode
, f2fs_evict_inode
,
281 TP_PROTO(struct inode
*inode
),
286 DEFINE_EVENT(f2fs__inode_exit
, f2fs_new_inode
,
288 TP_PROTO(struct inode
*inode
, int ret
),
293 TRACE_EVENT(f2fs_unlink_enter
,
295 TP_PROTO(struct inode
*dir
, struct dentry
*dentry
),
297 TP_ARGS(dir
, dentry
),
302 __field(loff_t
, size
)
303 __field(blkcnt_t
, blocks
)
304 __field(const char *, name
)
308 __entry
->dev
= dir
->i_sb
->s_dev
;
309 __entry
->ino
= dir
->i_ino
;
310 __entry
->size
= dir
->i_size
;
311 __entry
->blocks
= dir
->i_blocks
;
312 __entry
->name
= dentry
->d_name
.name
;
315 TP_printk("dev = (%d,%d), dir ino = %lu, i_size = %lld, "
316 "i_blocks = %llu, name = %s",
317 show_dev_ino(__entry
),
319 (unsigned long long)__entry
->blocks
,
323 DEFINE_EVENT(f2fs__inode_exit
, f2fs_unlink_exit
,
325 TP_PROTO(struct inode
*inode
, int ret
),
330 DEFINE_EVENT(f2fs__inode_exit
, f2fs_drop_inode
,
332 TP_PROTO(struct inode
*inode
, int ret
),
337 DEFINE_EVENT(f2fs__inode
, f2fs_truncate
,
339 TP_PROTO(struct inode
*inode
),
344 TRACE_EVENT(f2fs_truncate_data_blocks_range
,
346 TP_PROTO(struct inode
*inode
, nid_t nid
, unsigned int ofs
, int free
),
348 TP_ARGS(inode
, nid
, ofs
, free
),
354 __field(unsigned int, ofs
)
359 __entry
->dev
= inode
->i_sb
->s_dev
;
360 __entry
->ino
= inode
->i_ino
;
363 __entry
->free
= free
;
366 TP_printk("dev = (%d,%d), ino = %lu, nid = %u, offset = %u, freed = %d",
367 show_dev_ino(__entry
),
368 (unsigned int)__entry
->nid
,
373 DECLARE_EVENT_CLASS(f2fs__truncate_op
,
375 TP_PROTO(struct inode
*inode
, u64 from
),
377 TP_ARGS(inode
, from
),
382 __field(loff_t
, size
)
383 __field(blkcnt_t
, blocks
)
388 __entry
->dev
= inode
->i_sb
->s_dev
;
389 __entry
->ino
= inode
->i_ino
;
390 __entry
->size
= inode
->i_size
;
391 __entry
->blocks
= inode
->i_blocks
;
392 __entry
->from
= from
;
395 TP_printk("dev = (%d,%d), ino = %lu, i_size = %lld, i_blocks = %llu, "
396 "start file offset = %llu",
397 show_dev_ino(__entry
),
399 (unsigned long long)__entry
->blocks
,
400 (unsigned long long)__entry
->from
)
403 DEFINE_EVENT(f2fs__truncate_op
, f2fs_truncate_blocks_enter
,
405 TP_PROTO(struct inode
*inode
, u64 from
),
410 DEFINE_EVENT(f2fs__inode_exit
, f2fs_truncate_blocks_exit
,
412 TP_PROTO(struct inode
*inode
, int ret
),
417 DEFINE_EVENT(f2fs__truncate_op
, f2fs_truncate_inode_blocks_enter
,
419 TP_PROTO(struct inode
*inode
, u64 from
),
424 DEFINE_EVENT(f2fs__inode_exit
, f2fs_truncate_inode_blocks_exit
,
426 TP_PROTO(struct inode
*inode
, int ret
),
431 DECLARE_EVENT_CLASS(f2fs__truncate_node
,
433 TP_PROTO(struct inode
*inode
, nid_t nid
, block_t blk_addr
),
435 TP_ARGS(inode
, nid
, blk_addr
),
441 __field(block_t
, blk_addr
)
445 __entry
->dev
= inode
->i_sb
->s_dev
;
446 __entry
->ino
= inode
->i_ino
;
448 __entry
->blk_addr
= blk_addr
;
451 TP_printk("dev = (%d,%d), ino = %lu, nid = %u, block_address = 0x%llx",
452 show_dev_ino(__entry
),
453 (unsigned int)__entry
->nid
,
454 (unsigned long long)__entry
->blk_addr
)
457 DEFINE_EVENT(f2fs__truncate_node
, f2fs_truncate_nodes_enter
,
459 TP_PROTO(struct inode
*inode
, nid_t nid
, block_t blk_addr
),
461 TP_ARGS(inode
, nid
, blk_addr
)
464 DEFINE_EVENT(f2fs__inode_exit
, f2fs_truncate_nodes_exit
,
466 TP_PROTO(struct inode
*inode
, int ret
),
471 DEFINE_EVENT(f2fs__truncate_node
, f2fs_truncate_node
,
473 TP_PROTO(struct inode
*inode
, nid_t nid
, block_t blk_addr
),
475 TP_ARGS(inode
, nid
, blk_addr
)
478 TRACE_EVENT(f2fs_truncate_partial_nodes
,
480 TP_PROTO(struct inode
*inode
, nid_t nid
[], int depth
, int err
),
482 TP_ARGS(inode
, nid
, depth
, err
),
487 __field(nid_t
, nid
[3])
493 __entry
->dev
= inode
->i_sb
->s_dev
;
494 __entry
->ino
= inode
->i_ino
;
495 __entry
->nid
[0] = nid
[0];
496 __entry
->nid
[1] = nid
[1];
497 __entry
->nid
[2] = nid
[2];
498 __entry
->depth
= depth
;
502 TP_printk("dev = (%d,%d), ino = %lu, "
503 "nid[0] = %u, nid[1] = %u, nid[2] = %u, depth = %d, err = %d",
504 show_dev_ino(__entry
),
505 (unsigned int)__entry
->nid
[0],
506 (unsigned int)__entry
->nid
[1],
507 (unsigned int)__entry
->nid
[2],
512 TRACE_EVENT(f2fs_map_blocks
,
513 TP_PROTO(struct inode
*inode
, struct f2fs_map_blocks
*map
, int ret
),
515 TP_ARGS(inode
, map
, ret
),
520 __field(block_t
, m_lblk
)
521 __field(block_t
, m_pblk
)
522 __field(unsigned int, m_len
)
527 __entry
->dev
= inode
->i_sb
->s_dev
;
528 __entry
->ino
= inode
->i_ino
;
529 __entry
->m_lblk
= map
->m_lblk
;
530 __entry
->m_pblk
= map
->m_pblk
;
531 __entry
->m_len
= map
->m_len
;
535 TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, "
536 "start blkaddr = 0x%llx, len = 0x%llx, err = %d",
537 show_dev_ino(__entry
),
538 (unsigned long long)__entry
->m_lblk
,
539 (unsigned long long)__entry
->m_pblk
,
540 (unsigned long long)__entry
->m_len
,
544 TRACE_EVENT(f2fs_background_gc
,
546 TP_PROTO(struct super_block
*sb
, long wait_ms
,
547 unsigned int prefree
, unsigned int free
),
549 TP_ARGS(sb
, wait_ms
, prefree
, free
),
553 __field(long, wait_ms
)
554 __field(unsigned int, prefree
)
555 __field(unsigned int, free
)
559 __entry
->dev
= sb
->s_dev
;
560 __entry
->wait_ms
= wait_ms
;
561 __entry
->prefree
= prefree
;
562 __entry
->free
= free
;
565 TP_printk("dev = (%d,%d), wait_ms = %ld, prefree = %u, free = %u",
566 show_dev(__entry
->dev
),
572 TRACE_EVENT(f2fs_get_victim
,
574 TP_PROTO(struct super_block
*sb
, int type
, int gc_type
,
575 struct victim_sel_policy
*p
, unsigned int pre_victim
,
576 unsigned int prefree
, unsigned int free
),
578 TP_ARGS(sb
, type
, gc_type
, p
, pre_victim
, prefree
, free
),
583 __field(int, gc_type
)
584 __field(int, alloc_mode
)
585 __field(int, gc_mode
)
586 __field(unsigned int, victim
)
587 __field(unsigned int, cost
)
588 __field(unsigned int, ofs_unit
)
589 __field(unsigned int, pre_victim
)
590 __field(unsigned int, prefree
)
591 __field(unsigned int, free
)
595 __entry
->dev
= sb
->s_dev
;
596 __entry
->type
= type
;
597 __entry
->gc_type
= gc_type
;
598 __entry
->alloc_mode
= p
->alloc_mode
;
599 __entry
->gc_mode
= p
->gc_mode
;
600 __entry
->victim
= p
->min_segno
;
601 __entry
->cost
= p
->min_cost
;
602 __entry
->ofs_unit
= p
->ofs_unit
;
603 __entry
->pre_victim
= pre_victim
;
604 __entry
->prefree
= prefree
;
605 __entry
->free
= free
;
608 TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), "
609 "victim = %u, cost = %u, ofs_unit = %u, "
610 "pre_victim_secno = %d, prefree = %u, free = %u",
611 show_dev(__entry
->dev
),
612 show_data_type(__entry
->type
),
613 show_gc_type(__entry
->gc_type
),
614 show_alloc_mode(__entry
->alloc_mode
),
615 show_victim_policy(__entry
->gc_mode
),
619 (int)__entry
->pre_victim
,
624 TRACE_EVENT(f2fs_fallocate
,
626 TP_PROTO(struct inode
*inode
, int mode
,
627 loff_t offset
, loff_t len
, int ret
),
629 TP_ARGS(inode
, mode
, offset
, len
, ret
),
635 __field(loff_t
, offset
)
637 __field(loff_t
, size
)
638 __field(blkcnt_t
, blocks
)
643 __entry
->dev
= inode
->i_sb
->s_dev
;
644 __entry
->ino
= inode
->i_ino
;
645 __entry
->mode
= mode
;
646 __entry
->offset
= offset
;
648 __entry
->size
= inode
->i_size
;
649 __entry
->blocks
= inode
->i_blocks
;
653 TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, "
654 "len = %lld, i_size = %lld, i_blocks = %llu, ret = %d",
655 show_dev_ino(__entry
),
657 (unsigned long long)__entry
->offset
,
658 (unsigned long long)__entry
->len
,
659 (unsigned long long)__entry
->size
,
660 (unsigned long long)__entry
->blocks
,
664 TRACE_EVENT(f2fs_direct_IO_enter
,
666 TP_PROTO(struct inode
*inode
, loff_t offset
, unsigned long len
, int rw
),
668 TP_ARGS(inode
, offset
, len
, rw
),
674 __field(unsigned long, len
)
679 __entry
->dev
= inode
->i_sb
->s_dev
;
680 __entry
->ino
= inode
->i_ino
;
681 __entry
->pos
= offset
;
686 TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu rw = %d",
687 show_dev_ino(__entry
),
693 TRACE_EVENT(f2fs_direct_IO_exit
,
695 TP_PROTO(struct inode
*inode
, loff_t offset
, unsigned long len
,
698 TP_ARGS(inode
, offset
, len
, rw
, ret
),
704 __field(unsigned long, len
)
710 __entry
->dev
= inode
->i_sb
->s_dev
;
711 __entry
->ino
= inode
->i_ino
;
712 __entry
->pos
= offset
;
718 TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu "
720 show_dev_ino(__entry
),
727 TRACE_EVENT(f2fs_reserve_new_blocks
,
729 TP_PROTO(struct inode
*inode
, nid_t nid
, unsigned int ofs_in_node
,
732 TP_ARGS(inode
, nid
, ofs_in_node
, count
),
737 __field(unsigned int, ofs_in_node
)
738 __field(blkcnt_t
, count
)
742 __entry
->dev
= inode
->i_sb
->s_dev
;
744 __entry
->ofs_in_node
= ofs_in_node
;
745 __entry
->count
= count
;
748 TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u, count = %llu",
749 show_dev(__entry
->dev
),
750 (unsigned int)__entry
->nid
,
751 __entry
->ofs_in_node
,
752 (unsigned long long)__entry
->count
)
755 DECLARE_EVENT_CLASS(f2fs__submit_page_bio
,
757 TP_PROTO(struct page
*page
, struct f2fs_io_info
*fio
),
764 __field(pgoff_t
, index
)
765 __field(block_t
, old_blkaddr
)
766 __field(block_t
, new_blkaddr
)
768 __field(int, op_flags
)
774 __entry
->dev
= page
->mapping
->host
->i_sb
->s_dev
;
775 __entry
->ino
= page
->mapping
->host
->i_ino
;
776 __entry
->index
= page
->index
;
777 __entry
->old_blkaddr
= fio
->old_blkaddr
;
778 __entry
->new_blkaddr
= fio
->new_blkaddr
;
779 __entry
->op
= fio
->op
;
780 __entry
->op_flags
= fio
->op_flags
;
781 __entry
->temp
= fio
->temp
;
782 __entry
->type
= fio
->type
;
785 TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, "
786 "oldaddr = 0x%llx, newaddr = 0x%llx, rw = %s(%s), type = %s_%s",
787 show_dev_ino(__entry
),
788 (unsigned long)__entry
->index
,
789 (unsigned long long)__entry
->old_blkaddr
,
790 (unsigned long long)__entry
->new_blkaddr
,
791 show_bio_type(__entry
->op
, __entry
->op_flags
),
792 show_block_temp(__entry
->temp
),
793 show_block_type(__entry
->type
))
796 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio
, f2fs_submit_page_bio
,
798 TP_PROTO(struct page
*page
, struct f2fs_io_info
*fio
),
802 TP_CONDITION(page
->mapping
)
805 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio
, f2fs_submit_page_write
,
807 TP_PROTO(struct page
*page
, struct f2fs_io_info
*fio
),
811 TP_CONDITION(page
->mapping
)
814 DECLARE_EVENT_CLASS(f2fs__bio
,
816 TP_PROTO(struct super_block
*sb
, int type
, struct bio
*bio
),
818 TP_ARGS(sb
, type
, bio
),
822 __field(dev_t
, target
)
824 __field(int, op_flags
)
826 __field(sector_t
, sector
)
827 __field(unsigned int, size
)
831 __entry
->dev
= sb
->s_dev
;
832 __entry
->target
= bio
->bi_bdev
->bd_dev
;
833 __entry
->op
= bio_op(bio
);
834 __entry
->op_flags
= bio
->bi_opf
;
835 __entry
->type
= type
;
836 __entry
->sector
= bio
->bi_iter
.bi_sector
;
837 __entry
->size
= bio
->bi_iter
.bi_size
;
840 TP_printk("dev = (%d,%d)/(%d,%d), rw = %s(%s), %s, sector = %lld, size = %u",
841 show_dev(__entry
->target
),
842 show_dev(__entry
->dev
),
843 show_bio_type(__entry
->op
, __entry
->op_flags
),
844 show_block_type(__entry
->type
),
845 (unsigned long long)__entry
->sector
,
849 DEFINE_EVENT_CONDITION(f2fs__bio
, f2fs_prepare_write_bio
,
851 TP_PROTO(struct super_block
*sb
, int type
, struct bio
*bio
),
853 TP_ARGS(sb
, type
, bio
),
858 DEFINE_EVENT_CONDITION(f2fs__bio
, f2fs_prepare_read_bio
,
860 TP_PROTO(struct super_block
*sb
, int type
, struct bio
*bio
),
862 TP_ARGS(sb
, type
, bio
),
867 DEFINE_EVENT_CONDITION(f2fs__bio
, f2fs_submit_read_bio
,
869 TP_PROTO(struct super_block
*sb
, int type
, struct bio
*bio
),
871 TP_ARGS(sb
, type
, bio
),
876 DEFINE_EVENT_CONDITION(f2fs__bio
, f2fs_submit_write_bio
,
878 TP_PROTO(struct super_block
*sb
, int type
, struct bio
*bio
),
880 TP_ARGS(sb
, type
, bio
),
885 TRACE_EVENT(f2fs_write_begin
,
887 TP_PROTO(struct inode
*inode
, loff_t pos
, unsigned int len
,
890 TP_ARGS(inode
, pos
, len
, flags
),
896 __field(unsigned int, len
)
897 __field(unsigned int, flags
)
901 __entry
->dev
= inode
->i_sb
->s_dev
;
902 __entry
->ino
= inode
->i_ino
;
905 __entry
->flags
= flags
;
908 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u",
909 show_dev_ino(__entry
),
910 (unsigned long long)__entry
->pos
,
915 TRACE_EVENT(f2fs_write_end
,
917 TP_PROTO(struct inode
*inode
, loff_t pos
, unsigned int len
,
918 unsigned int copied
),
920 TP_ARGS(inode
, pos
, len
, copied
),
926 __field(unsigned int, len
)
927 __field(unsigned int, copied
)
931 __entry
->dev
= inode
->i_sb
->s_dev
;
932 __entry
->ino
= inode
->i_ino
;
935 __entry
->copied
= copied
;
938 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u",
939 show_dev_ino(__entry
),
940 (unsigned long long)__entry
->pos
,
945 DECLARE_EVENT_CLASS(f2fs__page
,
947 TP_PROTO(struct page
*page
, int type
),
956 __field(pgoff_t
, index
)
958 __field(int, uptodate
)
962 __entry
->dev
= page
->mapping
->host
->i_sb
->s_dev
;
963 __entry
->ino
= page
->mapping
->host
->i_ino
;
964 __entry
->type
= type
;
965 __entry
->dir
= S_ISDIR(page
->mapping
->host
->i_mode
);
966 __entry
->index
= page
->index
;
967 __entry
->dirty
= PageDirty(page
);
968 __entry
->uptodate
= PageUptodate(page
);
971 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, "
972 "dirty = %d, uptodate = %d",
973 show_dev_ino(__entry
),
974 show_block_type(__entry
->type
),
975 show_file_type(__entry
->dir
),
976 (unsigned long)__entry
->index
,
981 DEFINE_EVENT(f2fs__page
, f2fs_writepage
,
983 TP_PROTO(struct page
*page
, int type
),
988 DEFINE_EVENT(f2fs__page
, f2fs_do_write_data_page
,
990 TP_PROTO(struct page
*page
, int type
),
995 DEFINE_EVENT(f2fs__page
, f2fs_readpage
,
997 TP_PROTO(struct page
*page
, int type
),
1002 DEFINE_EVENT(f2fs__page
, f2fs_set_page_dirty
,
1004 TP_PROTO(struct page
*page
, int type
),
1009 DEFINE_EVENT(f2fs__page
, f2fs_vm_page_mkwrite
,
1011 TP_PROTO(struct page
*page
, int type
),
1016 DEFINE_EVENT(f2fs__page
, f2fs_register_inmem_page
,
1018 TP_PROTO(struct page
*page
, int type
),
1023 DEFINE_EVENT(f2fs__page
, f2fs_commit_inmem_page
,
1025 TP_PROTO(struct page
*page
, int type
),
1030 TRACE_EVENT(f2fs_writepages
,
1032 TP_PROTO(struct inode
*inode
, struct writeback_control
*wbc
, int type
),
1034 TP_ARGS(inode
, wbc
, type
),
1041 __field(long, nr_to_write
)
1042 __field(long, pages_skipped
)
1043 __field(loff_t
, range_start
)
1044 __field(loff_t
, range_end
)
1045 __field(pgoff_t
, writeback_index
)
1046 __field(int, sync_mode
)
1047 __field(char, for_kupdate
)
1048 __field(char, for_background
)
1049 __field(char, tagged_writepages
)
1050 __field(char, for_reclaim
)
1051 __field(char, range_cyclic
)
1052 __field(char, for_sync
)
1056 __entry
->dev
= inode
->i_sb
->s_dev
;
1057 __entry
->ino
= inode
->i_ino
;
1058 __entry
->type
= type
;
1059 __entry
->dir
= S_ISDIR(inode
->i_mode
);
1060 __entry
->nr_to_write
= wbc
->nr_to_write
;
1061 __entry
->pages_skipped
= wbc
->pages_skipped
;
1062 __entry
->range_start
= wbc
->range_start
;
1063 __entry
->range_end
= wbc
->range_end
;
1064 __entry
->writeback_index
= inode
->i_mapping
->writeback_index
;
1065 __entry
->sync_mode
= wbc
->sync_mode
;
1066 __entry
->for_kupdate
= wbc
->for_kupdate
;
1067 __entry
->for_background
= wbc
->for_background
;
1068 __entry
->tagged_writepages
= wbc
->tagged_writepages
;
1069 __entry
->for_reclaim
= wbc
->for_reclaim
;
1070 __entry
->range_cyclic
= wbc
->range_cyclic
;
1071 __entry
->for_sync
= wbc
->for_sync
;
1074 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
1075 "skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
1076 "kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
1077 show_dev_ino(__entry
),
1078 show_block_type(__entry
->type
),
1079 show_file_type(__entry
->dir
),
1080 __entry
->nr_to_write
,
1081 __entry
->pages_skipped
,
1082 __entry
->range_start
,
1084 (unsigned long)__entry
->writeback_index
,
1086 __entry
->for_kupdate
,
1087 __entry
->for_background
,
1088 __entry
->tagged_writepages
,
1089 __entry
->for_reclaim
,
1090 __entry
->range_cyclic
,
1094 TRACE_EVENT(f2fs_readpages
,
1096 TP_PROTO(struct inode
*inode
, struct page
*page
, unsigned int nrpage
),
1098 TP_ARGS(inode
, page
, nrpage
),
1103 __field(pgoff_t
, start
)
1104 __field(unsigned int, nrpage
)
1108 __entry
->dev
= inode
->i_sb
->s_dev
;
1109 __entry
->ino
= inode
->i_ino
;
1110 __entry
->start
= page
->index
;
1111 __entry
->nrpage
= nrpage
;
1114 TP_printk("dev = (%d,%d), ino = %lu, start = %lu nrpage = %u",
1115 show_dev_ino(__entry
),
1116 (unsigned long)__entry
->start
,
1120 TRACE_EVENT(f2fs_write_checkpoint
,
1122 TP_PROTO(struct super_block
*sb
, int reason
, char *msg
),
1124 TP_ARGS(sb
, reason
, msg
),
1128 __field(int, reason
)
1129 __field(char *, msg
)
1133 __entry
->dev
= sb
->s_dev
;
1134 __entry
->reason
= reason
;
1138 TP_printk("dev = (%d,%d), checkpoint for %s, state = %s",
1139 show_dev(__entry
->dev
),
1140 show_cpreason(__entry
->reason
),
1144 DECLARE_EVENT_CLASS(f2fs_discard
,
1146 TP_PROTO(struct block_device
*dev
, block_t blkstart
, block_t blklen
),
1148 TP_ARGS(dev
, blkstart
, blklen
),
1152 __field(block_t
, blkstart
)
1153 __field(block_t
, blklen
)
1157 __entry
->dev
= dev
->bd_dev
;
1158 __entry
->blkstart
= blkstart
;
1159 __entry
->blklen
= blklen
;
1162 TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx",
1163 show_dev(__entry
->dev
),
1164 (unsigned long long)__entry
->blkstart
,
1165 (unsigned long long)__entry
->blklen
)
1168 DEFINE_EVENT(f2fs_discard
, f2fs_queue_discard
,
1170 TP_PROTO(struct block_device
*dev
, block_t blkstart
, block_t blklen
),
1172 TP_ARGS(dev
, blkstart
, blklen
)
1175 DEFINE_EVENT(f2fs_discard
, f2fs_issue_discard
,
1177 TP_PROTO(struct block_device
*dev
, block_t blkstart
, block_t blklen
),
1179 TP_ARGS(dev
, blkstart
, blklen
)
1182 TRACE_EVENT(f2fs_issue_reset_zone
,
1184 TP_PROTO(struct block_device
*dev
, block_t blkstart
),
1186 TP_ARGS(dev
, blkstart
),
1190 __field(block_t
, blkstart
)
1194 __entry
->dev
= dev
->bd_dev
;
1195 __entry
->blkstart
= blkstart
;
1198 TP_printk("dev = (%d,%d), reset zone at block = 0x%llx",
1199 show_dev(__entry
->dev
),
1200 (unsigned long long)__entry
->blkstart
)
1203 TRACE_EVENT(f2fs_issue_flush
,
1205 TP_PROTO(struct block_device
*dev
, unsigned int nobarrier
,
1206 unsigned int flush_merge
, int ret
),
1208 TP_ARGS(dev
, nobarrier
, flush_merge
, ret
),
1212 __field(unsigned int, nobarrier
)
1213 __field(unsigned int, flush_merge
)
1218 __entry
->dev
= dev
->bd_dev
;
1219 __entry
->nobarrier
= nobarrier
;
1220 __entry
->flush_merge
= flush_merge
;
1224 TP_printk("dev = (%d,%d), %s %s, ret = %d",
1225 show_dev(__entry
->dev
),
1226 __entry
->nobarrier
? "skip (nobarrier)" : "issue",
1227 __entry
->flush_merge
? " with flush_merge" : "",
1231 TRACE_EVENT(f2fs_lookup_extent_tree_start
,
1233 TP_PROTO(struct inode
*inode
, unsigned int pgofs
),
1235 TP_ARGS(inode
, pgofs
),
1240 __field(unsigned int, pgofs
)
1244 __entry
->dev
= inode
->i_sb
->s_dev
;
1245 __entry
->ino
= inode
->i_ino
;
1246 __entry
->pgofs
= pgofs
;
1249 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u",
1250 show_dev_ino(__entry
),
1254 TRACE_EVENT_CONDITION(f2fs_lookup_extent_tree_end
,
1256 TP_PROTO(struct inode
*inode
, unsigned int pgofs
,
1257 struct extent_info
*ei
),
1259 TP_ARGS(inode
, pgofs
, ei
),
1266 __field(unsigned int, pgofs
)
1267 __field(unsigned int, fofs
)
1269 __field(unsigned int, len
)
1273 __entry
->dev
= inode
->i_sb
->s_dev
;
1274 __entry
->ino
= inode
->i_ino
;
1275 __entry
->pgofs
= pgofs
;
1276 __entry
->fofs
= ei
->fofs
;
1277 __entry
->blk
= ei
->blk
;
1278 __entry
->len
= ei
->len
;
1281 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1282 "ext_info(fofs: %u, blk: %u, len: %u)",
1283 show_dev_ino(__entry
),
1290 TRACE_EVENT(f2fs_update_extent_tree_range
,
1292 TP_PROTO(struct inode
*inode
, unsigned int pgofs
, block_t blkaddr
,
1295 TP_ARGS(inode
, pgofs
, blkaddr
, len
),
1300 __field(unsigned int, pgofs
)
1302 __field(unsigned int, len
)
1306 __entry
->dev
= inode
->i_sb
->s_dev
;
1307 __entry
->ino
= inode
->i_ino
;
1308 __entry
->pgofs
= pgofs
;
1309 __entry
->blk
= blkaddr
;
1313 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1314 "blkaddr = %u, len = %u",
1315 show_dev_ino(__entry
),
1321 TRACE_EVENT(f2fs_shrink_extent_tree
,
1323 TP_PROTO(struct f2fs_sb_info
*sbi
, unsigned int node_cnt
,
1324 unsigned int tree_cnt
),
1326 TP_ARGS(sbi
, node_cnt
, tree_cnt
),
1330 __field(unsigned int, node_cnt
)
1331 __field(unsigned int, tree_cnt
)
1335 __entry
->dev
= sbi
->sb
->s_dev
;
1336 __entry
->node_cnt
= node_cnt
;
1337 __entry
->tree_cnt
= tree_cnt
;
1340 TP_printk("dev = (%d,%d), shrunk: node_cnt = %u, tree_cnt = %u",
1341 show_dev(__entry
->dev
),
1346 TRACE_EVENT(f2fs_destroy_extent_tree
,
1348 TP_PROTO(struct inode
*inode
, unsigned int node_cnt
),
1350 TP_ARGS(inode
, node_cnt
),
1355 __field(unsigned int, node_cnt
)
1359 __entry
->dev
= inode
->i_sb
->s_dev
;
1360 __entry
->ino
= inode
->i_ino
;
1361 __entry
->node_cnt
= node_cnt
;
1364 TP_printk("dev = (%d,%d), ino = %lu, destroyed: node_cnt = %u",
1365 show_dev_ino(__entry
),
1369 DECLARE_EVENT_CLASS(f2fs_sync_dirty_inodes
,
1371 TP_PROTO(struct super_block
*sb
, int type
, s64 count
),
1373 TP_ARGS(sb
, type
, count
),
1382 __entry
->dev
= sb
->s_dev
;
1383 __entry
->type
= type
;
1384 __entry
->count
= count
;
1387 TP_printk("dev = (%d,%d), %s, dirty count = %lld",
1388 show_dev(__entry
->dev
),
1389 show_file_type(__entry
->type
),
1393 DEFINE_EVENT(f2fs_sync_dirty_inodes
, f2fs_sync_dirty_inodes_enter
,
1395 TP_PROTO(struct super_block
*sb
, int type
, s64 count
),
1397 TP_ARGS(sb
, type
, count
)
1400 DEFINE_EVENT(f2fs_sync_dirty_inodes
, f2fs_sync_dirty_inodes_exit
,
1402 TP_PROTO(struct super_block
*sb
, int type
, s64 count
),
1404 TP_ARGS(sb
, type
, count
)
1407 #endif /* _TRACE_F2FS_H */
1409 /* This part must be outside protection */
1410 #include <trace/define_trace.h>