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