cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

f2fs.h (52450B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2#undef TRACE_SYSTEM
      3#define TRACE_SYSTEM f2fs
      4
      5#if !defined(_TRACE_F2FS_H) || defined(TRACE_HEADER_MULTI_READ)
      6#define _TRACE_F2FS_H
      7
      8#include <linux/tracepoint.h>
      9#include <uapi/linux/f2fs.h>
     10
     11#define show_dev(dev)		MAJOR(dev), MINOR(dev)
     12#define show_dev_ino(entry)	show_dev(entry->dev), (unsigned long)entry->ino
     13
     14TRACE_DEFINE_ENUM(NODE);
     15TRACE_DEFINE_ENUM(DATA);
     16TRACE_DEFINE_ENUM(META);
     17TRACE_DEFINE_ENUM(META_FLUSH);
     18TRACE_DEFINE_ENUM(IPU);
     19TRACE_DEFINE_ENUM(OPU);
     20TRACE_DEFINE_ENUM(HOT);
     21TRACE_DEFINE_ENUM(WARM);
     22TRACE_DEFINE_ENUM(COLD);
     23TRACE_DEFINE_ENUM(CURSEG_HOT_DATA);
     24TRACE_DEFINE_ENUM(CURSEG_WARM_DATA);
     25TRACE_DEFINE_ENUM(CURSEG_COLD_DATA);
     26TRACE_DEFINE_ENUM(CURSEG_HOT_NODE);
     27TRACE_DEFINE_ENUM(CURSEG_WARM_NODE);
     28TRACE_DEFINE_ENUM(CURSEG_COLD_NODE);
     29TRACE_DEFINE_ENUM(NO_CHECK_TYPE);
     30TRACE_DEFINE_ENUM(GC_GREEDY);
     31TRACE_DEFINE_ENUM(GC_CB);
     32TRACE_DEFINE_ENUM(FG_GC);
     33TRACE_DEFINE_ENUM(BG_GC);
     34TRACE_DEFINE_ENUM(LFS);
     35TRACE_DEFINE_ENUM(SSR);
     36TRACE_DEFINE_ENUM(__REQ_RAHEAD);
     37TRACE_DEFINE_ENUM(__REQ_SYNC);
     38TRACE_DEFINE_ENUM(__REQ_IDLE);
     39TRACE_DEFINE_ENUM(__REQ_PREFLUSH);
     40TRACE_DEFINE_ENUM(__REQ_FUA);
     41TRACE_DEFINE_ENUM(__REQ_PRIO);
     42TRACE_DEFINE_ENUM(__REQ_META);
     43TRACE_DEFINE_ENUM(CP_UMOUNT);
     44TRACE_DEFINE_ENUM(CP_FASTBOOT);
     45TRACE_DEFINE_ENUM(CP_SYNC);
     46TRACE_DEFINE_ENUM(CP_RECOVERY);
     47TRACE_DEFINE_ENUM(CP_DISCARD);
     48TRACE_DEFINE_ENUM(CP_TRIMMED);
     49TRACE_DEFINE_ENUM(CP_PAUSE);
     50TRACE_DEFINE_ENUM(CP_RESIZE);
     51
     52#define show_block_type(type)						\
     53	__print_symbolic(type,						\
     54		{ NODE,		"NODE" },				\
     55		{ DATA,		"DATA" },				\
     56		{ META,		"META" },				\
     57		{ META_FLUSH,	"META_FLUSH" },				\
     58		{ IPU,		"IN-PLACE" },				\
     59		{ OPU,		"OUT-OF-PLACE" })
     60
     61#define show_block_temp(temp)						\
     62	__print_symbolic(temp,						\
     63		{ HOT,		"HOT" },				\
     64		{ WARM,		"WARM" },				\
     65		{ COLD,		"COLD" })
     66
     67#define F2FS_OP_FLAGS (REQ_RAHEAD | REQ_SYNC | REQ_META | REQ_PRIO |	\
     68			REQ_PREFLUSH | REQ_FUA)
     69#define F2FS_BIO_FLAG_MASK(t)	(t & F2FS_OP_FLAGS)
     70
     71#define show_bio_type(op,op_flags)	show_bio_op(op),		\
     72						show_bio_op_flags(op_flags)
     73
     74#define show_bio_op(op)		blk_op_str(op)
     75
     76#define show_bio_op_flags(flags)					\
     77	__print_flags(F2FS_BIO_FLAG_MASK(flags), "|",			\
     78		{ REQ_RAHEAD,		"R" },				\
     79		{ REQ_SYNC,		"S" },				\
     80		{ REQ_META,		"M" },				\
     81		{ REQ_PRIO,		"P" },				\
     82		{ REQ_PREFLUSH,		"PF" },				\
     83		{ REQ_FUA,		"FUA" })
     84
     85#define show_data_type(type)						\
     86	__print_symbolic(type,						\
     87		{ CURSEG_HOT_DATA, 	"Hot DATA" },			\
     88		{ CURSEG_WARM_DATA, 	"Warm DATA" },			\
     89		{ CURSEG_COLD_DATA, 	"Cold DATA" },			\
     90		{ CURSEG_HOT_NODE, 	"Hot NODE" },			\
     91		{ CURSEG_WARM_NODE, 	"Warm NODE" },			\
     92		{ CURSEG_COLD_NODE, 	"Cold NODE" },			\
     93		{ NO_CHECK_TYPE, 	"No TYPE" })
     94
     95#define show_file_type(type)						\
     96	__print_symbolic(type,						\
     97		{ 0,		"FILE" },				\
     98		{ 1,		"DIR" })
     99
    100#define show_gc_type(type)						\
    101	__print_symbolic(type,						\
    102		{ FG_GC,	"Foreground GC" },			\
    103		{ BG_GC,	"Background GC" })
    104
    105#define show_alloc_mode(type)						\
    106	__print_symbolic(type,						\
    107		{ LFS,		"LFS-mode" },				\
    108		{ SSR,		"SSR-mode" },				\
    109		{ AT_SSR,	"AT_SSR-mode" })
    110
    111#define show_victim_policy(type)					\
    112	__print_symbolic(type,						\
    113		{ GC_GREEDY,	"Greedy" },				\
    114		{ GC_CB,	"Cost-Benefit" },			\
    115		{ GC_AT,	"Age-threshold" })
    116
    117#define show_cpreason(type)						\
    118	__print_flags(type, "|",					\
    119		{ CP_UMOUNT,	"Umount" },				\
    120		{ CP_FASTBOOT,	"Fastboot" },				\
    121		{ CP_SYNC,	"Sync" },				\
    122		{ CP_RECOVERY,	"Recovery" },				\
    123		{ CP_DISCARD,	"Discard" },				\
    124		{ CP_PAUSE,	"Pause" },				\
    125		{ CP_TRIMMED,	"Trimmed" },				\
    126		{ CP_RESIZE,	"Resize" })
    127
    128#define show_fsync_cpreason(type)					\
    129	__print_symbolic(type,						\
    130		{ CP_NO_NEEDED,		"no needed" },			\
    131		{ CP_NON_REGULAR,	"non regular" },		\
    132		{ CP_COMPRESSED,	"compressed" },			\
    133		{ CP_HARDLINK,		"hardlink" },			\
    134		{ CP_SB_NEED_CP,	"sb needs cp" },		\
    135		{ CP_WRONG_PINO,	"wrong pino" },			\
    136		{ CP_NO_SPC_ROLL,	"no space roll forward" },	\
    137		{ CP_NODE_NEED_CP,	"node needs cp" },		\
    138		{ CP_FASTBOOT_MODE,	"fastboot mode" },		\
    139		{ CP_SPEC_LOG_NUM,	"log type is 2" },		\
    140		{ CP_RECOVER_DIR,	"dir needs recovery" })
    141
    142#define show_shutdown_mode(type)					\
    143	__print_symbolic(type,						\
    144		{ F2FS_GOING_DOWN_FULLSYNC,	"full sync" },		\
    145		{ F2FS_GOING_DOWN_METASYNC,	"meta sync" },		\
    146		{ F2FS_GOING_DOWN_NOSYNC,	"no sync" },		\
    147		{ F2FS_GOING_DOWN_METAFLUSH,	"meta flush" },		\
    148		{ F2FS_GOING_DOWN_NEED_FSCK,	"need fsck" })
    149
    150#define show_compress_algorithm(type)					\
    151	__print_symbolic(type,						\
    152		{ COMPRESS_LZO,		"LZO" },			\
    153		{ COMPRESS_LZ4,		"LZ4" },			\
    154		{ COMPRESS_ZSTD,	"ZSTD" },			\
    155		{ COMPRESS_LZORLE,	"LZO-RLE" })
    156
    157struct f2fs_sb_info;
    158struct f2fs_io_info;
    159struct extent_info;
    160struct victim_sel_policy;
    161struct f2fs_map_blocks;
    162
    163DECLARE_EVENT_CLASS(f2fs__inode,
    164
    165	TP_PROTO(struct inode *inode),
    166
    167	TP_ARGS(inode),
    168
    169	TP_STRUCT__entry(
    170		__field(dev_t,	dev)
    171		__field(ino_t,	ino)
    172		__field(ino_t,	pino)
    173		__field(umode_t, mode)
    174		__field(loff_t,	size)
    175		__field(unsigned int, nlink)
    176		__field(blkcnt_t, blocks)
    177		__field(__u8,	advise)
    178	),
    179
    180	TP_fast_assign(
    181		__entry->dev	= inode->i_sb->s_dev;
    182		__entry->ino	= inode->i_ino;
    183		__entry->pino	= F2FS_I(inode)->i_pino;
    184		__entry->mode	= inode->i_mode;
    185		__entry->nlink	= inode->i_nlink;
    186		__entry->size	= inode->i_size;
    187		__entry->blocks	= inode->i_blocks;
    188		__entry->advise	= F2FS_I(inode)->i_advise;
    189	),
    190
    191	TP_printk("dev = (%d,%d), ino = %lu, pino = %lu, i_mode = 0x%hx, "
    192		"i_size = %lld, i_nlink = %u, i_blocks = %llu, i_advise = 0x%x",
    193		show_dev_ino(__entry),
    194		(unsigned long)__entry->pino,
    195		__entry->mode,
    196		__entry->size,
    197		(unsigned int)__entry->nlink,
    198		(unsigned long long)__entry->blocks,
    199		(unsigned char)__entry->advise)
    200);
    201
    202DECLARE_EVENT_CLASS(f2fs__inode_exit,
    203
    204	TP_PROTO(struct inode *inode, int ret),
    205
    206	TP_ARGS(inode, ret),
    207
    208	TP_STRUCT__entry(
    209		__field(dev_t,	dev)
    210		__field(ino_t,	ino)
    211		__field(int,	ret)
    212	),
    213
    214	TP_fast_assign(
    215		__entry->dev	= inode->i_sb->s_dev;
    216		__entry->ino	= inode->i_ino;
    217		__entry->ret	= ret;
    218	),
    219
    220	TP_printk("dev = (%d,%d), ino = %lu, ret = %d",
    221		show_dev_ino(__entry),
    222		__entry->ret)
    223);
    224
    225DEFINE_EVENT(f2fs__inode, f2fs_sync_file_enter,
    226
    227	TP_PROTO(struct inode *inode),
    228
    229	TP_ARGS(inode)
    230);
    231
    232TRACE_EVENT(f2fs_sync_file_exit,
    233
    234	TP_PROTO(struct inode *inode, int cp_reason, int datasync, int ret),
    235
    236	TP_ARGS(inode, cp_reason, datasync, ret),
    237
    238	TP_STRUCT__entry(
    239		__field(dev_t,	dev)
    240		__field(ino_t,	ino)
    241		__field(int,	cp_reason)
    242		__field(int,	datasync)
    243		__field(int,	ret)
    244	),
    245
    246	TP_fast_assign(
    247		__entry->dev		= inode->i_sb->s_dev;
    248		__entry->ino		= inode->i_ino;
    249		__entry->cp_reason	= cp_reason;
    250		__entry->datasync	= datasync;
    251		__entry->ret		= ret;
    252	),
    253
    254	TP_printk("dev = (%d,%d), ino = %lu, cp_reason: %s, "
    255		"datasync = %d, ret = %d",
    256		show_dev_ino(__entry),
    257		show_fsync_cpreason(__entry->cp_reason),
    258		__entry->datasync,
    259		__entry->ret)
    260);
    261
    262TRACE_EVENT(f2fs_sync_fs,
    263
    264	TP_PROTO(struct super_block *sb, int wait),
    265
    266	TP_ARGS(sb, wait),
    267
    268	TP_STRUCT__entry(
    269		__field(dev_t,	dev)
    270		__field(int,	dirty)
    271		__field(int,	wait)
    272	),
    273
    274	TP_fast_assign(
    275		__entry->dev	= sb->s_dev;
    276		__entry->dirty	= is_sbi_flag_set(F2FS_SB(sb), SBI_IS_DIRTY);
    277		__entry->wait	= wait;
    278	),
    279
    280	TP_printk("dev = (%d,%d), superblock is %s, wait = %d",
    281		show_dev(__entry->dev),
    282		__entry->dirty ? "dirty" : "not dirty",
    283		__entry->wait)
    284);
    285
    286DEFINE_EVENT(f2fs__inode, f2fs_iget,
    287
    288	TP_PROTO(struct inode *inode),
    289
    290	TP_ARGS(inode)
    291);
    292
    293DEFINE_EVENT(f2fs__inode_exit, f2fs_iget_exit,
    294
    295	TP_PROTO(struct inode *inode, int ret),
    296
    297	TP_ARGS(inode, ret)
    298);
    299
    300DEFINE_EVENT(f2fs__inode, f2fs_evict_inode,
    301
    302	TP_PROTO(struct inode *inode),
    303
    304	TP_ARGS(inode)
    305);
    306
    307DEFINE_EVENT(f2fs__inode_exit, f2fs_new_inode,
    308
    309	TP_PROTO(struct inode *inode, int ret),
    310
    311	TP_ARGS(inode, ret)
    312);
    313
    314TRACE_EVENT(f2fs_unlink_enter,
    315
    316	TP_PROTO(struct inode *dir, struct dentry *dentry),
    317
    318	TP_ARGS(dir, dentry),
    319
    320	TP_STRUCT__entry(
    321		__field(dev_t,	dev)
    322		__field(ino_t,	ino)
    323		__field(loff_t,	size)
    324		__field(blkcnt_t, blocks)
    325		__field(const char *,	name)
    326	),
    327
    328	TP_fast_assign(
    329		__entry->dev	= dir->i_sb->s_dev;
    330		__entry->ino	= dir->i_ino;
    331		__entry->size	= dir->i_size;
    332		__entry->blocks	= dir->i_blocks;
    333		__entry->name	= dentry->d_name.name;
    334	),
    335
    336	TP_printk("dev = (%d,%d), dir ino = %lu, i_size = %lld, "
    337		"i_blocks = %llu, name = %s",
    338		show_dev_ino(__entry),
    339		__entry->size,
    340		(unsigned long long)__entry->blocks,
    341		__entry->name)
    342);
    343
    344DEFINE_EVENT(f2fs__inode_exit, f2fs_unlink_exit,
    345
    346	TP_PROTO(struct inode *inode, int ret),
    347
    348	TP_ARGS(inode, ret)
    349);
    350
    351DEFINE_EVENT(f2fs__inode_exit, f2fs_drop_inode,
    352
    353	TP_PROTO(struct inode *inode, int ret),
    354
    355	TP_ARGS(inode, ret)
    356);
    357
    358DEFINE_EVENT(f2fs__inode, f2fs_truncate,
    359
    360	TP_PROTO(struct inode *inode),
    361
    362	TP_ARGS(inode)
    363);
    364
    365TRACE_EVENT(f2fs_truncate_data_blocks_range,
    366
    367	TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs, int free),
    368
    369	TP_ARGS(inode, nid,  ofs, free),
    370
    371	TP_STRUCT__entry(
    372		__field(dev_t,	dev)
    373		__field(ino_t,	ino)
    374		__field(nid_t,	nid)
    375		__field(unsigned int,	ofs)
    376		__field(int,	free)
    377	),
    378
    379	TP_fast_assign(
    380		__entry->dev	= inode->i_sb->s_dev;
    381		__entry->ino	= inode->i_ino;
    382		__entry->nid	= nid;
    383		__entry->ofs	= ofs;
    384		__entry->free	= free;
    385	),
    386
    387	TP_printk("dev = (%d,%d), ino = %lu, nid = %u, offset = %u, freed = %d",
    388		show_dev_ino(__entry),
    389		(unsigned int)__entry->nid,
    390		__entry->ofs,
    391		__entry->free)
    392);
    393
    394DECLARE_EVENT_CLASS(f2fs__truncate_op,
    395
    396	TP_PROTO(struct inode *inode, u64 from),
    397
    398	TP_ARGS(inode, from),
    399
    400	TP_STRUCT__entry(
    401		__field(dev_t,	dev)
    402		__field(ino_t,	ino)
    403		__field(loff_t,	size)
    404		__field(blkcnt_t, blocks)
    405		__field(u64,	from)
    406	),
    407
    408	TP_fast_assign(
    409		__entry->dev	= inode->i_sb->s_dev;
    410		__entry->ino	= inode->i_ino;
    411		__entry->size	= inode->i_size;
    412		__entry->blocks	= inode->i_blocks;
    413		__entry->from	= from;
    414	),
    415
    416	TP_printk("dev = (%d,%d), ino = %lu, i_size = %lld, i_blocks = %llu, "
    417		"start file offset = %llu",
    418		show_dev_ino(__entry),
    419		__entry->size,
    420		(unsigned long long)__entry->blocks,
    421		(unsigned long long)__entry->from)
    422);
    423
    424DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_blocks_enter,
    425
    426	TP_PROTO(struct inode *inode, u64 from),
    427
    428	TP_ARGS(inode, from)
    429);
    430
    431DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_blocks_exit,
    432
    433	TP_PROTO(struct inode *inode, int ret),
    434
    435	TP_ARGS(inode, ret)
    436);
    437
    438DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_inode_blocks_enter,
    439
    440	TP_PROTO(struct inode *inode, u64 from),
    441
    442	TP_ARGS(inode, from)
    443);
    444
    445DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_inode_blocks_exit,
    446
    447	TP_PROTO(struct inode *inode, int ret),
    448
    449	TP_ARGS(inode, ret)
    450);
    451
    452DECLARE_EVENT_CLASS(f2fs__truncate_node,
    453
    454	TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
    455
    456	TP_ARGS(inode, nid, blk_addr),
    457
    458	TP_STRUCT__entry(
    459		__field(dev_t,	dev)
    460		__field(ino_t,	ino)
    461		__field(nid_t,	nid)
    462		__field(block_t,	blk_addr)
    463	),
    464
    465	TP_fast_assign(
    466		__entry->dev		= inode->i_sb->s_dev;
    467		__entry->ino		= inode->i_ino;
    468		__entry->nid		= nid;
    469		__entry->blk_addr	= blk_addr;
    470	),
    471
    472	TP_printk("dev = (%d,%d), ino = %lu, nid = %u, block_address = 0x%llx",
    473		show_dev_ino(__entry),
    474		(unsigned int)__entry->nid,
    475		(unsigned long long)__entry->blk_addr)
    476);
    477
    478DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_nodes_enter,
    479
    480	TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
    481
    482	TP_ARGS(inode, nid, blk_addr)
    483);
    484
    485DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_nodes_exit,
    486
    487	TP_PROTO(struct inode *inode, int ret),
    488
    489	TP_ARGS(inode, ret)
    490);
    491
    492DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_node,
    493
    494	TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
    495
    496	TP_ARGS(inode, nid, blk_addr)
    497);
    498
    499TRACE_EVENT(f2fs_truncate_partial_nodes,
    500
    501	TP_PROTO(struct inode *inode, nid_t *nid, int depth, int err),
    502
    503	TP_ARGS(inode, nid, depth, err),
    504
    505	TP_STRUCT__entry(
    506		__field(dev_t,	dev)
    507		__field(ino_t,	ino)
    508		__field(nid_t,	nid[3])
    509		__field(int,	depth)
    510		__field(int,	err)
    511	),
    512
    513	TP_fast_assign(
    514		__entry->dev	= inode->i_sb->s_dev;
    515		__entry->ino	= inode->i_ino;
    516		__entry->nid[0]	= nid[0];
    517		__entry->nid[1]	= nid[1];
    518		__entry->nid[2]	= nid[2];
    519		__entry->depth	= depth;
    520		__entry->err	= err;
    521	),
    522
    523	TP_printk("dev = (%d,%d), ino = %lu, "
    524		"nid[0] = %u, nid[1] = %u, nid[2] = %u, depth = %d, err = %d",
    525		show_dev_ino(__entry),
    526		(unsigned int)__entry->nid[0],
    527		(unsigned int)__entry->nid[1],
    528		(unsigned int)__entry->nid[2],
    529		__entry->depth,
    530		__entry->err)
    531);
    532
    533TRACE_EVENT(f2fs_file_write_iter,
    534
    535	TP_PROTO(struct inode *inode, loff_t offset, size_t length,
    536		 ssize_t ret),
    537
    538	TP_ARGS(inode, offset, length, ret),
    539
    540	TP_STRUCT__entry(
    541		__field(dev_t,	dev)
    542		__field(ino_t,	ino)
    543		__field(loff_t, offset)
    544		__field(size_t, length)
    545		__field(ssize_t, ret)
    546	),
    547
    548	TP_fast_assign(
    549		__entry->dev	= inode->i_sb->s_dev;
    550		__entry->ino	= inode->i_ino;
    551		__entry->offset	= offset;
    552		__entry->length	= length;
    553		__entry->ret	= ret;
    554	),
    555
    556	TP_printk("dev = (%d,%d), ino = %lu, "
    557		"offset = %lld, length = %zu, written(err) = %zd",
    558		show_dev_ino(__entry),
    559		__entry->offset,
    560		__entry->length,
    561		__entry->ret)
    562);
    563
    564TRACE_EVENT(f2fs_map_blocks,
    565	TP_PROTO(struct inode *inode, struct f2fs_map_blocks *map,
    566				int create, int flag, int ret),
    567
    568	TP_ARGS(inode, map, create, flag, ret),
    569
    570	TP_STRUCT__entry(
    571		__field(dev_t,	dev)
    572		__field(ino_t,	ino)
    573		__field(block_t,	m_lblk)
    574		__field(block_t,	m_pblk)
    575		__field(unsigned int,	m_len)
    576		__field(unsigned int,	m_flags)
    577		__field(int,	m_seg_type)
    578		__field(bool,	m_may_create)
    579		__field(bool,	m_multidev_dio)
    580		__field(int,	create)
    581		__field(int,	flag)
    582		__field(int,	ret)
    583	),
    584
    585	TP_fast_assign(
    586		__entry->dev		= map->m_bdev->bd_dev;
    587		__entry->ino		= inode->i_ino;
    588		__entry->m_lblk		= map->m_lblk;
    589		__entry->m_pblk		= map->m_pblk;
    590		__entry->m_len		= map->m_len;
    591		__entry->m_flags	= map->m_flags;
    592		__entry->m_seg_type	= map->m_seg_type;
    593		__entry->m_may_create	= map->m_may_create;
    594		__entry->m_multidev_dio	= map->m_multidev_dio;
    595		__entry->create		= create;
    596		__entry->flag		= flag;
    597		__entry->ret		= ret;
    598	),
    599
    600	TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, "
    601		"start blkaddr = 0x%llx, len = 0x%llx, flags = %u, "
    602		"seg_type = %d, may_create = %d, multidevice = %d, "
    603		"create = %d, flag = %d, err = %d",
    604		show_dev_ino(__entry),
    605		(unsigned long long)__entry->m_lblk,
    606		(unsigned long long)__entry->m_pblk,
    607		(unsigned long long)__entry->m_len,
    608		__entry->m_flags,
    609		__entry->m_seg_type,
    610		__entry->m_may_create,
    611		__entry->m_multidev_dio,
    612		__entry->create,
    613		__entry->flag,
    614		__entry->ret)
    615);
    616
    617TRACE_EVENT(f2fs_background_gc,
    618
    619	TP_PROTO(struct super_block *sb, unsigned int wait_ms,
    620			unsigned int prefree, unsigned int free),
    621
    622	TP_ARGS(sb, wait_ms, prefree, free),
    623
    624	TP_STRUCT__entry(
    625		__field(dev_t,	dev)
    626		__field(unsigned int,	wait_ms)
    627		__field(unsigned int,	prefree)
    628		__field(unsigned int,	free)
    629	),
    630
    631	TP_fast_assign(
    632		__entry->dev		= sb->s_dev;
    633		__entry->wait_ms	= wait_ms;
    634		__entry->prefree	= prefree;
    635		__entry->free		= free;
    636	),
    637
    638	TP_printk("dev = (%d,%d), wait_ms = %u, prefree = %u, free = %u",
    639		show_dev(__entry->dev),
    640		__entry->wait_ms,
    641		__entry->prefree,
    642		__entry->free)
    643);
    644
    645TRACE_EVENT(f2fs_gc_begin,
    646
    647	TP_PROTO(struct super_block *sb, int gc_type, bool no_bg_gc,
    648			unsigned int nr_free_secs,
    649			long long dirty_nodes, long long dirty_dents,
    650			long long dirty_imeta, unsigned int free_sec,
    651			unsigned int free_seg, int reserved_seg,
    652			unsigned int prefree_seg),
    653
    654	TP_ARGS(sb, gc_type, no_bg_gc, nr_free_secs, dirty_nodes,
    655		dirty_dents, dirty_imeta,
    656		free_sec, free_seg, reserved_seg, prefree_seg),
    657
    658	TP_STRUCT__entry(
    659		__field(dev_t,		dev)
    660		__field(int,		gc_type)
    661		__field(bool,		no_bg_gc)
    662		__field(unsigned int,	nr_free_secs)
    663		__field(long long,	dirty_nodes)
    664		__field(long long,	dirty_dents)
    665		__field(long long,	dirty_imeta)
    666		__field(unsigned int,	free_sec)
    667		__field(unsigned int,	free_seg)
    668		__field(int,		reserved_seg)
    669		__field(unsigned int,	prefree_seg)
    670	),
    671
    672	TP_fast_assign(
    673		__entry->dev		= sb->s_dev;
    674		__entry->gc_type	= gc_type;
    675		__entry->no_bg_gc	= no_bg_gc;
    676		__entry->nr_free_secs	= nr_free_secs;
    677		__entry->dirty_nodes	= dirty_nodes;
    678		__entry->dirty_dents	= dirty_dents;
    679		__entry->dirty_imeta	= dirty_imeta;
    680		__entry->free_sec	= free_sec;
    681		__entry->free_seg	= free_seg;
    682		__entry->reserved_seg	= reserved_seg;
    683		__entry->prefree_seg	= prefree_seg;
    684	),
    685
    686	TP_printk("dev = (%d,%d), gc_type = %s, no_background_GC = %d, nr_free_secs = %u, "
    687		"nodes = %lld, dents = %lld, imeta = %lld, free_sec:%u, free_seg:%u, "
    688		"rsv_seg:%d, prefree_seg:%u",
    689		show_dev(__entry->dev),
    690		show_gc_type(__entry->gc_type),
    691		(__entry->gc_type == BG_GC) ? __entry->no_bg_gc : -1,
    692		__entry->nr_free_secs,
    693		__entry->dirty_nodes,
    694		__entry->dirty_dents,
    695		__entry->dirty_imeta,
    696		__entry->free_sec,
    697		__entry->free_seg,
    698		__entry->reserved_seg,
    699		__entry->prefree_seg)
    700);
    701
    702TRACE_EVENT(f2fs_gc_end,
    703
    704	TP_PROTO(struct super_block *sb, int ret, int seg_freed,
    705			int sec_freed, long long dirty_nodes,
    706			long long dirty_dents, long long dirty_imeta,
    707			unsigned int free_sec, unsigned int free_seg,
    708			int reserved_seg, unsigned int prefree_seg),
    709
    710	TP_ARGS(sb, ret, seg_freed, sec_freed, dirty_nodes, dirty_dents,
    711		dirty_imeta, free_sec, free_seg, reserved_seg, prefree_seg),
    712
    713	TP_STRUCT__entry(
    714		__field(dev_t,		dev)
    715		__field(int,		ret)
    716		__field(int,		seg_freed)
    717		__field(int,		sec_freed)
    718		__field(long long,	dirty_nodes)
    719		__field(long long,	dirty_dents)
    720		__field(long long,	dirty_imeta)
    721		__field(unsigned int,	free_sec)
    722		__field(unsigned int,	free_seg)
    723		__field(int,		reserved_seg)
    724		__field(unsigned int,	prefree_seg)
    725	),
    726
    727	TP_fast_assign(
    728		__entry->dev		= sb->s_dev;
    729		__entry->ret		= ret;
    730		__entry->seg_freed	= seg_freed;
    731		__entry->sec_freed	= sec_freed;
    732		__entry->dirty_nodes	= dirty_nodes;
    733		__entry->dirty_dents	= dirty_dents;
    734		__entry->dirty_imeta	= dirty_imeta;
    735		__entry->free_sec	= free_sec;
    736		__entry->free_seg	= free_seg;
    737		__entry->reserved_seg	= reserved_seg;
    738		__entry->prefree_seg	= prefree_seg;
    739	),
    740
    741	TP_printk("dev = (%d,%d), ret = %d, seg_freed = %d, sec_freed = %d, "
    742		"nodes = %lld, dents = %lld, imeta = %lld, free_sec:%u, "
    743		"free_seg:%u, rsv_seg:%d, prefree_seg:%u",
    744		show_dev(__entry->dev),
    745		__entry->ret,
    746		__entry->seg_freed,
    747		__entry->sec_freed,
    748		__entry->dirty_nodes,
    749		__entry->dirty_dents,
    750		__entry->dirty_imeta,
    751		__entry->free_sec,
    752		__entry->free_seg,
    753		__entry->reserved_seg,
    754		__entry->prefree_seg)
    755);
    756
    757TRACE_EVENT(f2fs_get_victim,
    758
    759	TP_PROTO(struct super_block *sb, int type, int gc_type,
    760			struct victim_sel_policy *p, unsigned int pre_victim,
    761			unsigned int prefree, unsigned int free),
    762
    763	TP_ARGS(sb, type, gc_type, p, pre_victim, prefree, free),
    764
    765	TP_STRUCT__entry(
    766		__field(dev_t,	dev)
    767		__field(int,	type)
    768		__field(int,	gc_type)
    769		__field(int,	alloc_mode)
    770		__field(int,	gc_mode)
    771		__field(unsigned int,	victim)
    772		__field(unsigned int,	cost)
    773		__field(unsigned int,	ofs_unit)
    774		__field(unsigned int,	pre_victim)
    775		__field(unsigned int,	prefree)
    776		__field(unsigned int,	free)
    777	),
    778
    779	TP_fast_assign(
    780		__entry->dev		= sb->s_dev;
    781		__entry->type		= type;
    782		__entry->gc_type	= gc_type;
    783		__entry->alloc_mode	= p->alloc_mode;
    784		__entry->gc_mode	= p->gc_mode;
    785		__entry->victim		= p->min_segno;
    786		__entry->cost		= p->min_cost;
    787		__entry->ofs_unit	= p->ofs_unit;
    788		__entry->pre_victim	= pre_victim;
    789		__entry->prefree	= prefree;
    790		__entry->free		= free;
    791	),
    792
    793	TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), "
    794		"victim = %u, cost = %u, ofs_unit = %u, "
    795		"pre_victim_secno = %d, prefree = %u, free = %u",
    796		show_dev(__entry->dev),
    797		show_data_type(__entry->type),
    798		show_gc_type(__entry->gc_type),
    799		show_alloc_mode(__entry->alloc_mode),
    800		show_victim_policy(__entry->gc_mode),
    801		__entry->victim,
    802		__entry->cost,
    803		__entry->ofs_unit,
    804		(int)__entry->pre_victim,
    805		__entry->prefree,
    806		__entry->free)
    807);
    808
    809TRACE_EVENT(f2fs_lookup_start,
    810
    811	TP_PROTO(struct inode *dir, struct dentry *dentry, unsigned int flags),
    812
    813	TP_ARGS(dir, dentry, flags),
    814
    815	TP_STRUCT__entry(
    816		__field(dev_t,	dev)
    817		__field(ino_t,	ino)
    818		__string(name,	dentry->d_name.name)
    819		__field(unsigned int, flags)
    820	),
    821
    822	TP_fast_assign(
    823		__entry->dev	= dir->i_sb->s_dev;
    824		__entry->ino	= dir->i_ino;
    825		__assign_str(name, dentry->d_name.name);
    826		__entry->flags	= flags;
    827	),
    828
    829	TP_printk("dev = (%d,%d), pino = %lu, name:%s, flags:%u",
    830		show_dev_ino(__entry),
    831		__get_str(name),
    832		__entry->flags)
    833);
    834
    835TRACE_EVENT(f2fs_lookup_end,
    836
    837	TP_PROTO(struct inode *dir, struct dentry *dentry, nid_t ino,
    838		int err),
    839
    840	TP_ARGS(dir, dentry, ino, err),
    841
    842	TP_STRUCT__entry(
    843		__field(dev_t,	dev)
    844		__field(ino_t,	ino)
    845		__string(name,	dentry->d_name.name)
    846		__field(nid_t,	cino)
    847		__field(int,	err)
    848	),
    849
    850	TP_fast_assign(
    851		__entry->dev	= dir->i_sb->s_dev;
    852		__entry->ino	= dir->i_ino;
    853		__assign_str(name, dentry->d_name.name);
    854		__entry->cino	= ino;
    855		__entry->err	= err;
    856	),
    857
    858	TP_printk("dev = (%d,%d), pino = %lu, name:%s, ino:%u, err:%d",
    859		show_dev_ino(__entry),
    860		__get_str(name),
    861		__entry->cino,
    862		__entry->err)
    863);
    864
    865TRACE_EVENT(f2fs_readdir,
    866
    867	TP_PROTO(struct inode *dir, loff_t start_pos, loff_t end_pos, int err),
    868
    869	TP_ARGS(dir, start_pos, end_pos, err),
    870
    871	TP_STRUCT__entry(
    872		__field(dev_t,	dev)
    873		__field(ino_t,	ino)
    874		__field(loff_t,	start)
    875		__field(loff_t,	end)
    876		__field(int,	err)
    877	),
    878
    879	TP_fast_assign(
    880		__entry->dev	= dir->i_sb->s_dev;
    881		__entry->ino	= dir->i_ino;
    882		__entry->start	= start_pos;
    883		__entry->end	= end_pos;
    884		__entry->err	= err;
    885	),
    886
    887	TP_printk("dev = (%d,%d), ino = %lu, start_pos:%llu, end_pos:%llu, err:%d",
    888		show_dev_ino(__entry),
    889		__entry->start,
    890		__entry->end,
    891		__entry->err)
    892);
    893
    894TRACE_EVENT(f2fs_fallocate,
    895
    896	TP_PROTO(struct inode *inode, int mode,
    897				loff_t offset, loff_t len, int ret),
    898
    899	TP_ARGS(inode, mode, offset, len, ret),
    900
    901	TP_STRUCT__entry(
    902		__field(dev_t,	dev)
    903		__field(ino_t,	ino)
    904		__field(int,	mode)
    905		__field(loff_t,	offset)
    906		__field(loff_t,	len)
    907		__field(loff_t, size)
    908		__field(blkcnt_t, blocks)
    909		__field(int,	ret)
    910	),
    911
    912	TP_fast_assign(
    913		__entry->dev	= inode->i_sb->s_dev;
    914		__entry->ino	= inode->i_ino;
    915		__entry->mode	= mode;
    916		__entry->offset	= offset;
    917		__entry->len	= len;
    918		__entry->size	= inode->i_size;
    919		__entry->blocks = inode->i_blocks;
    920		__entry->ret	= ret;
    921	),
    922
    923	TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, "
    924		"len = %lld,  i_size = %lld, i_blocks = %llu, ret = %d",
    925		show_dev_ino(__entry),
    926		__entry->mode,
    927		(unsigned long long)__entry->offset,
    928		(unsigned long long)__entry->len,
    929		(unsigned long long)__entry->size,
    930		(unsigned long long)__entry->blocks,
    931		__entry->ret)
    932);
    933
    934TRACE_EVENT(f2fs_direct_IO_enter,
    935
    936	TP_PROTO(struct inode *inode, struct kiocb *iocb, long len, int rw),
    937
    938	TP_ARGS(inode, iocb, len, rw),
    939
    940	TP_STRUCT__entry(
    941		__field(dev_t,	dev)
    942		__field(ino_t,	ino)
    943		__field(struct kiocb *,	iocb)
    944		__field(unsigned long,	len)
    945		__field(int,	rw)
    946	),
    947
    948	TP_fast_assign(
    949		__entry->dev	= inode->i_sb->s_dev;
    950		__entry->ino	= inode->i_ino;
    951		__entry->iocb	= iocb;
    952		__entry->len	= len;
    953		__entry->rw	= rw;
    954	),
    955
    956	TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu ki_flags = %x ki_ioprio = %x rw = %d",
    957		show_dev_ino(__entry),
    958		__entry->iocb->ki_pos,
    959		__entry->len,
    960		__entry->iocb->ki_flags,
    961		__entry->iocb->ki_ioprio,
    962		__entry->rw)
    963);
    964
    965TRACE_EVENT(f2fs_direct_IO_exit,
    966
    967	TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
    968		 int rw, int ret),
    969
    970	TP_ARGS(inode, offset, len, rw, ret),
    971
    972	TP_STRUCT__entry(
    973		__field(dev_t,	dev)
    974		__field(ino_t,	ino)
    975		__field(loff_t,	pos)
    976		__field(unsigned long,	len)
    977		__field(int,	rw)
    978		__field(int,	ret)
    979	),
    980
    981	TP_fast_assign(
    982		__entry->dev	= inode->i_sb->s_dev;
    983		__entry->ino	= inode->i_ino;
    984		__entry->pos	= offset;
    985		__entry->len	= len;
    986		__entry->rw	= rw;
    987		__entry->ret	= ret;
    988	),
    989
    990	TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu "
    991		"rw = %d ret = %d",
    992		show_dev_ino(__entry),
    993		__entry->pos,
    994		__entry->len,
    995		__entry->rw,
    996		__entry->ret)
    997);
    998
    999TRACE_EVENT(f2fs_reserve_new_blocks,
   1000
   1001	TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs_in_node,
   1002							blkcnt_t count),
   1003
   1004	TP_ARGS(inode, nid, ofs_in_node, count),
   1005
   1006	TP_STRUCT__entry(
   1007		__field(dev_t,	dev)
   1008		__field(nid_t, nid)
   1009		__field(unsigned int, ofs_in_node)
   1010		__field(blkcnt_t, count)
   1011	),
   1012
   1013	TP_fast_assign(
   1014		__entry->dev	= inode->i_sb->s_dev;
   1015		__entry->nid	= nid;
   1016		__entry->ofs_in_node = ofs_in_node;
   1017		__entry->count = count;
   1018	),
   1019
   1020	TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u, count = %llu",
   1021		show_dev(__entry->dev),
   1022		(unsigned int)__entry->nid,
   1023		__entry->ofs_in_node,
   1024		(unsigned long long)__entry->count)
   1025);
   1026
   1027DECLARE_EVENT_CLASS(f2fs__submit_page_bio,
   1028
   1029	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
   1030
   1031	TP_ARGS(page, fio),
   1032
   1033	TP_STRUCT__entry(
   1034		__field(dev_t, dev)
   1035		__field(ino_t, ino)
   1036		__field(pgoff_t, index)
   1037		__field(block_t, old_blkaddr)
   1038		__field(block_t, new_blkaddr)
   1039		__field(int, op)
   1040		__field(int, op_flags)
   1041		__field(int, temp)
   1042		__field(int, type)
   1043	),
   1044
   1045	TP_fast_assign(
   1046		__entry->dev		= page_file_mapping(page)->host->i_sb->s_dev;
   1047		__entry->ino		= page_file_mapping(page)->host->i_ino;
   1048		__entry->index		= page->index;
   1049		__entry->old_blkaddr	= fio->old_blkaddr;
   1050		__entry->new_blkaddr	= fio->new_blkaddr;
   1051		__entry->op		= fio->op;
   1052		__entry->op_flags	= fio->op_flags;
   1053		__entry->temp		= fio->temp;
   1054		__entry->type		= fio->type;
   1055	),
   1056
   1057	TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, "
   1058		"oldaddr = 0x%llx, newaddr = 0x%llx, rw = %s(%s), type = %s_%s",
   1059		show_dev_ino(__entry),
   1060		(unsigned long)__entry->index,
   1061		(unsigned long long)__entry->old_blkaddr,
   1062		(unsigned long long)__entry->new_blkaddr,
   1063		show_bio_type(__entry->op, __entry->op_flags),
   1064		show_block_temp(__entry->temp),
   1065		show_block_type(__entry->type))
   1066);
   1067
   1068DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_bio,
   1069
   1070	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
   1071
   1072	TP_ARGS(page, fio),
   1073
   1074	TP_CONDITION(page->mapping)
   1075);
   1076
   1077DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_write,
   1078
   1079	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
   1080
   1081	TP_ARGS(page, fio),
   1082
   1083	TP_CONDITION(page->mapping)
   1084);
   1085
   1086DECLARE_EVENT_CLASS(f2fs__bio,
   1087
   1088	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
   1089
   1090	TP_ARGS(sb, type, bio),
   1091
   1092	TP_STRUCT__entry(
   1093		__field(dev_t,	dev)
   1094		__field(dev_t,	target)
   1095		__field(int,	op)
   1096		__field(int,	op_flags)
   1097		__field(int,	type)
   1098		__field(sector_t,	sector)
   1099		__field(unsigned int,	size)
   1100	),
   1101
   1102	TP_fast_assign(
   1103		__entry->dev		= sb->s_dev;
   1104		__entry->target		= bio_dev(bio);
   1105		__entry->op		= bio_op(bio);
   1106		__entry->op_flags	= bio->bi_opf;
   1107		__entry->type		= type;
   1108		__entry->sector		= bio->bi_iter.bi_sector;
   1109		__entry->size		= bio->bi_iter.bi_size;
   1110	),
   1111
   1112	TP_printk("dev = (%d,%d)/(%d,%d), rw = %s(%s), %s, sector = %lld, size = %u",
   1113		show_dev(__entry->target),
   1114		show_dev(__entry->dev),
   1115		show_bio_type(__entry->op, __entry->op_flags),
   1116		show_block_type(__entry->type),
   1117		(unsigned long long)__entry->sector,
   1118		__entry->size)
   1119);
   1120
   1121DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_prepare_write_bio,
   1122
   1123	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
   1124
   1125	TP_ARGS(sb, type, bio),
   1126
   1127	TP_CONDITION(bio)
   1128);
   1129
   1130DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_prepare_read_bio,
   1131
   1132	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
   1133
   1134	TP_ARGS(sb, type, bio),
   1135
   1136	TP_CONDITION(bio)
   1137);
   1138
   1139DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_read_bio,
   1140
   1141	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
   1142
   1143	TP_ARGS(sb, type, bio),
   1144
   1145	TP_CONDITION(bio)
   1146);
   1147
   1148DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_write_bio,
   1149
   1150	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
   1151
   1152	TP_ARGS(sb, type, bio),
   1153
   1154	TP_CONDITION(bio)
   1155);
   1156
   1157TRACE_EVENT(f2fs_write_begin,
   1158
   1159	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len),
   1160
   1161	TP_ARGS(inode, pos, len),
   1162
   1163	TP_STRUCT__entry(
   1164		__field(dev_t,	dev)
   1165		__field(ino_t,	ino)
   1166		__field(loff_t,	pos)
   1167		__field(unsigned int, len)
   1168	),
   1169
   1170	TP_fast_assign(
   1171		__entry->dev	= inode->i_sb->s_dev;
   1172		__entry->ino	= inode->i_ino;
   1173		__entry->pos	= pos;
   1174		__entry->len	= len;
   1175	),
   1176
   1177	TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u",
   1178		show_dev_ino(__entry),
   1179		(unsigned long long)__entry->pos,
   1180		__entry->len)
   1181);
   1182
   1183TRACE_EVENT(f2fs_write_end,
   1184
   1185	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
   1186				unsigned int copied),
   1187
   1188	TP_ARGS(inode, pos, len, copied),
   1189
   1190	TP_STRUCT__entry(
   1191		__field(dev_t,	dev)
   1192		__field(ino_t,	ino)
   1193		__field(loff_t,	pos)
   1194		__field(unsigned int, len)
   1195		__field(unsigned int, copied)
   1196	),
   1197
   1198	TP_fast_assign(
   1199		__entry->dev	= inode->i_sb->s_dev;
   1200		__entry->ino	= inode->i_ino;
   1201		__entry->pos	= pos;
   1202		__entry->len	= len;
   1203		__entry->copied	= copied;
   1204	),
   1205
   1206	TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u",
   1207		show_dev_ino(__entry),
   1208		(unsigned long long)__entry->pos,
   1209		__entry->len,
   1210		__entry->copied)
   1211);
   1212
   1213DECLARE_EVENT_CLASS(f2fs__page,
   1214
   1215	TP_PROTO(struct page *page, int type),
   1216
   1217	TP_ARGS(page, type),
   1218
   1219	TP_STRUCT__entry(
   1220		__field(dev_t,	dev)
   1221		__field(ino_t,	ino)
   1222		__field(int, type)
   1223		__field(int, dir)
   1224		__field(pgoff_t, index)
   1225		__field(int, dirty)
   1226		__field(int, uptodate)
   1227	),
   1228
   1229	TP_fast_assign(
   1230		__entry->dev	= page_file_mapping(page)->host->i_sb->s_dev;
   1231		__entry->ino	= page_file_mapping(page)->host->i_ino;
   1232		__entry->type	= type;
   1233		__entry->dir	=
   1234			S_ISDIR(page_file_mapping(page)->host->i_mode);
   1235		__entry->index	= page->index;
   1236		__entry->dirty	= PageDirty(page);
   1237		__entry->uptodate = PageUptodate(page);
   1238	),
   1239
   1240	TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, "
   1241		"dirty = %d, uptodate = %d",
   1242		show_dev_ino(__entry),
   1243		show_block_type(__entry->type),
   1244		show_file_type(__entry->dir),
   1245		(unsigned long)__entry->index,
   1246		__entry->dirty,
   1247		__entry->uptodate)
   1248);
   1249
   1250DEFINE_EVENT(f2fs__page, f2fs_writepage,
   1251
   1252	TP_PROTO(struct page *page, int type),
   1253
   1254	TP_ARGS(page, type)
   1255);
   1256
   1257DEFINE_EVENT(f2fs__page, f2fs_do_write_data_page,
   1258
   1259	TP_PROTO(struct page *page, int type),
   1260
   1261	TP_ARGS(page, type)
   1262);
   1263
   1264DEFINE_EVENT(f2fs__page, f2fs_readpage,
   1265
   1266	TP_PROTO(struct page *page, int type),
   1267
   1268	TP_ARGS(page, type)
   1269);
   1270
   1271DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty,
   1272
   1273	TP_PROTO(struct page *page, int type),
   1274
   1275	TP_ARGS(page, type)
   1276);
   1277
   1278DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite,
   1279
   1280	TP_PROTO(struct page *page, int type),
   1281
   1282	TP_ARGS(page, type)
   1283);
   1284
   1285TRACE_EVENT(f2fs_filemap_fault,
   1286
   1287	TP_PROTO(struct inode *inode, pgoff_t index, unsigned long ret),
   1288
   1289	TP_ARGS(inode, index, ret),
   1290
   1291	TP_STRUCT__entry(
   1292		__field(dev_t,	dev)
   1293		__field(ino_t,	ino)
   1294		__field(pgoff_t, index)
   1295		__field(unsigned long, ret)
   1296	),
   1297
   1298	TP_fast_assign(
   1299		__entry->dev	= inode->i_sb->s_dev;
   1300		__entry->ino	= inode->i_ino;
   1301		__entry->index	= index;
   1302		__entry->ret	= ret;
   1303	),
   1304
   1305	TP_printk("dev = (%d,%d), ino = %lu, index = %lu, ret = %lx",
   1306		show_dev_ino(__entry),
   1307		(unsigned long)__entry->index,
   1308		__entry->ret)
   1309);
   1310
   1311TRACE_EVENT(f2fs_writepages,
   1312
   1313	TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type),
   1314
   1315	TP_ARGS(inode, wbc, type),
   1316
   1317	TP_STRUCT__entry(
   1318		__field(dev_t,	dev)
   1319		__field(ino_t,	ino)
   1320		__field(int,	type)
   1321		__field(int,	dir)
   1322		__field(long,	nr_to_write)
   1323		__field(long,	pages_skipped)
   1324		__field(loff_t,	range_start)
   1325		__field(loff_t,	range_end)
   1326		__field(pgoff_t, writeback_index)
   1327		__field(int,	sync_mode)
   1328		__field(char,	for_kupdate)
   1329		__field(char,	for_background)
   1330		__field(char,	tagged_writepages)
   1331		__field(char,	for_reclaim)
   1332		__field(char,	range_cyclic)
   1333		__field(char,	for_sync)
   1334	),
   1335
   1336	TP_fast_assign(
   1337		__entry->dev		= inode->i_sb->s_dev;
   1338		__entry->ino		= inode->i_ino;
   1339		__entry->type		= type;
   1340		__entry->dir		= S_ISDIR(inode->i_mode);
   1341		__entry->nr_to_write	= wbc->nr_to_write;
   1342		__entry->pages_skipped	= wbc->pages_skipped;
   1343		__entry->range_start	= wbc->range_start;
   1344		__entry->range_end	= wbc->range_end;
   1345		__entry->writeback_index = inode->i_mapping->writeback_index;
   1346		__entry->sync_mode	= wbc->sync_mode;
   1347		__entry->for_kupdate	= wbc->for_kupdate;
   1348		__entry->for_background	= wbc->for_background;
   1349		__entry->tagged_writepages	= wbc->tagged_writepages;
   1350		__entry->for_reclaim	= wbc->for_reclaim;
   1351		__entry->range_cyclic	= wbc->range_cyclic;
   1352		__entry->for_sync	= wbc->for_sync;
   1353	),
   1354
   1355	TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
   1356		"skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
   1357		"kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
   1358		show_dev_ino(__entry),
   1359		show_block_type(__entry->type),
   1360		show_file_type(__entry->dir),
   1361		__entry->nr_to_write,
   1362		__entry->pages_skipped,
   1363		__entry->range_start,
   1364		__entry->range_end,
   1365		(unsigned long)__entry->writeback_index,
   1366		__entry->sync_mode,
   1367		__entry->for_kupdate,
   1368		__entry->for_background,
   1369		__entry->tagged_writepages,
   1370		__entry->for_reclaim,
   1371		__entry->range_cyclic,
   1372		__entry->for_sync)
   1373);
   1374
   1375TRACE_EVENT(f2fs_readpages,
   1376
   1377	TP_PROTO(struct inode *inode, pgoff_t start, unsigned int nrpage),
   1378
   1379	TP_ARGS(inode, start, nrpage),
   1380
   1381	TP_STRUCT__entry(
   1382		__field(dev_t,	dev)
   1383		__field(ino_t,	ino)
   1384		__field(pgoff_t,	start)
   1385		__field(unsigned int,	nrpage)
   1386	),
   1387
   1388	TP_fast_assign(
   1389		__entry->dev	= inode->i_sb->s_dev;
   1390		__entry->ino	= inode->i_ino;
   1391		__entry->start	= start;
   1392		__entry->nrpage	= nrpage;
   1393	),
   1394
   1395	TP_printk("dev = (%d,%d), ino = %lu, start = %lu nrpage = %u",
   1396		show_dev_ino(__entry),
   1397		(unsigned long)__entry->start,
   1398		__entry->nrpage)
   1399);
   1400
   1401TRACE_EVENT(f2fs_write_checkpoint,
   1402
   1403	TP_PROTO(struct super_block *sb, int reason, char *msg),
   1404
   1405	TP_ARGS(sb, reason, msg),
   1406
   1407	TP_STRUCT__entry(
   1408		__field(dev_t,	dev)
   1409		__field(int,	reason)
   1410		__field(char *,	msg)
   1411	),
   1412
   1413	TP_fast_assign(
   1414		__entry->dev		= sb->s_dev;
   1415		__entry->reason		= reason;
   1416		__entry->msg		= msg;
   1417	),
   1418
   1419	TP_printk("dev = (%d,%d), checkpoint for %s, state = %s",
   1420		show_dev(__entry->dev),
   1421		show_cpreason(__entry->reason),
   1422		__entry->msg)
   1423);
   1424
   1425DECLARE_EVENT_CLASS(f2fs_discard,
   1426
   1427	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
   1428
   1429	TP_ARGS(dev, blkstart, blklen),
   1430
   1431	TP_STRUCT__entry(
   1432		__field(dev_t,	dev)
   1433		__field(block_t, blkstart)
   1434		__field(block_t, blklen)
   1435	),
   1436
   1437	TP_fast_assign(
   1438		__entry->dev	= dev->bd_dev;
   1439		__entry->blkstart = blkstart;
   1440		__entry->blklen = blklen;
   1441	),
   1442
   1443	TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx",
   1444		show_dev(__entry->dev),
   1445		(unsigned long long)__entry->blkstart,
   1446		(unsigned long long)__entry->blklen)
   1447);
   1448
   1449DEFINE_EVENT(f2fs_discard, f2fs_queue_discard,
   1450
   1451	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
   1452
   1453	TP_ARGS(dev, blkstart, blklen)
   1454);
   1455
   1456DEFINE_EVENT(f2fs_discard, f2fs_issue_discard,
   1457
   1458	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
   1459
   1460	TP_ARGS(dev, blkstart, blklen)
   1461);
   1462
   1463DEFINE_EVENT(f2fs_discard, f2fs_remove_discard,
   1464
   1465	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
   1466
   1467	TP_ARGS(dev, blkstart, blklen)
   1468);
   1469
   1470TRACE_EVENT(f2fs_issue_reset_zone,
   1471
   1472	TP_PROTO(struct block_device *dev, block_t blkstart),
   1473
   1474	TP_ARGS(dev, blkstart),
   1475
   1476	TP_STRUCT__entry(
   1477		__field(dev_t,	dev)
   1478		__field(block_t, blkstart)
   1479	),
   1480
   1481	TP_fast_assign(
   1482		__entry->dev	= dev->bd_dev;
   1483		__entry->blkstart = blkstart;
   1484	),
   1485
   1486	TP_printk("dev = (%d,%d), reset zone at block = 0x%llx",
   1487		show_dev(__entry->dev),
   1488		(unsigned long long)__entry->blkstart)
   1489);
   1490
   1491TRACE_EVENT(f2fs_issue_flush,
   1492
   1493	TP_PROTO(struct block_device *dev, unsigned int nobarrier,
   1494				unsigned int flush_merge, int ret),
   1495
   1496	TP_ARGS(dev, nobarrier, flush_merge, ret),
   1497
   1498	TP_STRUCT__entry(
   1499		__field(dev_t,	dev)
   1500		__field(unsigned int, nobarrier)
   1501		__field(unsigned int, flush_merge)
   1502		__field(int,  ret)
   1503	),
   1504
   1505	TP_fast_assign(
   1506		__entry->dev	= dev->bd_dev;
   1507		__entry->nobarrier = nobarrier;
   1508		__entry->flush_merge = flush_merge;
   1509		__entry->ret = ret;
   1510	),
   1511
   1512	TP_printk("dev = (%d,%d), %s %s, ret = %d",
   1513		show_dev(__entry->dev),
   1514		__entry->nobarrier ? "skip (nobarrier)" : "issue",
   1515		__entry->flush_merge ? " with flush_merge" : "",
   1516		__entry->ret)
   1517);
   1518
   1519TRACE_EVENT(f2fs_lookup_extent_tree_start,
   1520
   1521	TP_PROTO(struct inode *inode, unsigned int pgofs),
   1522
   1523	TP_ARGS(inode, pgofs),
   1524
   1525	TP_STRUCT__entry(
   1526		__field(dev_t,	dev)
   1527		__field(ino_t,	ino)
   1528		__field(unsigned int, pgofs)
   1529	),
   1530
   1531	TP_fast_assign(
   1532		__entry->dev = inode->i_sb->s_dev;
   1533		__entry->ino = inode->i_ino;
   1534		__entry->pgofs = pgofs;
   1535	),
   1536
   1537	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u",
   1538		show_dev_ino(__entry),
   1539		__entry->pgofs)
   1540);
   1541
   1542TRACE_EVENT_CONDITION(f2fs_lookup_extent_tree_end,
   1543
   1544	TP_PROTO(struct inode *inode, unsigned int pgofs,
   1545						struct extent_info *ei),
   1546
   1547	TP_ARGS(inode, pgofs, ei),
   1548
   1549	TP_CONDITION(ei),
   1550
   1551	TP_STRUCT__entry(
   1552		__field(dev_t,	dev)
   1553		__field(ino_t,	ino)
   1554		__field(unsigned int, pgofs)
   1555		__field(unsigned int, fofs)
   1556		__field(u32, blk)
   1557		__field(unsigned int, len)
   1558	),
   1559
   1560	TP_fast_assign(
   1561		__entry->dev = inode->i_sb->s_dev;
   1562		__entry->ino = inode->i_ino;
   1563		__entry->pgofs = pgofs;
   1564		__entry->fofs = ei->fofs;
   1565		__entry->blk = ei->blk;
   1566		__entry->len = ei->len;
   1567	),
   1568
   1569	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
   1570		"ext_info(fofs: %u, blk: %u, len: %u)",
   1571		show_dev_ino(__entry),
   1572		__entry->pgofs,
   1573		__entry->fofs,
   1574		__entry->blk,
   1575		__entry->len)
   1576);
   1577
   1578TRACE_EVENT(f2fs_update_extent_tree_range,
   1579
   1580	TP_PROTO(struct inode *inode, unsigned int pgofs, block_t blkaddr,
   1581						unsigned int len),
   1582
   1583	TP_ARGS(inode, pgofs, blkaddr, len),
   1584
   1585	TP_STRUCT__entry(
   1586		__field(dev_t,	dev)
   1587		__field(ino_t,	ino)
   1588		__field(unsigned int, pgofs)
   1589		__field(u32, blk)
   1590		__field(unsigned int, len)
   1591	),
   1592
   1593	TP_fast_assign(
   1594		__entry->dev = inode->i_sb->s_dev;
   1595		__entry->ino = inode->i_ino;
   1596		__entry->pgofs = pgofs;
   1597		__entry->blk = blkaddr;
   1598		__entry->len = len;
   1599	),
   1600
   1601	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
   1602					"blkaddr = %u, len = %u",
   1603		show_dev_ino(__entry),
   1604		__entry->pgofs,
   1605		__entry->blk,
   1606		__entry->len)
   1607);
   1608
   1609TRACE_EVENT(f2fs_shrink_extent_tree,
   1610
   1611	TP_PROTO(struct f2fs_sb_info *sbi, unsigned int node_cnt,
   1612						unsigned int tree_cnt),
   1613
   1614	TP_ARGS(sbi, node_cnt, tree_cnt),
   1615
   1616	TP_STRUCT__entry(
   1617		__field(dev_t,	dev)
   1618		__field(unsigned int, node_cnt)
   1619		__field(unsigned int, tree_cnt)
   1620	),
   1621
   1622	TP_fast_assign(
   1623		__entry->dev = sbi->sb->s_dev;
   1624		__entry->node_cnt = node_cnt;
   1625		__entry->tree_cnt = tree_cnt;
   1626	),
   1627
   1628	TP_printk("dev = (%d,%d), shrunk: node_cnt = %u, tree_cnt = %u",
   1629		show_dev(__entry->dev),
   1630		__entry->node_cnt,
   1631		__entry->tree_cnt)
   1632);
   1633
   1634TRACE_EVENT(f2fs_destroy_extent_tree,
   1635
   1636	TP_PROTO(struct inode *inode, unsigned int node_cnt),
   1637
   1638	TP_ARGS(inode, node_cnt),
   1639
   1640	TP_STRUCT__entry(
   1641		__field(dev_t,	dev)
   1642		__field(ino_t,	ino)
   1643		__field(unsigned int, node_cnt)
   1644	),
   1645
   1646	TP_fast_assign(
   1647		__entry->dev = inode->i_sb->s_dev;
   1648		__entry->ino = inode->i_ino;
   1649		__entry->node_cnt = node_cnt;
   1650	),
   1651
   1652	TP_printk("dev = (%d,%d), ino = %lu, destroyed: node_cnt = %u",
   1653		show_dev_ino(__entry),
   1654		__entry->node_cnt)
   1655);
   1656
   1657DECLARE_EVENT_CLASS(f2fs_sync_dirty_inodes,
   1658
   1659	TP_PROTO(struct super_block *sb, int type, s64 count),
   1660
   1661	TP_ARGS(sb, type, count),
   1662
   1663	TP_STRUCT__entry(
   1664		__field(dev_t, dev)
   1665		__field(int, type)
   1666		__field(s64, count)
   1667	),
   1668
   1669	TP_fast_assign(
   1670		__entry->dev	= sb->s_dev;
   1671		__entry->type	= type;
   1672		__entry->count	= count;
   1673	),
   1674
   1675	TP_printk("dev = (%d,%d), %s, dirty count = %lld",
   1676		show_dev(__entry->dev),
   1677		show_file_type(__entry->type),
   1678		__entry->count)
   1679);
   1680
   1681DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_enter,
   1682
   1683	TP_PROTO(struct super_block *sb, int type, s64 count),
   1684
   1685	TP_ARGS(sb, type, count)
   1686);
   1687
   1688DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_exit,
   1689
   1690	TP_PROTO(struct super_block *sb, int type, s64 count),
   1691
   1692	TP_ARGS(sb, type, count)
   1693);
   1694
   1695TRACE_EVENT(f2fs_shutdown,
   1696
   1697	TP_PROTO(struct f2fs_sb_info *sbi, unsigned int mode, int ret),
   1698
   1699	TP_ARGS(sbi, mode, ret),
   1700
   1701	TP_STRUCT__entry(
   1702		__field(dev_t,	dev)
   1703		__field(unsigned int, mode)
   1704		__field(int, ret)
   1705	),
   1706
   1707	TP_fast_assign(
   1708		__entry->dev = sbi->sb->s_dev;
   1709		__entry->mode = mode;
   1710		__entry->ret = ret;
   1711	),
   1712
   1713	TP_printk("dev = (%d,%d), mode: %s, ret:%d",
   1714		show_dev(__entry->dev),
   1715		show_shutdown_mode(__entry->mode),
   1716		__entry->ret)
   1717);
   1718
   1719DECLARE_EVENT_CLASS(f2fs_zip_start,
   1720
   1721	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
   1722			unsigned int cluster_size, unsigned char algtype),
   1723
   1724	TP_ARGS(inode, cluster_idx, cluster_size, algtype),
   1725
   1726	TP_STRUCT__entry(
   1727		__field(dev_t,	dev)
   1728		__field(ino_t,	ino)
   1729		__field(pgoff_t, idx)
   1730		__field(unsigned int, size)
   1731		__field(unsigned int, algtype)
   1732	),
   1733
   1734	TP_fast_assign(
   1735		__entry->dev = inode->i_sb->s_dev;
   1736		__entry->ino = inode->i_ino;
   1737		__entry->idx = cluster_idx;
   1738		__entry->size = cluster_size;
   1739		__entry->algtype = algtype;
   1740	),
   1741
   1742	TP_printk("dev = (%d,%d), ino = %lu, cluster_idx:%lu, "
   1743		"cluster_size = %u, algorithm = %s",
   1744		show_dev_ino(__entry),
   1745		__entry->idx,
   1746		__entry->size,
   1747		show_compress_algorithm(__entry->algtype))
   1748);
   1749
   1750DECLARE_EVENT_CLASS(f2fs_zip_end,
   1751
   1752	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
   1753			unsigned int compressed_size, int ret),
   1754
   1755	TP_ARGS(inode, cluster_idx, compressed_size, ret),
   1756
   1757	TP_STRUCT__entry(
   1758		__field(dev_t,	dev)
   1759		__field(ino_t,	ino)
   1760		__field(pgoff_t, idx)
   1761		__field(unsigned int, size)
   1762		__field(unsigned int, ret)
   1763	),
   1764
   1765	TP_fast_assign(
   1766		__entry->dev = inode->i_sb->s_dev;
   1767		__entry->ino = inode->i_ino;
   1768		__entry->idx = cluster_idx;
   1769		__entry->size = compressed_size;
   1770		__entry->ret = ret;
   1771	),
   1772
   1773	TP_printk("dev = (%d,%d), ino = %lu, cluster_idx:%lu, "
   1774		"compressed_size = %u, ret = %d",
   1775		show_dev_ino(__entry),
   1776		__entry->idx,
   1777		__entry->size,
   1778		__entry->ret)
   1779);
   1780
   1781DEFINE_EVENT(f2fs_zip_start, f2fs_compress_pages_start,
   1782
   1783	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
   1784		unsigned int cluster_size, unsigned char algtype),
   1785
   1786	TP_ARGS(inode, cluster_idx, cluster_size, algtype)
   1787);
   1788
   1789DEFINE_EVENT(f2fs_zip_start, f2fs_decompress_pages_start,
   1790
   1791	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
   1792		unsigned int cluster_size, unsigned char algtype),
   1793
   1794	TP_ARGS(inode, cluster_idx, cluster_size, algtype)
   1795);
   1796
   1797DEFINE_EVENT(f2fs_zip_end, f2fs_compress_pages_end,
   1798
   1799	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
   1800			unsigned int compressed_size, int ret),
   1801
   1802	TP_ARGS(inode, cluster_idx, compressed_size, ret)
   1803);
   1804
   1805DEFINE_EVENT(f2fs_zip_end, f2fs_decompress_pages_end,
   1806
   1807	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
   1808			unsigned int compressed_size, int ret),
   1809
   1810	TP_ARGS(inode, cluster_idx, compressed_size, ret)
   1811);
   1812
   1813#ifdef CONFIG_F2FS_IOSTAT
   1814TRACE_EVENT(f2fs_iostat,
   1815
   1816	TP_PROTO(struct f2fs_sb_info *sbi, unsigned long long *iostat),
   1817
   1818	TP_ARGS(sbi, iostat),
   1819
   1820	TP_STRUCT__entry(
   1821		__field(dev_t,	dev)
   1822		__field(unsigned long long,	app_dio)
   1823		__field(unsigned long long,	app_bio)
   1824		__field(unsigned long long,	app_wio)
   1825		__field(unsigned long long,	app_mio)
   1826		__field(unsigned long long,	fs_dio)
   1827		__field(unsigned long long,	fs_nio)
   1828		__field(unsigned long long,	fs_mio)
   1829		__field(unsigned long long,	fs_gc_dio)
   1830		__field(unsigned long long,	fs_gc_nio)
   1831		__field(unsigned long long,	fs_cp_dio)
   1832		__field(unsigned long long,	fs_cp_nio)
   1833		__field(unsigned long long,	fs_cp_mio)
   1834		__field(unsigned long long,	app_drio)
   1835		__field(unsigned long long,	app_brio)
   1836		__field(unsigned long long,	app_rio)
   1837		__field(unsigned long long,	app_mrio)
   1838		__field(unsigned long long,	fs_drio)
   1839		__field(unsigned long long,	fs_gdrio)
   1840		__field(unsigned long long,	fs_cdrio)
   1841		__field(unsigned long long,	fs_nrio)
   1842		__field(unsigned long long,	fs_mrio)
   1843		__field(unsigned long long,	fs_discard)
   1844	),
   1845
   1846	TP_fast_assign(
   1847		__entry->dev		= sbi->sb->s_dev;
   1848		__entry->app_dio	= iostat[APP_DIRECT_IO];
   1849		__entry->app_bio	= iostat[APP_BUFFERED_IO];
   1850		__entry->app_wio	= iostat[APP_WRITE_IO];
   1851		__entry->app_mio	= iostat[APP_MAPPED_IO];
   1852		__entry->fs_dio		= iostat[FS_DATA_IO];
   1853		__entry->fs_nio		= iostat[FS_NODE_IO];
   1854		__entry->fs_mio		= iostat[FS_META_IO];
   1855		__entry->fs_gc_dio	= iostat[FS_GC_DATA_IO];
   1856		__entry->fs_gc_nio	= iostat[FS_GC_NODE_IO];
   1857		__entry->fs_cp_dio	= iostat[FS_CP_DATA_IO];
   1858		__entry->fs_cp_nio	= iostat[FS_CP_NODE_IO];
   1859		__entry->fs_cp_mio	= iostat[FS_CP_META_IO];
   1860		__entry->app_drio	= iostat[APP_DIRECT_READ_IO];
   1861		__entry->app_brio	= iostat[APP_BUFFERED_READ_IO];
   1862		__entry->app_rio	= iostat[APP_READ_IO];
   1863		__entry->app_mrio	= iostat[APP_MAPPED_READ_IO];
   1864		__entry->fs_drio	= iostat[FS_DATA_READ_IO];
   1865		__entry->fs_gdrio	= iostat[FS_GDATA_READ_IO];
   1866		__entry->fs_cdrio	= iostat[FS_CDATA_READ_IO];
   1867		__entry->fs_nrio	= iostat[FS_NODE_READ_IO];
   1868		__entry->fs_mrio	= iostat[FS_META_READ_IO];
   1869		__entry->fs_discard	= iostat[FS_DISCARD];
   1870	),
   1871
   1872	TP_printk("dev = (%d,%d), "
   1873		"app [write=%llu (direct=%llu, buffered=%llu), mapped=%llu], "
   1874		"fs [data=%llu, node=%llu, meta=%llu, discard=%llu], "
   1875		"gc [data=%llu, node=%llu], "
   1876		"cp [data=%llu, node=%llu, meta=%llu], "
   1877		"app [read=%llu (direct=%llu, buffered=%llu), mapped=%llu], "
   1878		"fs [data=%llu, (gc_data=%llu, compr_data=%llu), "
   1879		"node=%llu, meta=%llu]",
   1880		show_dev(__entry->dev), __entry->app_wio, __entry->app_dio,
   1881		__entry->app_bio, __entry->app_mio, __entry->fs_dio,
   1882		__entry->fs_nio, __entry->fs_mio, __entry->fs_discard,
   1883		__entry->fs_gc_dio, __entry->fs_gc_nio, __entry->fs_cp_dio,
   1884		__entry->fs_cp_nio, __entry->fs_cp_mio,
   1885		__entry->app_rio, __entry->app_drio, __entry->app_brio,
   1886		__entry->app_mrio, __entry->fs_drio, __entry->fs_gdrio,
   1887		__entry->fs_cdrio, __entry->fs_nrio, __entry->fs_mrio)
   1888);
   1889
   1890#ifndef __F2FS_IOSTAT_LATENCY_TYPE
   1891#define __F2FS_IOSTAT_LATENCY_TYPE
   1892struct f2fs_iostat_latency {
   1893	unsigned int peak_lat;
   1894	unsigned int avg_lat;
   1895	unsigned int cnt;
   1896};
   1897#endif /* __F2FS_IOSTAT_LATENCY_TYPE */
   1898
   1899TRACE_EVENT(f2fs_iostat_latency,
   1900
   1901	TP_PROTO(struct f2fs_sb_info *sbi, struct f2fs_iostat_latency (*iostat_lat)[NR_PAGE_TYPE]),
   1902
   1903	TP_ARGS(sbi, iostat_lat),
   1904
   1905	TP_STRUCT__entry(
   1906		__field(dev_t,	dev)
   1907		__field(unsigned int,	d_rd_peak)
   1908		__field(unsigned int,	d_rd_avg)
   1909		__field(unsigned int,	d_rd_cnt)
   1910		__field(unsigned int,	n_rd_peak)
   1911		__field(unsigned int,	n_rd_avg)
   1912		__field(unsigned int,	n_rd_cnt)
   1913		__field(unsigned int,	m_rd_peak)
   1914		__field(unsigned int,	m_rd_avg)
   1915		__field(unsigned int,	m_rd_cnt)
   1916		__field(unsigned int,	d_wr_s_peak)
   1917		__field(unsigned int,	d_wr_s_avg)
   1918		__field(unsigned int,	d_wr_s_cnt)
   1919		__field(unsigned int,	n_wr_s_peak)
   1920		__field(unsigned int,	n_wr_s_avg)
   1921		__field(unsigned int,	n_wr_s_cnt)
   1922		__field(unsigned int,	m_wr_s_peak)
   1923		__field(unsigned int,	m_wr_s_avg)
   1924		__field(unsigned int,	m_wr_s_cnt)
   1925		__field(unsigned int,	d_wr_as_peak)
   1926		__field(unsigned int,	d_wr_as_avg)
   1927		__field(unsigned int,	d_wr_as_cnt)
   1928		__field(unsigned int,	n_wr_as_peak)
   1929		__field(unsigned int,	n_wr_as_avg)
   1930		__field(unsigned int,	n_wr_as_cnt)
   1931		__field(unsigned int,	m_wr_as_peak)
   1932		__field(unsigned int,	m_wr_as_avg)
   1933		__field(unsigned int,	m_wr_as_cnt)
   1934	),
   1935
   1936	TP_fast_assign(
   1937		__entry->dev		= sbi->sb->s_dev;
   1938		__entry->d_rd_peak	= iostat_lat[0][DATA].peak_lat;
   1939		__entry->d_rd_avg	= iostat_lat[0][DATA].avg_lat;
   1940		__entry->d_rd_cnt	= iostat_lat[0][DATA].cnt;
   1941		__entry->n_rd_peak	= iostat_lat[0][NODE].peak_lat;
   1942		__entry->n_rd_avg	= iostat_lat[0][NODE].avg_lat;
   1943		__entry->n_rd_cnt	= iostat_lat[0][NODE].cnt;
   1944		__entry->m_rd_peak	= iostat_lat[0][META].peak_lat;
   1945		__entry->m_rd_avg	= iostat_lat[0][META].avg_lat;
   1946		__entry->m_rd_cnt	= iostat_lat[0][META].cnt;
   1947		__entry->d_wr_s_peak	= iostat_lat[1][DATA].peak_lat;
   1948		__entry->d_wr_s_avg	= iostat_lat[1][DATA].avg_lat;
   1949		__entry->d_wr_s_cnt	= iostat_lat[1][DATA].cnt;
   1950		__entry->n_wr_s_peak	= iostat_lat[1][NODE].peak_lat;
   1951		__entry->n_wr_s_avg	= iostat_lat[1][NODE].avg_lat;
   1952		__entry->n_wr_s_cnt	= iostat_lat[1][NODE].cnt;
   1953		__entry->m_wr_s_peak	= iostat_lat[1][META].peak_lat;
   1954		__entry->m_wr_s_avg	= iostat_lat[1][META].avg_lat;
   1955		__entry->m_wr_s_cnt	= iostat_lat[1][META].cnt;
   1956		__entry->d_wr_as_peak	= iostat_lat[2][DATA].peak_lat;
   1957		__entry->d_wr_as_avg	= iostat_lat[2][DATA].avg_lat;
   1958		__entry->d_wr_as_cnt	= iostat_lat[2][DATA].cnt;
   1959		__entry->n_wr_as_peak	= iostat_lat[2][NODE].peak_lat;
   1960		__entry->n_wr_as_avg	= iostat_lat[2][NODE].avg_lat;
   1961		__entry->n_wr_as_cnt	= iostat_lat[2][NODE].cnt;
   1962		__entry->m_wr_as_peak	= iostat_lat[2][META].peak_lat;
   1963		__entry->m_wr_as_avg	= iostat_lat[2][META].avg_lat;
   1964		__entry->m_wr_as_cnt	= iostat_lat[2][META].cnt;
   1965	),
   1966
   1967	TP_printk("dev = (%d,%d), "
   1968		"iotype [peak lat.(ms)/avg lat.(ms)/count], "
   1969		"rd_data [%u/%u/%u], rd_node [%u/%u/%u], rd_meta [%u/%u/%u], "
   1970		"wr_sync_data [%u/%u/%u], wr_sync_node [%u/%u/%u], "
   1971		"wr_sync_meta [%u/%u/%u], wr_async_data [%u/%u/%u], "
   1972		"wr_async_node [%u/%u/%u], wr_async_meta [%u/%u/%u]",
   1973		show_dev(__entry->dev),
   1974		__entry->d_rd_peak, __entry->d_rd_avg, __entry->d_rd_cnt,
   1975		__entry->n_rd_peak, __entry->n_rd_avg, __entry->n_rd_cnt,
   1976		__entry->m_rd_peak, __entry->m_rd_avg, __entry->m_rd_cnt,
   1977		__entry->d_wr_s_peak, __entry->d_wr_s_avg, __entry->d_wr_s_cnt,
   1978		__entry->n_wr_s_peak, __entry->n_wr_s_avg, __entry->n_wr_s_cnt,
   1979		__entry->m_wr_s_peak, __entry->m_wr_s_avg, __entry->m_wr_s_cnt,
   1980		__entry->d_wr_as_peak, __entry->d_wr_as_avg, __entry->d_wr_as_cnt,
   1981		__entry->n_wr_as_peak, __entry->n_wr_as_avg, __entry->n_wr_as_cnt,
   1982		__entry->m_wr_as_peak, __entry->m_wr_as_avg, __entry->m_wr_as_cnt)
   1983);
   1984#endif
   1985
   1986TRACE_EVENT(f2fs_bmap,
   1987
   1988	TP_PROTO(struct inode *inode, sector_t lblock, sector_t pblock),
   1989
   1990	TP_ARGS(inode, lblock, pblock),
   1991
   1992	TP_STRUCT__entry(
   1993		__field(dev_t, dev)
   1994		__field(ino_t, ino)
   1995		__field(sector_t, lblock)
   1996		__field(sector_t, pblock)
   1997	),
   1998
   1999	TP_fast_assign(
   2000		__entry->dev		= inode->i_sb->s_dev;
   2001		__entry->ino		= inode->i_ino;
   2002		__entry->lblock		= lblock;
   2003		__entry->pblock		= pblock;
   2004	),
   2005
   2006	TP_printk("dev = (%d,%d), ino = %lu, lblock:%lld, pblock:%lld",
   2007		show_dev_ino(__entry),
   2008		(unsigned long long)__entry->lblock,
   2009		(unsigned long long)__entry->pblock)
   2010);
   2011
   2012TRACE_EVENT(f2fs_fiemap,
   2013
   2014	TP_PROTO(struct inode *inode, sector_t lblock, sector_t pblock,
   2015		unsigned long long len, unsigned int flags, int ret),
   2016
   2017	TP_ARGS(inode, lblock, pblock, len, flags, ret),
   2018
   2019	TP_STRUCT__entry(
   2020		__field(dev_t, dev)
   2021		__field(ino_t, ino)
   2022		__field(sector_t, lblock)
   2023		__field(sector_t, pblock)
   2024		__field(unsigned long long, len)
   2025		__field(unsigned int, flags)
   2026		__field(int, ret)
   2027	),
   2028
   2029	TP_fast_assign(
   2030		__entry->dev		= inode->i_sb->s_dev;
   2031		__entry->ino		= inode->i_ino;
   2032		__entry->lblock		= lblock;
   2033		__entry->pblock		= pblock;
   2034		__entry->len		= len;
   2035		__entry->flags		= flags;
   2036		__entry->ret		= ret;
   2037	),
   2038
   2039	TP_printk("dev = (%d,%d), ino = %lu, lblock:%lld, pblock:%lld, "
   2040		"len:%llu, flags:%u, ret:%d",
   2041		show_dev_ino(__entry),
   2042		(unsigned long long)__entry->lblock,
   2043		(unsigned long long)__entry->pblock,
   2044		__entry->len,
   2045		__entry->flags,
   2046		__entry->ret)
   2047);
   2048
   2049DECLARE_EVENT_CLASS(f2fs__rw_start,
   2050
   2051	TP_PROTO(struct inode *inode, loff_t offset, int bytes,
   2052			pid_t pid, char *pathname, char *command),
   2053
   2054	TP_ARGS(inode, offset, bytes, pid, pathname, command),
   2055
   2056	TP_STRUCT__entry(
   2057		__string(pathbuf, pathname)
   2058		__field(loff_t, offset)
   2059		__field(int, bytes)
   2060		__field(loff_t, i_size)
   2061		__string(cmdline, command)
   2062		__field(pid_t, pid)
   2063		__field(ino_t, ino)
   2064	),
   2065
   2066	TP_fast_assign(
   2067		/*
   2068		 * Replace the spaces in filenames and cmdlines
   2069		 * because this screws up the tooling that parses
   2070		 * the traces.
   2071		 */
   2072		__assign_str(pathbuf, pathname);
   2073		(void)strreplace(__get_str(pathbuf), ' ', '_');
   2074		__entry->offset = offset;
   2075		__entry->bytes = bytes;
   2076		__entry->i_size = i_size_read(inode);
   2077		__assign_str(cmdline, command);
   2078		(void)strreplace(__get_str(cmdline), ' ', '_');
   2079		__entry->pid = pid;
   2080		__entry->ino = inode->i_ino;
   2081	),
   2082
   2083	TP_printk("entry_name %s, offset %llu, bytes %d, cmdline %s,"
   2084		" pid %d, i_size %llu, ino %lu",
   2085		__get_str(pathbuf), __entry->offset, __entry->bytes,
   2086		__get_str(cmdline), __entry->pid, __entry->i_size,
   2087		(unsigned long) __entry->ino)
   2088);
   2089
   2090DECLARE_EVENT_CLASS(f2fs__rw_end,
   2091
   2092	TP_PROTO(struct inode *inode, loff_t offset, int bytes),
   2093
   2094	TP_ARGS(inode, offset, bytes),
   2095
   2096	TP_STRUCT__entry(
   2097		__field(ino_t,	ino)
   2098		__field(loff_t,	offset)
   2099		__field(int,	bytes)
   2100	),
   2101
   2102	TP_fast_assign(
   2103		__entry->ino		= inode->i_ino;
   2104		__entry->offset		= offset;
   2105		__entry->bytes		= bytes;
   2106	),
   2107
   2108	TP_printk("ino %lu, offset %llu, bytes %d",
   2109		(unsigned long) __entry->ino,
   2110		__entry->offset, __entry->bytes)
   2111);
   2112
   2113DEFINE_EVENT(f2fs__rw_start, f2fs_dataread_start,
   2114
   2115	TP_PROTO(struct inode *inode, loff_t offset, int bytes,
   2116		pid_t pid, char *pathname, char *command),
   2117
   2118	TP_ARGS(inode, offset, bytes, pid, pathname, command)
   2119);
   2120
   2121DEFINE_EVENT(f2fs__rw_end, f2fs_dataread_end,
   2122
   2123	TP_PROTO(struct inode *inode, loff_t offset, int bytes),
   2124
   2125	TP_ARGS(inode, offset, bytes)
   2126);
   2127
   2128DEFINE_EVENT(f2fs__rw_start, f2fs_datawrite_start,
   2129
   2130	TP_PROTO(struct inode *inode, loff_t offset, int bytes,
   2131		pid_t pid, char *pathname, char *command),
   2132
   2133	TP_ARGS(inode, offset, bytes, pid, pathname, command)
   2134);
   2135
   2136DEFINE_EVENT(f2fs__rw_end, f2fs_datawrite_end,
   2137
   2138	TP_PROTO(struct inode *inode, loff_t offset, int bytes),
   2139
   2140	TP_ARGS(inode, offset, bytes)
   2141);
   2142
   2143#endif /* _TRACE_F2FS_H */
   2144
   2145 /* This part must be outside protection */
   2146#include <trace/define_trace.h>