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