f2fs.h 49.0 KB
Newer Older
1
/* SPDX-License-Identifier: GPL-2.0 */
2 3 4 5 6 7 8
#undef TRACE_SYSTEM
#define TRACE_SYSTEM f2fs

#if !defined(_TRACE_F2FS_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_F2FS_H

#include <linux/tracepoint.h>
9
#include <uapi/linux/f2fs.h>
10

11 12
#define show_dev(dev)		MAJOR(dev), MINOR(dev)
#define show_dev_ino(entry)	show_dev(entry->dev), (unsigned long)entry->ino
13

14 15 16 17
TRACE_DEFINE_ENUM(NODE);
TRACE_DEFINE_ENUM(DATA);
TRACE_DEFINE_ENUM(META);
TRACE_DEFINE_ENUM(META_FLUSH);
18 19
TRACE_DEFINE_ENUM(INMEM);
TRACE_DEFINE_ENUM(INMEM_DROP);
20
TRACE_DEFINE_ENUM(INMEM_INVALIDATE);
21
TRACE_DEFINE_ENUM(INMEM_REVOKE);
22 23
TRACE_DEFINE_ENUM(IPU);
TRACE_DEFINE_ENUM(OPU);
J
Jaegeuk Kim 已提交
24 25 26
TRACE_DEFINE_ENUM(HOT);
TRACE_DEFINE_ENUM(WARM);
TRACE_DEFINE_ENUM(COLD);
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
TRACE_DEFINE_ENUM(CURSEG_HOT_DATA);
TRACE_DEFINE_ENUM(CURSEG_WARM_DATA);
TRACE_DEFINE_ENUM(CURSEG_COLD_DATA);
TRACE_DEFINE_ENUM(CURSEG_HOT_NODE);
TRACE_DEFINE_ENUM(CURSEG_WARM_NODE);
TRACE_DEFINE_ENUM(CURSEG_COLD_NODE);
TRACE_DEFINE_ENUM(NO_CHECK_TYPE);
TRACE_DEFINE_ENUM(GC_GREEDY);
TRACE_DEFINE_ENUM(GC_CB);
TRACE_DEFINE_ENUM(FG_GC);
TRACE_DEFINE_ENUM(BG_GC);
TRACE_DEFINE_ENUM(LFS);
TRACE_DEFINE_ENUM(SSR);
TRACE_DEFINE_ENUM(__REQ_RAHEAD);
TRACE_DEFINE_ENUM(__REQ_SYNC);
42
TRACE_DEFINE_ENUM(__REQ_IDLE);
43
TRACE_DEFINE_ENUM(__REQ_PREFLUSH);
44 45 46 47 48 49
TRACE_DEFINE_ENUM(__REQ_FUA);
TRACE_DEFINE_ENUM(__REQ_PRIO);
TRACE_DEFINE_ENUM(__REQ_META);
TRACE_DEFINE_ENUM(CP_UMOUNT);
TRACE_DEFINE_ENUM(CP_FASTBOOT);
TRACE_DEFINE_ENUM(CP_SYNC);
50
TRACE_DEFINE_ENUM(CP_RECOVERY);
51
TRACE_DEFINE_ENUM(CP_DISCARD);
52
TRACE_DEFINE_ENUM(CP_TRIMMED);
53
TRACE_DEFINE_ENUM(CP_PAUSE);
54
TRACE_DEFINE_ENUM(CP_RESIZE);
55

56 57 58 59 60
#define show_block_type(type)						\
	__print_symbolic(type,						\
		{ NODE,		"NODE" },				\
		{ DATA,		"DATA" },				\
		{ META,		"META" },				\
61 62 63
		{ META_FLUSH,	"META_FLUSH" },				\
		{ INMEM,	"INMEM" },				\
		{ INMEM_DROP,	"INMEM_DROP" },				\
64
		{ INMEM_INVALIDATE,	"INMEM_INVALIDATE" },		\
65
		{ INMEM_REVOKE,	"INMEM_REVOKE" },			\
66 67
		{ IPU,		"IN-PLACE" },				\
		{ OPU,		"OUT-OF-PLACE" })
68

J
Jaegeuk Kim 已提交
69 70 71 72 73 74
#define show_block_temp(temp)						\
	__print_symbolic(temp,						\
		{ HOT,		"HOT" },				\
		{ WARM,		"WARM" },				\
		{ COLD,		"COLD" })

75 76
#define F2FS_OP_FLAGS (REQ_RAHEAD | REQ_SYNC | REQ_META | REQ_PRIO |	\
			REQ_PREFLUSH | REQ_FUA)
77 78 79 80 81
#define F2FS_BIO_FLAG_MASK(t)	(t & F2FS_OP_FLAGS)

#define show_bio_type(op,op_flags)	show_bio_op(op),		\
						show_bio_op_flags(op_flags)

82
#define show_bio_op(op)		blk_op_str(op)
M
Mike Christie 已提交
83 84

#define show_bio_op_flags(flags)					\
85 86 87 88 89 90 91
	__print_flags(F2FS_BIO_FLAG_MASK(flags), "|",			\
		{ REQ_RAHEAD,		"R" },				\
		{ REQ_SYNC,		"S" },				\
		{ REQ_META,		"M" },				\
		{ REQ_PRIO,		"P" },				\
		{ REQ_PREFLUSH,		"PF" },				\
		{ REQ_FUA,		"FUA" })
92

93 94 95 96 97 98 99 100 101 102
#define show_data_type(type)						\
	__print_symbolic(type,						\
		{ CURSEG_HOT_DATA, 	"Hot DATA" },			\
		{ CURSEG_WARM_DATA, 	"Warm DATA" },			\
		{ CURSEG_COLD_DATA, 	"Cold DATA" },			\
		{ CURSEG_HOT_NODE, 	"Hot NODE" },			\
		{ CURSEG_WARM_NODE, 	"Warm NODE" },			\
		{ CURSEG_COLD_NODE, 	"Cold NODE" },			\
		{ NO_CHECK_TYPE, 	"No TYPE" })

103 104 105 106 107
#define show_file_type(type)						\
	__print_symbolic(type,						\
		{ 0,		"FILE" },				\
		{ 1,		"DIR" })

108 109 110 111 112 113 114
#define show_gc_type(type)						\
	__print_symbolic(type,						\
		{ FG_GC,	"Foreground GC" },			\
		{ BG_GC,	"Background GC" })

#define show_alloc_mode(type)						\
	__print_symbolic(type,						\
115 116 117
		{ LFS,		"LFS-mode" },				\
		{ SSR,		"SSR-mode" },				\
		{ AT_SSR,	"AT_SSR-mode" })
118 119 120 121

#define show_victim_policy(type)					\
	__print_symbolic(type,						\
		{ GC_GREEDY,	"Greedy" },				\
122 123
		{ GC_CB,	"Cost-Benefit" },			\
		{ GC_AT,	"Age-threshold" })
124

125
#define show_cpreason(type)						\
126
	__print_flags(type, "|",					\
127
		{ CP_UMOUNT,	"Umount" },				\
128
		{ CP_FASTBOOT,	"Fastboot" },				\
129
		{ CP_SYNC,	"Sync" },				\
130
		{ CP_RECOVERY,	"Recovery" },				\
131
		{ CP_DISCARD,	"Discard" },				\
132
		{ CP_PAUSE,	"Pause" },				\
133 134
		{ CP_TRIMMED,	"Trimmed" },				\
		{ CP_RESIZE,	"Resize" })
135

C
Chao Yu 已提交
136 137 138 139
#define show_fsync_cpreason(type)					\
	__print_symbolic(type,						\
		{ CP_NO_NEEDED,		"no needed" },			\
		{ CP_NON_REGULAR,	"non regular" },		\
C
Chao Yu 已提交
140
		{ CP_COMPRESSED,	"compressed" },			\
C
Chao Yu 已提交
141 142 143 144 145 146
		{ CP_HARDLINK,		"hardlink" },			\
		{ CP_SB_NEED_CP,	"sb needs cp" },		\
		{ CP_WRONG_PINO,	"wrong pino" },			\
		{ CP_NO_SPC_ROLL,	"no space roll forward" },	\
		{ CP_NODE_NEED_CP,	"node needs cp" },		\
		{ CP_FASTBOOT_MODE,	"fastboot mode" },		\
147 148
		{ CP_SPEC_LOG_NUM,	"log type is 2" },		\
		{ CP_RECOVER_DIR,	"dir needs recovery" })
C
Chao Yu 已提交
149

C
Chao Yu 已提交
150 151 152 153 154 155 156 157
#define show_shutdown_mode(type)					\
	__print_symbolic(type,						\
		{ F2FS_GOING_DOWN_FULLSYNC,	"full sync" },		\
		{ F2FS_GOING_DOWN_METASYNC,	"meta sync" },		\
		{ F2FS_GOING_DOWN_NOSYNC,	"no sync" },		\
		{ F2FS_GOING_DOWN_METAFLUSH,	"meta flush" },		\
		{ F2FS_GOING_DOWN_NEED_FSCK,	"need fsck" })

C
Chao Yu 已提交
158 159 160
#define show_compress_algorithm(type)					\
	__print_symbolic(type,						\
		{ COMPRESS_LZO,		"LZO" },			\
161
		{ COMPRESS_LZ4,		"LZ4" },			\
162 163
		{ COMPRESS_ZSTD,	"ZSTD" },			\
		{ COMPRESS_LZORLE,	"LZO-RLE" })
C
Chao Yu 已提交
164

165 166 167
struct f2fs_sb_info;
struct f2fs_io_info;
struct extent_info;
168
struct victim_sel_policy;
J
Jaegeuk Kim 已提交
169
struct f2fs_map_blocks;
170

171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
DECLARE_EVENT_CLASS(f2fs__inode,

	TP_PROTO(struct inode *inode),

	TP_ARGS(inode),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(ino_t,	pino)
		__field(umode_t, mode)
		__field(loff_t,	size)
		__field(unsigned int, nlink)
		__field(blkcnt_t, blocks)
		__field(__u8,	advise)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
		__entry->pino	= F2FS_I(inode)->i_pino;
		__entry->mode	= inode->i_mode;
		__entry->nlink	= inode->i_nlink;
		__entry->size	= inode->i_size;
		__entry->blocks	= inode->i_blocks;
		__entry->advise	= F2FS_I(inode)->i_advise;
	),

	TP_printk("dev = (%d,%d), ino = %lu, pino = %lu, i_mode = 0x%hx, "
		"i_size = %lld, i_nlink = %u, i_blocks = %llu, i_advise = 0x%x",
		show_dev_ino(__entry),
		(unsigned long)__entry->pino,
		__entry->mode,
		__entry->size,
		(unsigned int)__entry->nlink,
		(unsigned long long)__entry->blocks,
		(unsigned char)__entry->advise)
);

DECLARE_EVENT_CLASS(f2fs__inode_exit,

	TP_PROTO(struct inode *inode, int ret),

	TP_ARGS(inode, ret),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(int,	ret)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
		__entry->ret	= ret;
	),

	TP_printk("dev = (%d,%d), ino = %lu, ret = %d",
		show_dev_ino(__entry),
		__entry->ret)
);

DEFINE_EVENT(f2fs__inode, f2fs_sync_file_enter,

	TP_PROTO(struct inode *inode),

	TP_ARGS(inode)
);

TRACE_EVENT(f2fs_sync_file_exit,

C
Chao Yu 已提交
242
	TP_PROTO(struct inode *inode, int cp_reason, int datasync, int ret),
243

C
Chao Yu 已提交
244
	TP_ARGS(inode, cp_reason, datasync, ret),
245 246 247 248

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
C
Chao Yu 已提交
249
		__field(int,	cp_reason)
250 251 252 253 254 255 256
		__field(int,	datasync)
		__field(int,	ret)
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
		__entry->ino		= inode->i_ino;
C
Chao Yu 已提交
257
		__entry->cp_reason	= cp_reason;
258 259 260 261
		__entry->datasync	= datasync;
		__entry->ret		= ret;
	),

C
Chao Yu 已提交
262
	TP_printk("dev = (%d,%d), ino = %lu, cp_reason: %s, "
263 264
		"datasync = %d, ret = %d",
		show_dev_ino(__entry),
C
Chao Yu 已提交
265
		show_fsync_cpreason(__entry->cp_reason),
266 267 268 269 270 271 272 273 274 275 276 277
		__entry->datasync,
		__entry->ret)
);

TRACE_EVENT(f2fs_sync_fs,

	TP_PROTO(struct super_block *sb, int wait),

	TP_ARGS(sb, wait),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
J
Jaegeuk Kim 已提交
278
		__field(int,	dirty)
279 280 281 282 283
		__field(int,	wait)
	),

	TP_fast_assign(
		__entry->dev	= sb->s_dev;
284
		__entry->dirty	= is_sbi_flag_set(F2FS_SB(sb), SBI_IS_DIRTY);
285 286 287 288
		__entry->wait	= wait;
	),

	TP_printk("dev = (%d,%d), superblock is %s, wait = %d",
289
		show_dev(__entry->dev),
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314
		__entry->dirty ? "dirty" : "not dirty",
		__entry->wait)
);

DEFINE_EVENT(f2fs__inode, f2fs_iget,

	TP_PROTO(struct inode *inode),

	TP_ARGS(inode)
);

DEFINE_EVENT(f2fs__inode_exit, f2fs_iget_exit,

	TP_PROTO(struct inode *inode, int ret),

	TP_ARGS(inode, ret)
);

DEFINE_EVENT(f2fs__inode, f2fs_evict_inode,

	TP_PROTO(struct inode *inode),

	TP_ARGS(inode)
);

315 316 317 318 319 320 321
DEFINE_EVENT(f2fs__inode_exit, f2fs_new_inode,

	TP_PROTO(struct inode *inode, int ret),

	TP_ARGS(inode, ret)
);

322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357
TRACE_EVENT(f2fs_unlink_enter,

	TP_PROTO(struct inode *dir, struct dentry *dentry),

	TP_ARGS(dir, dentry),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(loff_t,	size)
		__field(blkcnt_t, blocks)
		__field(const char *,	name)
	),

	TP_fast_assign(
		__entry->dev	= dir->i_sb->s_dev;
		__entry->ino	= dir->i_ino;
		__entry->size	= dir->i_size;
		__entry->blocks	= dir->i_blocks;
		__entry->name	= dentry->d_name.name;
	),

	TP_printk("dev = (%d,%d), dir ino = %lu, i_size = %lld, "
		"i_blocks = %llu, name = %s",
		show_dev_ino(__entry),
		__entry->size,
		(unsigned long long)__entry->blocks,
		__entry->name)
);

DEFINE_EVENT(f2fs__inode_exit, f2fs_unlink_exit,

	TP_PROTO(struct inode *inode, int ret),

	TP_ARGS(inode, ret)
);
358

359 360 361 362 363 364 365
DEFINE_EVENT(f2fs__inode_exit, f2fs_drop_inode,

	TP_PROTO(struct inode *inode, int ret),

	TP_ARGS(inode, ret)
);

366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508
DEFINE_EVENT(f2fs__inode, f2fs_truncate,

	TP_PROTO(struct inode *inode),

	TP_ARGS(inode)
);

TRACE_EVENT(f2fs_truncate_data_blocks_range,

	TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs, int free),

	TP_ARGS(inode, nid,  ofs, free),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(nid_t,	nid)
		__field(unsigned int,	ofs)
		__field(int,	free)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
		__entry->nid	= nid;
		__entry->ofs	= ofs;
		__entry->free	= free;
	),

	TP_printk("dev = (%d,%d), ino = %lu, nid = %u, offset = %u, freed = %d",
		show_dev_ino(__entry),
		(unsigned int)__entry->nid,
		__entry->ofs,
		__entry->free)
);

DECLARE_EVENT_CLASS(f2fs__truncate_op,

	TP_PROTO(struct inode *inode, u64 from),

	TP_ARGS(inode, from),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(loff_t,	size)
		__field(blkcnt_t, blocks)
		__field(u64,	from)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
		__entry->size	= inode->i_size;
		__entry->blocks	= inode->i_blocks;
		__entry->from	= from;
	),

	TP_printk("dev = (%d,%d), ino = %lu, i_size = %lld, i_blocks = %llu, "
		"start file offset = %llu",
		show_dev_ino(__entry),
		__entry->size,
		(unsigned long long)__entry->blocks,
		(unsigned long long)__entry->from)
);

DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_blocks_enter,

	TP_PROTO(struct inode *inode, u64 from),

	TP_ARGS(inode, from)
);

DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_blocks_exit,

	TP_PROTO(struct inode *inode, int ret),

	TP_ARGS(inode, ret)
);

DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_inode_blocks_enter,

	TP_PROTO(struct inode *inode, u64 from),

	TP_ARGS(inode, from)
);

DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_inode_blocks_exit,

	TP_PROTO(struct inode *inode, int ret),

	TP_ARGS(inode, ret)
);

DECLARE_EVENT_CLASS(f2fs__truncate_node,

	TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),

	TP_ARGS(inode, nid, blk_addr),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(nid_t,	nid)
		__field(block_t,	blk_addr)
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
		__entry->ino		= inode->i_ino;
		__entry->nid		= nid;
		__entry->blk_addr	= blk_addr;
	),

	TP_printk("dev = (%d,%d), ino = %lu, nid = %u, block_address = 0x%llx",
		show_dev_ino(__entry),
		(unsigned int)__entry->nid,
		(unsigned long long)__entry->blk_addr)
);

DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_nodes_enter,

	TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),

	TP_ARGS(inode, nid, blk_addr)
);

DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_nodes_exit,

	TP_PROTO(struct inode *inode, int ret),

	TP_ARGS(inode, ret)
);

DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_node,

	TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),

	TP_ARGS(inode, nid, blk_addr)
);

TRACE_EVENT(f2fs_truncate_partial_nodes,

509
	TP_PROTO(struct inode *inode, nid_t *nid, int depth, int err),
510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540

	TP_ARGS(inode, nid, depth, err),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(nid_t,	nid[3])
		__field(int,	depth)
		__field(int,	err)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
		__entry->nid[0]	= nid[0];
		__entry->nid[1]	= nid[1];
		__entry->nid[2]	= nid[2];
		__entry->depth	= depth;
		__entry->err	= err;
	),

	TP_printk("dev = (%d,%d), ino = %lu, "
		"nid[0] = %u, nid[1] = %u, nid[2] = %u, depth = %d, err = %d",
		show_dev_ino(__entry),
		(unsigned int)__entry->nid[0],
		(unsigned int)__entry->nid[1],
		(unsigned int)__entry->nid[2],
		__entry->depth,
		__entry->err)
);

541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571
TRACE_EVENT(f2fs_file_write_iter,

	TP_PROTO(struct inode *inode, unsigned long offset,
		unsigned long length, int ret),

	TP_ARGS(inode, offset, length, ret),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(unsigned long, offset)
		__field(unsigned long, length)
		__field(int,	ret)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
		__entry->offset	= offset;
		__entry->length	= length;
		__entry->ret	= ret;
	),

	TP_printk("dev = (%d,%d), ino = %lu, "
		"offset = %lu, length = %lu, written(err) = %d",
		show_dev_ino(__entry),
		__entry->offset,
		__entry->length,
		__entry->ret)
);

J
Jaegeuk Kim 已提交
572 573
TRACE_EVENT(f2fs_map_blocks,
	TP_PROTO(struct inode *inode, struct f2fs_map_blocks *map, int ret),
574

J
Jaegeuk Kim 已提交
575
	TP_ARGS(inode, map, ret),
576 577 578 579

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
J
Jaegeuk Kim 已提交
580 581 582
		__field(block_t,	m_lblk)
		__field(block_t,	m_pblk)
		__field(unsigned int,	m_len)
583 584 585
		__field(unsigned int,	m_flags)
		__field(int,	m_seg_type)
		__field(bool,	m_may_create)
586 587 588 589 590 591
		__field(int,	ret)
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
		__entry->ino		= inode->i_ino;
J
Jaegeuk Kim 已提交
592 593 594
		__entry->m_lblk		= map->m_lblk;
		__entry->m_pblk		= map->m_pblk;
		__entry->m_len		= map->m_len;
595 596 597
		__entry->m_flags	= map->m_flags;
		__entry->m_seg_type	= map->m_seg_type;
		__entry->m_may_create	= map->m_may_create;
598 599 600 601
		__entry->ret		= ret;
	),

	TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, "
602 603
		"start blkaddr = 0x%llx, len = 0x%llx, flags = %u,"
		"seg_type = %d, may_create = %d, err = %d",
604
		show_dev_ino(__entry),
J
Jaegeuk Kim 已提交
605 606 607
		(unsigned long long)__entry->m_lblk,
		(unsigned long long)__entry->m_pblk,
		(unsigned long long)__entry->m_len,
608 609 610
		__entry->m_flags,
		__entry->m_seg_type,
		__entry->m_may_create,
611 612 613
		__entry->ret)
);

614 615
TRACE_EVENT(f2fs_background_gc,

616
	TP_PROTO(struct super_block *sb, unsigned int wait_ms,
617 618 619 620 621 622
			unsigned int prefree, unsigned int free),

	TP_ARGS(sb, wait_ms, prefree, free),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
623
		__field(unsigned int,	wait_ms)
624 625 626 627 628 629 630 631 632 633 634
		__field(unsigned int,	prefree)
		__field(unsigned int,	free)
	),

	TP_fast_assign(
		__entry->dev		= sb->s_dev;
		__entry->wait_ms	= wait_ms;
		__entry->prefree	= prefree;
		__entry->free		= free;
	),

635
	TP_printk("dev = (%d,%d), wait_ms = %u, prefree = %u, free = %u",
636
		show_dev(__entry->dev),
637 638 639 640 641
		__entry->wait_ms,
		__entry->prefree,
		__entry->free)
);

C
Chao Yu 已提交
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748
TRACE_EVENT(f2fs_gc_begin,

	TP_PROTO(struct super_block *sb, bool sync, bool background,
			long long dirty_nodes, long long dirty_dents,
			long long dirty_imeta, unsigned int free_sec,
			unsigned int free_seg, int reserved_seg,
			unsigned int prefree_seg),

	TP_ARGS(sb, sync, background, dirty_nodes, dirty_dents, dirty_imeta,
		free_sec, free_seg, reserved_seg, prefree_seg),

	TP_STRUCT__entry(
		__field(dev_t,		dev)
		__field(bool,		sync)
		__field(bool,		background)
		__field(long long,	dirty_nodes)
		__field(long long,	dirty_dents)
		__field(long long,	dirty_imeta)
		__field(unsigned int,	free_sec)
		__field(unsigned int,	free_seg)
		__field(int,		reserved_seg)
		__field(unsigned int,	prefree_seg)
	),

	TP_fast_assign(
		__entry->dev		= sb->s_dev;
		__entry->sync		= sync;
		__entry->background	= background;
		__entry->dirty_nodes	= dirty_nodes;
		__entry->dirty_dents	= dirty_dents;
		__entry->dirty_imeta	= dirty_imeta;
		__entry->free_sec	= free_sec;
		__entry->free_seg	= free_seg;
		__entry->reserved_seg	= reserved_seg;
		__entry->prefree_seg	= prefree_seg;
	),

	TP_printk("dev = (%d,%d), sync = %d, background = %d, nodes = %lld, "
		"dents = %lld, imeta = %lld, free_sec:%u, free_seg:%u, "
		"rsv_seg:%d, prefree_seg:%u",
		show_dev(__entry->dev),
		__entry->sync,
		__entry->background,
		__entry->dirty_nodes,
		__entry->dirty_dents,
		__entry->dirty_imeta,
		__entry->free_sec,
		__entry->free_seg,
		__entry->reserved_seg,
		__entry->prefree_seg)
);

TRACE_EVENT(f2fs_gc_end,

	TP_PROTO(struct super_block *sb, int ret, int seg_freed,
			int sec_freed, long long dirty_nodes,
			long long dirty_dents, long long dirty_imeta,
			unsigned int free_sec, unsigned int free_seg,
			int reserved_seg, unsigned int prefree_seg),

	TP_ARGS(sb, ret, seg_freed, sec_freed, dirty_nodes, dirty_dents,
		dirty_imeta, free_sec, free_seg, reserved_seg, prefree_seg),

	TP_STRUCT__entry(
		__field(dev_t,		dev)
		__field(int,		ret)
		__field(int,		seg_freed)
		__field(int,		sec_freed)
		__field(long long,	dirty_nodes)
		__field(long long,	dirty_dents)
		__field(long long,	dirty_imeta)
		__field(unsigned int,	free_sec)
		__field(unsigned int,	free_seg)
		__field(int,		reserved_seg)
		__field(unsigned int,	prefree_seg)
	),

	TP_fast_assign(
		__entry->dev		= sb->s_dev;
		__entry->ret		= ret;
		__entry->seg_freed	= seg_freed;
		__entry->sec_freed	= sec_freed;
		__entry->dirty_nodes	= dirty_nodes;
		__entry->dirty_dents	= dirty_dents;
		__entry->dirty_imeta	= dirty_imeta;
		__entry->free_sec	= free_sec;
		__entry->free_seg	= free_seg;
		__entry->reserved_seg	= reserved_seg;
		__entry->prefree_seg	= prefree_seg;
	),

	TP_printk("dev = (%d,%d), ret = %d, seg_freed = %d, sec_freed = %d, "
		"nodes = %lld, dents = %lld, imeta = %lld, free_sec:%u, "
		"free_seg:%u, rsv_seg:%d, prefree_seg:%u",
		show_dev(__entry->dev),
		__entry->ret,
		__entry->seg_freed,
		__entry->sec_freed,
		__entry->dirty_nodes,
		__entry->dirty_dents,
		__entry->dirty_imeta,
		__entry->free_sec,
		__entry->free_seg,
		__entry->reserved_seg,
		__entry->prefree_seg)
);

749 750 751 752 753 754 755 756 757 758 759 760 761 762 763
TRACE_EVENT(f2fs_get_victim,

	TP_PROTO(struct super_block *sb, int type, int gc_type,
			struct victim_sel_policy *p, unsigned int pre_victim,
			unsigned int prefree, unsigned int free),

	TP_ARGS(sb, type, gc_type, p, pre_victim, prefree, free),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(int,	type)
		__field(int,	gc_type)
		__field(int,	alloc_mode)
		__field(int,	gc_mode)
		__field(unsigned int,	victim)
764
		__field(unsigned int,	cost)
765 766 767 768 769 770 771 772 773 774 775 776 777
		__field(unsigned int,	ofs_unit)
		__field(unsigned int,	pre_victim)
		__field(unsigned int,	prefree)
		__field(unsigned int,	free)
	),

	TP_fast_assign(
		__entry->dev		= sb->s_dev;
		__entry->type		= type;
		__entry->gc_type	= gc_type;
		__entry->alloc_mode	= p->alloc_mode;
		__entry->gc_mode	= p->gc_mode;
		__entry->victim		= p->min_segno;
778
		__entry->cost		= p->min_cost;
779 780 781 782 783 784
		__entry->ofs_unit	= p->ofs_unit;
		__entry->pre_victim	= pre_victim;
		__entry->prefree	= prefree;
		__entry->free		= free;
	),

785 786 787
	TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), "
		"victim = %u, cost = %u, ofs_unit = %u, "
		"pre_victim_secno = %d, prefree = %u, free = %u",
788
		show_dev(__entry->dev),
789 790 791 792 793
		show_data_type(__entry->type),
		show_gc_type(__entry->gc_type),
		show_alloc_mode(__entry->alloc_mode),
		show_victim_policy(__entry->gc_mode),
		__entry->victim,
794
		__entry->cost,
795 796 797 798 799 800
		__entry->ofs_unit,
		(int)__entry->pre_victim,
		__entry->prefree,
		__entry->free)
);

C
Chao Yu 已提交
801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856
TRACE_EVENT(f2fs_lookup_start,

	TP_PROTO(struct inode *dir, struct dentry *dentry, unsigned int flags),

	TP_ARGS(dir, dentry, flags),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(const char *,	name)
		__field(unsigned int, flags)
	),

	TP_fast_assign(
		__entry->dev	= dir->i_sb->s_dev;
		__entry->ino	= dir->i_ino;
		__entry->name	= dentry->d_name.name;
		__entry->flags	= flags;
	),

	TP_printk("dev = (%d,%d), pino = %lu, name:%s, flags:%u",
		show_dev_ino(__entry),
		__entry->name,
		__entry->flags)
);

TRACE_EVENT(f2fs_lookup_end,

	TP_PROTO(struct inode *dir, struct dentry *dentry, nid_t ino,
		int err),

	TP_ARGS(dir, dentry, ino, err),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(const char *,	name)
		__field(nid_t,	cino)
		__field(int,	err)
	),

	TP_fast_assign(
		__entry->dev	= dir->i_sb->s_dev;
		__entry->ino	= dir->i_ino;
		__entry->name	= dentry->d_name.name;
		__entry->cino	= ino;
		__entry->err	= err;
	),

	TP_printk("dev = (%d,%d), pino = %lu, name:%s, ino:%u, err:%d",
		show_dev_ino(__entry),
		__entry->name,
		__entry->cino,
		__entry->err)
);

C
Chao Yu 已提交
857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885
TRACE_EVENT(f2fs_readdir,

	TP_PROTO(struct inode *dir, loff_t start_pos, loff_t end_pos, int err),

	TP_ARGS(dir, start_pos, end_pos, err),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(loff_t,	start)
		__field(loff_t,	end)
		__field(int,	err)
	),

	TP_fast_assign(
		__entry->dev	= dir->i_sb->s_dev;
		__entry->ino	= dir->i_ino;
		__entry->start	= start_pos;
		__entry->end	= end_pos;
		__entry->err	= err;
	),

	TP_printk("dev = (%d,%d), ino = %lu, start_pos:%llu, end_pos:%llu, err:%d",
		show_dev_ino(__entry),
		__entry->start,
		__entry->end,
		__entry->err)
);

886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925
TRACE_EVENT(f2fs_fallocate,

	TP_PROTO(struct inode *inode, int mode,
				loff_t offset, loff_t len, int ret),

	TP_ARGS(inode, mode, offset, len, ret),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(int,	mode)
		__field(loff_t,	offset)
		__field(loff_t,	len)
		__field(loff_t, size)
		__field(blkcnt_t, blocks)
		__field(int,	ret)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
		__entry->mode	= mode;
		__entry->offset	= offset;
		__entry->len	= len;
		__entry->size	= inode->i_size;
		__entry->blocks = inode->i_blocks;
		__entry->ret	= ret;
	),

	TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, "
		"len = %lld,  i_size = %lld, i_blocks = %llu, ret = %d",
		show_dev_ino(__entry),
		__entry->mode,
		(unsigned long long)__entry->offset,
		(unsigned long long)__entry->len,
		(unsigned long long)__entry->size,
		(unsigned long long)__entry->blocks,
		__entry->ret)
);

926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988
TRACE_EVENT(f2fs_direct_IO_enter,

	TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw),

	TP_ARGS(inode, offset, len, rw),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(loff_t,	pos)
		__field(unsigned long,	len)
		__field(int,	rw)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
		__entry->pos	= offset;
		__entry->len	= len;
		__entry->rw	= rw;
	),

	TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu rw = %d",
		show_dev_ino(__entry),
		__entry->pos,
		__entry->len,
		__entry->rw)
);

TRACE_EVENT(f2fs_direct_IO_exit,

	TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
		 int rw, int ret),

	TP_ARGS(inode, offset, len, rw, ret),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(loff_t,	pos)
		__field(unsigned long,	len)
		__field(int,	rw)
		__field(int,	ret)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
		__entry->pos	= offset;
		__entry->len	= len;
		__entry->rw	= rw;
		__entry->ret	= ret;
	),

	TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu "
		"rw = %d ret = %d",
		show_dev_ino(__entry),
		__entry->pos,
		__entry->len,
		__entry->rw,
		__entry->ret)
);

989
TRACE_EVENT(f2fs_reserve_new_blocks,
990

991 992
	TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs_in_node,
							blkcnt_t count),
993

994
	TP_ARGS(inode, nid, ofs_in_node, count),
995 996 997 998 999

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(nid_t, nid)
		__field(unsigned int, ofs_in_node)
1000
		__field(blkcnt_t, count)
1001 1002 1003 1004 1005 1006
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->nid	= nid;
		__entry->ofs_in_node = ofs_in_node;
1007
		__entry->count = count;
1008 1009
	),

1010
	TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u, count = %llu",
1011
		show_dev(__entry->dev),
1012
		(unsigned int)__entry->nid,
1013 1014
		__entry->ofs_in_node,
		(unsigned long long)__entry->count)
1015 1016
);

1017 1018
DECLARE_EVENT_CLASS(f2fs__submit_page_bio,

1019
	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
1020

1021
	TP_ARGS(page, fio),
1022 1023 1024 1025 1026

	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(ino_t, ino)
		__field(pgoff_t, index)
1027 1028
		__field(block_t, old_blkaddr)
		__field(block_t, new_blkaddr)
M
Mike Christie 已提交
1029 1030
		__field(int, op)
		__field(int, op_flags)
J
Jaegeuk Kim 已提交
1031
		__field(int, temp)
1032 1033 1034 1035
		__field(int, type)
	),

	TP_fast_assign(
J
Jaegeuk Kim 已提交
1036 1037
		__entry->dev		= page_file_mapping(page)->host->i_sb->s_dev;
		__entry->ino		= page_file_mapping(page)->host->i_ino;
1038
		__entry->index		= page->index;
1039 1040
		__entry->old_blkaddr	= fio->old_blkaddr;
		__entry->new_blkaddr	= fio->new_blkaddr;
M
Mike Christie 已提交
1041 1042
		__entry->op		= fio->op;
		__entry->op_flags	= fio->op_flags;
J
Jaegeuk Kim 已提交
1043
		__entry->temp		= fio->temp;
1044
		__entry->type		= fio->type;
1045 1046 1047
	),

	TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, "
J
Jaegeuk Kim 已提交
1048
		"oldaddr = 0x%llx, newaddr = 0x%llx, rw = %s(%s), type = %s_%s",
1049 1050
		show_dev_ino(__entry),
		(unsigned long)__entry->index,
1051 1052
		(unsigned long long)__entry->old_blkaddr,
		(unsigned long long)__entry->new_blkaddr,
1053
		show_bio_type(__entry->op, __entry->op_flags),
J
Jaegeuk Kim 已提交
1054
		show_block_temp(__entry->temp),
1055 1056 1057 1058 1059
		show_block_type(__entry->type))
);

DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_bio,

1060
	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
1061

1062
	TP_ARGS(page, fio),
1063 1064 1065 1066

	TP_CONDITION(page->mapping)
);

1067
DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_write,
1068

1069
	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
1070

1071
	TP_ARGS(page, fio),
1072 1073 1074 1075

	TP_CONDITION(page->mapping)
);

J
Jaegeuk Kim 已提交
1076
DECLARE_EVENT_CLASS(f2fs__bio,
1077

J
Jaegeuk Kim 已提交
1078
	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1079

J
Jaegeuk Kim 已提交
1080
	TP_ARGS(sb, type, bio),
1081 1082 1083

	TP_STRUCT__entry(
		__field(dev_t,	dev)
1084
		__field(dev_t,	target)
M
Mike Christie 已提交
1085 1086
		__field(int,	op)
		__field(int,	op_flags)
1087
		__field(int,	type)
1088 1089 1090 1091 1092 1093
		__field(sector_t,	sector)
		__field(unsigned int,	size)
	),

	TP_fast_assign(
		__entry->dev		= sb->s_dev;
1094
		__entry->target		= bio_dev(bio);
J
Jaegeuk Kim 已提交
1095 1096 1097
		__entry->op		= bio_op(bio);
		__entry->op_flags	= bio->bi_opf;
		__entry->type		= type;
1098 1099
		__entry->sector		= bio->bi_iter.bi_sector;
		__entry->size		= bio->bi_iter.bi_size;
1100 1101
	),

1102
	TP_printk("dev = (%d,%d)/(%d,%d), rw = %s(%s), %s, sector = %lld, size = %u",
1103 1104
		show_dev(__entry->target),
		show_dev(__entry->dev),
1105
		show_bio_type(__entry->op, __entry->op_flags),
1106
		show_block_type(__entry->type),
1107 1108 1109 1110
		(unsigned long long)__entry->sector,
		__entry->size)
);

J
Jaegeuk Kim 已提交
1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129
DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_prepare_write_bio,

	TP_PROTO(struct super_block *sb, int type, struct bio *bio),

	TP_ARGS(sb, type, bio),

	TP_CONDITION(bio)
);

DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_prepare_read_bio,

	TP_PROTO(struct super_block *sb, int type, struct bio *bio),

	TP_ARGS(sb, type, bio),

	TP_CONDITION(bio)
);

DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_read_bio,
1130

J
Jaegeuk Kim 已提交
1131
	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1132

J
Jaegeuk Kim 已提交
1133
	TP_ARGS(sb, type, bio),
1134 1135

	TP_CONDITION(bio)
1136 1137
);

J
Jaegeuk Kim 已提交
1138
DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_write_bio,
1139

J
Jaegeuk Kim 已提交
1140
	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1141

J
Jaegeuk Kim 已提交
1142
	TP_ARGS(sb, type, bio),
1143 1144

	TP_CONDITION(bio)
1145 1146
);

1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176
TRACE_EVENT(f2fs_write_begin,

	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
				unsigned int flags),

	TP_ARGS(inode, pos, len, flags),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(loff_t,	pos)
		__field(unsigned int, len)
		__field(unsigned int, flags)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
		__entry->pos	= pos;
		__entry->len	= len;
		__entry->flags	= flags;
	),

	TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u",
		show_dev_ino(__entry),
		(unsigned long long)__entry->pos,
		__entry->len,
		__entry->flags)
);

1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206
TRACE_EVENT(f2fs_write_end,

	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
				unsigned int copied),

	TP_ARGS(inode, pos, len, copied),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(loff_t,	pos)
		__field(unsigned int, len)
		__field(unsigned int, copied)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
		__entry->pos	= pos;
		__entry->len	= len;
		__entry->copied	= copied;
	),

	TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u",
		show_dev_ino(__entry),
		(unsigned long long)__entry->pos,
		__entry->len,
		__entry->copied)
);

1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219
DECLARE_EVENT_CLASS(f2fs__page,

	TP_PROTO(struct page *page, int type),

	TP_ARGS(page, type),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(int, type)
		__field(int, dir)
		__field(pgoff_t, index)
		__field(int, dirty)
1220
		__field(int, uptodate)
1221 1222 1223
	),

	TP_fast_assign(
J
Jaegeuk Kim 已提交
1224 1225
		__entry->dev	= page_file_mapping(page)->host->i_sb->s_dev;
		__entry->ino	= page_file_mapping(page)->host->i_ino;
1226
		__entry->type	= type;
J
Jaegeuk Kim 已提交
1227 1228
		__entry->dir	=
			S_ISDIR(page_file_mapping(page)->host->i_mode);
1229 1230
		__entry->index	= page->index;
		__entry->dirty	= PageDirty(page);
1231
		__entry->uptodate = PageUptodate(page);
1232 1233
	),

1234 1235
	TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, "
		"dirty = %d, uptodate = %d",
1236 1237 1238 1239
		show_dev_ino(__entry),
		show_block_type(__entry->type),
		show_file_type(__entry->dir),
		(unsigned long)__entry->index,
1240 1241
		__entry->dirty,
		__entry->uptodate)
1242 1243
);

1244 1245 1246 1247 1248 1249 1250
DEFINE_EVENT(f2fs__page, f2fs_writepage,

	TP_PROTO(struct page *page, int type),

	TP_ARGS(page, type)
);

1251 1252 1253 1254 1255 1256 1257
DEFINE_EVENT(f2fs__page, f2fs_do_write_data_page,

	TP_PROTO(struct page *page, int type),

	TP_ARGS(page, type)
);

1258 1259 1260 1261 1262 1263 1264
DEFINE_EVENT(f2fs__page, f2fs_readpage,

	TP_PROTO(struct page *page, int type),

	TP_ARGS(page, type)
);

1265 1266 1267 1268 1269 1270 1271
DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty,

	TP_PROTO(struct page *page, int type),

	TP_ARGS(page, type)
);

1272 1273 1274 1275 1276 1277 1278
DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite,

	TP_PROTO(struct page *page, int type),

	TP_ARGS(page, type)
);

1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292
DEFINE_EVENT(f2fs__page, f2fs_register_inmem_page,

	TP_PROTO(struct page *page, int type),

	TP_ARGS(page, type)
);

DEFINE_EVENT(f2fs__page, f2fs_commit_inmem_page,

	TP_PROTO(struct page *page, int type),

	TP_ARGS(page, type)
);

1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318
TRACE_EVENT(f2fs_filemap_fault,

	TP_PROTO(struct inode *inode, pgoff_t index, unsigned long ret),

	TP_ARGS(inode, index, ret),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(pgoff_t, index)
		__field(unsigned long, ret)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
		__entry->index	= index;
		__entry->ret	= ret;
	),

	TP_printk("dev = (%d,%d), ino = %lu, index = %lu, ret = %lx",
		show_dev_ino(__entry),
		(unsigned long)__entry->index,
		__entry->ret)
);

1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382
TRACE_EVENT(f2fs_writepages,

	TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type),

	TP_ARGS(inode, wbc, type),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(int,	type)
		__field(int,	dir)
		__field(long,	nr_to_write)
		__field(long,	pages_skipped)
		__field(loff_t,	range_start)
		__field(loff_t,	range_end)
		__field(pgoff_t, writeback_index)
		__field(int,	sync_mode)
		__field(char,	for_kupdate)
		__field(char,	for_background)
		__field(char,	tagged_writepages)
		__field(char,	for_reclaim)
		__field(char,	range_cyclic)
		__field(char,	for_sync)
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
		__entry->ino		= inode->i_ino;
		__entry->type		= type;
		__entry->dir		= S_ISDIR(inode->i_mode);
		__entry->nr_to_write	= wbc->nr_to_write;
		__entry->pages_skipped	= wbc->pages_skipped;
		__entry->range_start	= wbc->range_start;
		__entry->range_end	= wbc->range_end;
		__entry->writeback_index = inode->i_mapping->writeback_index;
		__entry->sync_mode	= wbc->sync_mode;
		__entry->for_kupdate	= wbc->for_kupdate;
		__entry->for_background	= wbc->for_background;
		__entry->tagged_writepages	= wbc->tagged_writepages;
		__entry->for_reclaim	= wbc->for_reclaim;
		__entry->range_cyclic	= wbc->range_cyclic;
		__entry->for_sync	= wbc->for_sync;
	),

	TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
		"skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
		"kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
		show_dev_ino(__entry),
		show_block_type(__entry->type),
		show_file_type(__entry->dir),
		__entry->nr_to_write,
		__entry->pages_skipped,
		__entry->range_start,
		__entry->range_end,
		(unsigned long)__entry->writeback_index,
		__entry->sync_mode,
		__entry->for_kupdate,
		__entry->for_background,
		__entry->tagged_writepages,
		__entry->for_reclaim,
		__entry->range_cyclic,
		__entry->for_sync)
);

1383 1384
TRACE_EVENT(f2fs_readpages,

1385
	TP_PROTO(struct inode *inode, pgoff_t start, unsigned int nrpage),
1386

1387
	TP_ARGS(inode, start, nrpage),
1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(pgoff_t,	start)
		__field(unsigned int,	nrpage)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
1399
		__entry->start	= start;
1400 1401 1402 1403 1404 1405 1406 1407 1408
		__entry->nrpage	= nrpage;
	),

	TP_printk("dev = (%d,%d), ino = %lu, start = %lu nrpage = %u",
		show_dev_ino(__entry),
		(unsigned long)__entry->start,
		__entry->nrpage)
);

1409 1410
TRACE_EVENT(f2fs_write_checkpoint,

1411
	TP_PROTO(struct super_block *sb, int reason, char *msg),
1412

1413
	TP_ARGS(sb, reason, msg),
1414 1415 1416

	TP_STRUCT__entry(
		__field(dev_t,	dev)
1417
		__field(int,	reason)
1418 1419 1420 1421 1422
		__field(char *,	msg)
	),

	TP_fast_assign(
		__entry->dev		= sb->s_dev;
1423
		__entry->reason		= reason;
1424 1425 1426 1427
		__entry->msg		= msg;
	),

	TP_printk("dev = (%d,%d), checkpoint for %s, state = %s",
1428
		show_dev(__entry->dev),
1429
		show_cpreason(__entry->reason),
1430 1431 1432
		__entry->msg)
);

C
Chao Yu 已提交
1433
DECLARE_EVENT_CLASS(f2fs_discard,
1434

1435
	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1436

1437
	TP_ARGS(dev, blkstart, blklen),
1438 1439 1440 1441 1442 1443 1444 1445

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(block_t, blkstart)
		__field(block_t, blklen)
	),

	TP_fast_assign(
1446
		__entry->dev	= dev->bd_dev;
1447 1448 1449 1450 1451
		__entry->blkstart = blkstart;
		__entry->blklen = blklen;
	),

	TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx",
1452
		show_dev(__entry->dev),
1453 1454 1455
		(unsigned long long)__entry->blkstart,
		(unsigned long long)__entry->blklen)
);
1456

C
Chao Yu 已提交
1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470
DEFINE_EVENT(f2fs_discard, f2fs_queue_discard,

	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),

	TP_ARGS(dev, blkstart, blklen)
);

DEFINE_EVENT(f2fs_discard, f2fs_issue_discard,

	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),

	TP_ARGS(dev, blkstart, blklen)
);

C
Chao Yu 已提交
1471 1472 1473 1474 1475 1476 1477
DEFINE_EVENT(f2fs_discard, f2fs_remove_discard,

	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),

	TP_ARGS(dev, blkstart, blklen)
);

D
Damien Le Moal 已提交
1478 1479
TRACE_EVENT(f2fs_issue_reset_zone,

1480
	TP_PROTO(struct block_device *dev, block_t blkstart),
D
Damien Le Moal 已提交
1481

1482
	TP_ARGS(dev, blkstart),
D
Damien Le Moal 已提交
1483 1484 1485 1486 1487 1488 1489

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(block_t, blkstart)
	),

	TP_fast_assign(
1490
		__entry->dev	= dev->bd_dev;
D
Damien Le Moal 已提交
1491 1492 1493 1494
		__entry->blkstart = blkstart;
	),

	TP_printk("dev = (%d,%d), reset zone at block = 0x%llx",
1495
		show_dev(__entry->dev),
D
Damien Le Moal 已提交
1496 1497 1498
		(unsigned long long)__entry->blkstart)
);

1499 1500
TRACE_EVENT(f2fs_issue_flush,

1501
	TP_PROTO(struct block_device *dev, unsigned int nobarrier,
1502
				unsigned int flush_merge, int ret),
1503

1504
	TP_ARGS(dev, nobarrier, flush_merge, ret),
1505 1506 1507

	TP_STRUCT__entry(
		__field(dev_t,	dev)
J
Jaegeuk Kim 已提交
1508 1509
		__field(unsigned int, nobarrier)
		__field(unsigned int, flush_merge)
1510
		__field(int,  ret)
1511 1512 1513
	),

	TP_fast_assign(
1514
		__entry->dev	= dev->bd_dev;
1515 1516
		__entry->nobarrier = nobarrier;
		__entry->flush_merge = flush_merge;
1517
		__entry->ret = ret;
1518 1519
	),

1520
	TP_printk("dev = (%d,%d), %s %s, ret = %d",
1521
		show_dev(__entry->dev),
1522
		__entry->nobarrier ? "skip (nobarrier)" : "issue",
1523 1524
		__entry->flush_merge ? " with flush_merge" : "",
		__entry->ret)
1525
);
1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552

TRACE_EVENT(f2fs_lookup_extent_tree_start,

	TP_PROTO(struct inode *inode, unsigned int pgofs),

	TP_ARGS(inode, pgofs),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(unsigned int, pgofs)
	),

	TP_fast_assign(
		__entry->dev = inode->i_sb->s_dev;
		__entry->ino = inode->i_ino;
		__entry->pgofs = pgofs;
	),

	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u",
		show_dev_ino(__entry),
		__entry->pgofs)
);

TRACE_EVENT_CONDITION(f2fs_lookup_extent_tree_end,

	TP_PROTO(struct inode *inode, unsigned int pgofs,
1553
						struct extent_info *ei),
1554

1555
	TP_ARGS(inode, pgofs, ei),
1556

1557
	TP_CONDITION(ei),
1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(unsigned int, pgofs)
		__field(unsigned int, fofs)
		__field(u32, blk)
		__field(unsigned int, len)
	),

	TP_fast_assign(
		__entry->dev = inode->i_sb->s_dev;
		__entry->ino = inode->i_ino;
		__entry->pgofs = pgofs;
1572 1573 1574
		__entry->fofs = ei->fofs;
		__entry->blk = ei->blk;
		__entry->len = ei->len;
1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585
	),

	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
		"ext_info(fofs: %u, blk: %u, len: %u)",
		show_dev_ino(__entry),
		__entry->pgofs,
		__entry->fofs,
		__entry->blk,
		__entry->len)
);

1586
TRACE_EVENT(f2fs_update_extent_tree_range,
1587

1588 1589
	TP_PROTO(struct inode *inode, unsigned int pgofs, block_t blkaddr,
						unsigned int len),
1590

1591
	TP_ARGS(inode, pgofs, blkaddr, len),
1592 1593 1594 1595 1596 1597

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(unsigned int, pgofs)
		__field(u32, blk)
1598
		__field(unsigned int, len)
1599 1600 1601 1602 1603 1604 1605
	),

	TP_fast_assign(
		__entry->dev = inode->i_sb->s_dev;
		__entry->ino = inode->i_ino;
		__entry->pgofs = pgofs;
		__entry->blk = blkaddr;
1606
		__entry->len = len;
1607 1608
	),

1609 1610
	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
					"blkaddr = %u, len = %u",
1611 1612
		show_dev_ino(__entry),
		__entry->pgofs,
1613 1614
		__entry->blk,
		__entry->len)
1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636
);

TRACE_EVENT(f2fs_shrink_extent_tree,

	TP_PROTO(struct f2fs_sb_info *sbi, unsigned int node_cnt,
						unsigned int tree_cnt),

	TP_ARGS(sbi, node_cnt, tree_cnt),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(unsigned int, node_cnt)
		__field(unsigned int, tree_cnt)
	),

	TP_fast_assign(
		__entry->dev = sbi->sb->s_dev;
		__entry->node_cnt = node_cnt;
		__entry->tree_cnt = tree_cnt;
	),

	TP_printk("dev = (%d,%d), shrunk: node_cnt = %u, tree_cnt = %u",
1637
		show_dev(__entry->dev),
1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664
		__entry->node_cnt,
		__entry->tree_cnt)
);

TRACE_EVENT(f2fs_destroy_extent_tree,

	TP_PROTO(struct inode *inode, unsigned int node_cnt),

	TP_ARGS(inode, node_cnt),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(unsigned int, node_cnt)
	),

	TP_fast_assign(
		__entry->dev = inode->i_sb->s_dev;
		__entry->ino = inode->i_ino;
		__entry->node_cnt = node_cnt;
	),

	TP_printk("dev = (%d,%d), ino = %lu, destroyed: node_cnt = %u",
		show_dev_ino(__entry),
		__entry->node_cnt)
);

1665 1666
DECLARE_EVENT_CLASS(f2fs_sync_dirty_inodes,

1667
	TP_PROTO(struct super_block *sb, int type, s64 count),
1668 1669 1670 1671 1672 1673

	TP_ARGS(sb, type, count),

	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(int, type)
1674
		__field(s64, count)
1675 1676 1677 1678 1679 1680 1681 1682
	),

	TP_fast_assign(
		__entry->dev	= sb->s_dev;
		__entry->type	= type;
		__entry->count	= count;
	),

1683
	TP_printk("dev = (%d,%d), %s, dirty count = %lld",
1684
		show_dev(__entry->dev),
1685 1686 1687 1688 1689 1690
		show_file_type(__entry->type),
		__entry->count)
);

DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_enter,

1691
	TP_PROTO(struct super_block *sb, int type, s64 count),
1692 1693 1694 1695 1696 1697

	TP_ARGS(sb, type, count)
);

DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_exit,

1698
	TP_PROTO(struct super_block *sb, int type, s64 count),
1699 1700 1701 1702

	TP_ARGS(sb, type, count)
);

C
Chao Yu 已提交
1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726
TRACE_EVENT(f2fs_shutdown,

	TP_PROTO(struct f2fs_sb_info *sbi, unsigned int mode, int ret),

	TP_ARGS(sbi, mode, ret),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(unsigned int, mode)
		__field(int, ret)
	),

	TP_fast_assign(
		__entry->dev = sbi->sb->s_dev;
		__entry->mode = mode;
		__entry->ret = ret;
	),

	TP_printk("dev = (%d,%d), mode: %s, ret:%d",
		show_dev(__entry->dev),
		show_shutdown_mode(__entry->mode),
		__entry->ret)
);

C
Chao Yu 已提交
1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820
DECLARE_EVENT_CLASS(f2fs_zip_start,

	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
			unsigned int cluster_size, unsigned char algtype),

	TP_ARGS(inode, cluster_idx, cluster_size, algtype),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(pgoff_t, idx)
		__field(unsigned int, size)
		__field(unsigned int, algtype)
	),

	TP_fast_assign(
		__entry->dev = inode->i_sb->s_dev;
		__entry->ino = inode->i_ino;
		__entry->idx = cluster_idx;
		__entry->size = cluster_size;
		__entry->algtype = algtype;
	),

	TP_printk("dev = (%d,%d), ino = %lu, cluster_idx:%lu, "
		"cluster_size = %u, algorithm = %s",
		show_dev_ino(__entry),
		__entry->idx,
		__entry->size,
		show_compress_algorithm(__entry->algtype))
);

DECLARE_EVENT_CLASS(f2fs_zip_end,

	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
			unsigned int compressed_size, int ret),

	TP_ARGS(inode, cluster_idx, compressed_size, ret),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(pgoff_t, idx)
		__field(unsigned int, size)
		__field(unsigned int, ret)
	),

	TP_fast_assign(
		__entry->dev = inode->i_sb->s_dev;
		__entry->ino = inode->i_ino;
		__entry->idx = cluster_idx;
		__entry->size = compressed_size;
		__entry->ret = ret;
	),

	TP_printk("dev = (%d,%d), ino = %lu, cluster_idx:%lu, "
		"compressed_size = %u, ret = %d",
		show_dev_ino(__entry),
		__entry->idx,
		__entry->size,
		__entry->ret)
);

DEFINE_EVENT(f2fs_zip_start, f2fs_compress_pages_start,

	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
		unsigned int cluster_size, unsigned char algtype),

	TP_ARGS(inode, cluster_idx, cluster_size, algtype)
);

DEFINE_EVENT(f2fs_zip_start, f2fs_decompress_pages_start,

	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
		unsigned int cluster_size, unsigned char algtype),

	TP_ARGS(inode, cluster_idx, cluster_size, algtype)
);

DEFINE_EVENT(f2fs_zip_end, f2fs_compress_pages_end,

	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
			unsigned int compressed_size, int ret),

	TP_ARGS(inode, cluster_idx, compressed_size, ret)
);

DEFINE_EVENT(f2fs_zip_end, f2fs_decompress_pages_end,

	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
			unsigned int compressed_size, int ret),

	TP_ARGS(inode, cluster_idx, compressed_size, ret)
);

D
Daeho Jeong 已提交
1821
#ifdef CONFIG_F2FS_IOSTAT
1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841
TRACE_EVENT(f2fs_iostat,

	TP_PROTO(struct f2fs_sb_info *sbi, unsigned long long *iostat),

	TP_ARGS(sbi, iostat),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(unsigned long long,	app_dio)
		__field(unsigned long long,	app_bio)
		__field(unsigned long long,	app_wio)
		__field(unsigned long long,	app_mio)
		__field(unsigned long long,	fs_dio)
		__field(unsigned long long,	fs_nio)
		__field(unsigned long long,	fs_mio)
		__field(unsigned long long,	fs_gc_dio)
		__field(unsigned long long,	fs_gc_nio)
		__field(unsigned long long,	fs_cp_dio)
		__field(unsigned long long,	fs_cp_nio)
		__field(unsigned long long,	fs_cp_mio)
C
Chao Yu 已提交
1842 1843 1844 1845 1846
		__field(unsigned long long,	app_drio)
		__field(unsigned long long,	app_brio)
		__field(unsigned long long,	app_rio)
		__field(unsigned long long,	app_mrio)
		__field(unsigned long long,	fs_drio)
1847 1848
		__field(unsigned long long,	fs_gdrio)
		__field(unsigned long long,	fs_cdrio)
C
Chao Yu 已提交
1849 1850
		__field(unsigned long long,	fs_nrio)
		__field(unsigned long long,	fs_mrio)
1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867
		__field(unsigned long long,	fs_discard)
	),

	TP_fast_assign(
		__entry->dev		= sbi->sb->s_dev;
		__entry->app_dio	= iostat[APP_DIRECT_IO];
		__entry->app_bio	= iostat[APP_BUFFERED_IO];
		__entry->app_wio	= iostat[APP_WRITE_IO];
		__entry->app_mio	= iostat[APP_MAPPED_IO];
		__entry->fs_dio		= iostat[FS_DATA_IO];
		__entry->fs_nio		= iostat[FS_NODE_IO];
		__entry->fs_mio		= iostat[FS_META_IO];
		__entry->fs_gc_dio	= iostat[FS_GC_DATA_IO];
		__entry->fs_gc_nio	= iostat[FS_GC_NODE_IO];
		__entry->fs_cp_dio	= iostat[FS_CP_DATA_IO];
		__entry->fs_cp_nio	= iostat[FS_CP_NODE_IO];
		__entry->fs_cp_mio	= iostat[FS_CP_META_IO];
C
Chao Yu 已提交
1868 1869 1870 1871 1872
		__entry->app_drio	= iostat[APP_DIRECT_READ_IO];
		__entry->app_brio	= iostat[APP_BUFFERED_READ_IO];
		__entry->app_rio	= iostat[APP_READ_IO];
		__entry->app_mrio	= iostat[APP_MAPPED_READ_IO];
		__entry->fs_drio	= iostat[FS_DATA_READ_IO];
1873 1874
		__entry->fs_gdrio	= iostat[FS_GDATA_READ_IO];
		__entry->fs_cdrio	= iostat[FS_CDATA_READ_IO];
C
Chao Yu 已提交
1875 1876
		__entry->fs_nrio	= iostat[FS_NODE_READ_IO];
		__entry->fs_mrio	= iostat[FS_META_READ_IO];
1877 1878 1879 1880 1881 1882 1883
		__entry->fs_discard	= iostat[FS_DISCARD];
	),

	TP_printk("dev = (%d,%d), "
		"app [write=%llu (direct=%llu, buffered=%llu), mapped=%llu], "
		"fs [data=%llu, node=%llu, meta=%llu, discard=%llu], "
		"gc [data=%llu, node=%llu], "
C
Chao Yu 已提交
1884 1885
		"cp [data=%llu, node=%llu, meta=%llu], "
		"app [read=%llu (direct=%llu, buffered=%llu), mapped=%llu], "
1886 1887
		"fs [data=%llu, (gc_data=%llu, compr_data=%llu), "
		"node=%llu, meta=%llu]",
1888 1889 1890 1891
		show_dev(__entry->dev), __entry->app_wio, __entry->app_dio,
		__entry->app_bio, __entry->app_mio, __entry->fs_dio,
		__entry->fs_nio, __entry->fs_mio, __entry->fs_discard,
		__entry->fs_gc_dio, __entry->fs_gc_nio, __entry->fs_cp_dio,
C
Chao Yu 已提交
1892 1893
		__entry->fs_cp_nio, __entry->fs_cp_mio,
		__entry->app_rio, __entry->app_drio, __entry->app_brio,
1894 1895
		__entry->app_mrio, __entry->fs_drio, __entry->fs_gdrio,
		__entry->fs_cdrio, __entry->fs_nrio, __entry->fs_mrio)
1896
);
1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991

#ifndef __F2FS_IOSTAT_LATENCY_TYPE
#define __F2FS_IOSTAT_LATENCY_TYPE
struct f2fs_iostat_latency {
	unsigned int peak_lat;
	unsigned int avg_lat;
	unsigned int cnt;
};
#endif /* __F2FS_IOSTAT_LATENCY_TYPE */

TRACE_EVENT(f2fs_iostat_latency,

	TP_PROTO(struct f2fs_sb_info *sbi, struct f2fs_iostat_latency (*iostat_lat)[NR_PAGE_TYPE]),

	TP_ARGS(sbi, iostat_lat),

	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(unsigned int,	d_rd_peak)
		__field(unsigned int,	d_rd_avg)
		__field(unsigned int,	d_rd_cnt)
		__field(unsigned int,	n_rd_peak)
		__field(unsigned int,	n_rd_avg)
		__field(unsigned int,	n_rd_cnt)
		__field(unsigned int,	m_rd_peak)
		__field(unsigned int,	m_rd_avg)
		__field(unsigned int,	m_rd_cnt)
		__field(unsigned int,	d_wr_s_peak)
		__field(unsigned int,	d_wr_s_avg)
		__field(unsigned int,	d_wr_s_cnt)
		__field(unsigned int,	n_wr_s_peak)
		__field(unsigned int,	n_wr_s_avg)
		__field(unsigned int,	n_wr_s_cnt)
		__field(unsigned int,	m_wr_s_peak)
		__field(unsigned int,	m_wr_s_avg)
		__field(unsigned int,	m_wr_s_cnt)
		__field(unsigned int,	d_wr_as_peak)
		__field(unsigned int,	d_wr_as_avg)
		__field(unsigned int,	d_wr_as_cnt)
		__field(unsigned int,	n_wr_as_peak)
		__field(unsigned int,	n_wr_as_avg)
		__field(unsigned int,	n_wr_as_cnt)
		__field(unsigned int,	m_wr_as_peak)
		__field(unsigned int,	m_wr_as_avg)
		__field(unsigned int,	m_wr_as_cnt)
	),

	TP_fast_assign(
		__entry->dev		= sbi->sb->s_dev;
		__entry->d_rd_peak	= iostat_lat[0][DATA].peak_lat;
		__entry->d_rd_avg	= iostat_lat[0][DATA].avg_lat;
		__entry->d_rd_cnt	= iostat_lat[0][DATA].cnt;
		__entry->n_rd_peak	= iostat_lat[0][NODE].peak_lat;
		__entry->n_rd_avg	= iostat_lat[0][NODE].avg_lat;
		__entry->n_rd_cnt	= iostat_lat[0][NODE].cnt;
		__entry->m_rd_peak	= iostat_lat[0][META].peak_lat;
		__entry->m_rd_avg	= iostat_lat[0][META].avg_lat;
		__entry->m_rd_cnt	= iostat_lat[0][META].cnt;
		__entry->d_wr_s_peak	= iostat_lat[1][DATA].peak_lat;
		__entry->d_wr_s_avg	= iostat_lat[1][DATA].avg_lat;
		__entry->d_wr_s_cnt	= iostat_lat[1][DATA].cnt;
		__entry->n_wr_s_peak	= iostat_lat[1][NODE].peak_lat;
		__entry->n_wr_s_avg	= iostat_lat[1][NODE].avg_lat;
		__entry->n_wr_s_cnt	= iostat_lat[1][NODE].cnt;
		__entry->m_wr_s_peak	= iostat_lat[1][META].peak_lat;
		__entry->m_wr_s_avg	= iostat_lat[1][META].avg_lat;
		__entry->m_wr_s_cnt	= iostat_lat[1][META].cnt;
		__entry->d_wr_as_peak	= iostat_lat[2][DATA].peak_lat;
		__entry->d_wr_as_avg	= iostat_lat[2][DATA].avg_lat;
		__entry->d_wr_as_cnt	= iostat_lat[2][DATA].cnt;
		__entry->n_wr_as_peak	= iostat_lat[2][NODE].peak_lat;
		__entry->n_wr_as_avg	= iostat_lat[2][NODE].avg_lat;
		__entry->n_wr_as_cnt	= iostat_lat[2][NODE].cnt;
		__entry->m_wr_as_peak	= iostat_lat[2][META].peak_lat;
		__entry->m_wr_as_avg	= iostat_lat[2][META].avg_lat;
		__entry->m_wr_as_cnt	= iostat_lat[2][META].cnt;
	),

	TP_printk("dev = (%d,%d), "
		"iotype [peak lat.(ms)/avg lat.(ms)/count], "
		"rd_data [%u/%u/%u], rd_node [%u/%u/%u], rd_meta [%u/%u/%u], "
		"wr_sync_data [%u/%u/%u], wr_sync_node [%u/%u/%u], "
		"wr_sync_meta [%u/%u/%u], wr_async_data [%u/%u/%u], "
		"wr_async_node [%u/%u/%u], wr_async_meta [%u/%u/%u]",
		show_dev(__entry->dev),
		__entry->d_rd_peak, __entry->d_rd_avg, __entry->d_rd_cnt,
		__entry->n_rd_peak, __entry->n_rd_avg, __entry->n_rd_cnt,
		__entry->m_rd_peak, __entry->m_rd_avg, __entry->m_rd_cnt,
		__entry->d_wr_s_peak, __entry->d_wr_s_avg, __entry->d_wr_s_cnt,
		__entry->n_wr_s_peak, __entry->n_wr_s_avg, __entry->n_wr_s_cnt,
		__entry->m_wr_s_peak, __entry->m_wr_s_avg, __entry->m_wr_s_cnt,
		__entry->d_wr_as_peak, __entry->d_wr_as_avg, __entry->d_wr_as_cnt,
		__entry->n_wr_as_peak, __entry->n_wr_as_avg, __entry->n_wr_as_cnt,
		__entry->m_wr_as_peak, __entry->m_wr_as_avg, __entry->m_wr_as_cnt)
);
D
Daeho Jeong 已提交
1992
#endif
1993

C
Chao Yu 已提交
1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019
TRACE_EVENT(f2fs_bmap,

	TP_PROTO(struct inode *inode, sector_t lblock, sector_t pblock),

	TP_ARGS(inode, lblock, pblock),

	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(ino_t, ino)
		__field(sector_t, lblock)
		__field(sector_t, pblock)
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
		__entry->ino		= inode->i_ino;
		__entry->lblock		= lblock;
		__entry->pblock		= pblock;
	),

	TP_printk("dev = (%d,%d), ino = %lu, lblock:%lld, pblock:%lld",
		show_dev_ino(__entry),
		(unsigned long long)__entry->lblock,
		(unsigned long long)__entry->pblock)
);

C
Chao Yu 已提交
2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056
TRACE_EVENT(f2fs_fiemap,

	TP_PROTO(struct inode *inode, sector_t lblock, sector_t pblock,
		unsigned long long len, unsigned int flags, int ret),

	TP_ARGS(inode, lblock, pblock, len, flags, ret),

	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(ino_t, ino)
		__field(sector_t, lblock)
		__field(sector_t, pblock)
		__field(unsigned long long, len)
		__field(unsigned int, flags)
		__field(int, ret)
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
		__entry->ino		= inode->i_ino;
		__entry->lblock		= lblock;
		__entry->pblock		= pblock;
		__entry->len		= len;
		__entry->flags		= flags;
		__entry->ret		= ret;
	),

	TP_printk("dev = (%d,%d), ino = %lu, lblock:%lld, pblock:%lld, "
		"len:%llu, flags:%u, ret:%d",
		show_dev_ino(__entry),
		(unsigned long long)__entry->lblock,
		(unsigned long long)__entry->pblock,
		__entry->len,
		__entry->flags,
		__entry->ret)
);

2057 2058 2059 2060
#endif /* _TRACE_F2FS_H */

 /* This part must be outside protection */
#include <trace/define_trace.h>