Linux Audio

Check our new training course

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