xref: /linux/include/trace/events/f2fs.h (revision 200323768787a0ee02e01c35c1aff13dc9d77dde)
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 TRACE_EVENT(f2fs_issue_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), reset zone at block = 0x%llx",
1532 		show_dev(__entry->dev),
1533 		(unsigned long long)__entry->blkstart)
1534 );
1535 
1536 TRACE_EVENT(f2fs_issue_flush,
1537 
1538 	TP_PROTO(struct block_device *dev, unsigned int nobarrier,
1539 				unsigned int flush_merge, int ret),
1540 
1541 	TP_ARGS(dev, nobarrier, flush_merge, ret),
1542 
1543 	TP_STRUCT__entry(
1544 		__field(dev_t,	dev)
1545 		__field(unsigned int, nobarrier)
1546 		__field(unsigned int, flush_merge)
1547 		__field(int,  ret)
1548 	),
1549 
1550 	TP_fast_assign(
1551 		__entry->dev	= dev->bd_dev;
1552 		__entry->nobarrier = nobarrier;
1553 		__entry->flush_merge = flush_merge;
1554 		__entry->ret = ret;
1555 	),
1556 
1557 	TP_printk("dev = (%d,%d), %s %s, ret = %d",
1558 		show_dev(__entry->dev),
1559 		__entry->nobarrier ? "skip (nobarrier)" : "issue",
1560 		__entry->flush_merge ? " with flush_merge" : "",
1561 		__entry->ret)
1562 );
1563 
1564 TRACE_EVENT(f2fs_lookup_extent_tree_start,
1565 
1566 	TP_PROTO(struct inode *inode, unsigned int pgofs, enum extent_type type),
1567 
1568 	TP_ARGS(inode, pgofs, type),
1569 
1570 	TP_STRUCT__entry(
1571 		__field(dev_t,	dev)
1572 		__field(ino_t,	ino)
1573 		__field(unsigned int, pgofs)
1574 		__field(enum extent_type, type)
1575 	),
1576 
1577 	TP_fast_assign(
1578 		__entry->dev = inode->i_sb->s_dev;
1579 		__entry->ino = inode->i_ino;
1580 		__entry->pgofs = pgofs;
1581 		__entry->type = type;
1582 	),
1583 
1584 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, type = %s",
1585 		show_dev_ino(__entry),
1586 		__entry->pgofs,
1587 		show_extent_type(__entry->type))
1588 );
1589 
1590 TRACE_EVENT_CONDITION(f2fs_lookup_read_extent_tree_end,
1591 
1592 	TP_PROTO(struct inode *inode, unsigned int pgofs,
1593 						struct extent_info *ei),
1594 
1595 	TP_ARGS(inode, pgofs, ei),
1596 
1597 	TP_CONDITION(ei),
1598 
1599 	TP_STRUCT__entry(
1600 		__field(dev_t,	dev)
1601 		__field(ino_t,	ino)
1602 		__field(unsigned int, pgofs)
1603 		__field(unsigned int, fofs)
1604 		__field(unsigned int, len)
1605 		__field(u32, blk)
1606 	),
1607 
1608 	TP_fast_assign(
1609 		__entry->dev = inode->i_sb->s_dev;
1610 		__entry->ino = inode->i_ino;
1611 		__entry->pgofs = pgofs;
1612 		__entry->fofs = ei->fofs;
1613 		__entry->len = ei->len;
1614 		__entry->blk = ei->blk;
1615 	),
1616 
1617 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1618 		"read_ext_info(fofs: %u, len: %u, blk: %u)",
1619 		show_dev_ino(__entry),
1620 		__entry->pgofs,
1621 		__entry->fofs,
1622 		__entry->len,
1623 		__entry->blk)
1624 );
1625 
1626 TRACE_EVENT_CONDITION(f2fs_lookup_age_extent_tree_end,
1627 
1628 	TP_PROTO(struct inode *inode, unsigned int pgofs,
1629 						struct extent_info *ei),
1630 
1631 	TP_ARGS(inode, pgofs, ei),
1632 
1633 	TP_CONDITION(ei),
1634 
1635 	TP_STRUCT__entry(
1636 		__field(dev_t,	dev)
1637 		__field(ino_t,	ino)
1638 		__field(unsigned int, pgofs)
1639 		__field(unsigned int, fofs)
1640 		__field(unsigned int, len)
1641 		__field(unsigned long long, age)
1642 		__field(unsigned long long, blocks)
1643 	),
1644 
1645 	TP_fast_assign(
1646 		__entry->dev = inode->i_sb->s_dev;
1647 		__entry->ino = inode->i_ino;
1648 		__entry->pgofs = pgofs;
1649 		__entry->fofs = ei->fofs;
1650 		__entry->len = ei->len;
1651 		__entry->age = ei->age;
1652 		__entry->blocks = ei->last_blocks;
1653 	),
1654 
1655 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1656 		"age_ext_info(fofs: %u, len: %u, age: %llu, blocks: %llu)",
1657 		show_dev_ino(__entry),
1658 		__entry->pgofs,
1659 		__entry->fofs,
1660 		__entry->len,
1661 		__entry->age,
1662 		__entry->blocks)
1663 );
1664 
1665 TRACE_EVENT(f2fs_update_read_extent_tree_range,
1666 
1667 	TP_PROTO(struct inode *inode, unsigned int pgofs, unsigned int len,
1668 						block_t blkaddr,
1669 						unsigned int c_len),
1670 
1671 	TP_ARGS(inode, pgofs, len, blkaddr, c_len),
1672 
1673 	TP_STRUCT__entry(
1674 		__field(dev_t,	dev)
1675 		__field(ino_t,	ino)
1676 		__field(unsigned int, pgofs)
1677 		__field(u32, blk)
1678 		__field(unsigned int, len)
1679 		__field(unsigned int, c_len)
1680 	),
1681 
1682 	TP_fast_assign(
1683 		__entry->dev = inode->i_sb->s_dev;
1684 		__entry->ino = inode->i_ino;
1685 		__entry->pgofs = pgofs;
1686 		__entry->len = len;
1687 		__entry->blk = blkaddr;
1688 		__entry->c_len = c_len;
1689 	),
1690 
1691 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1692 				"len = %u, blkaddr = %u, c_len = %u",
1693 		show_dev_ino(__entry),
1694 		__entry->pgofs,
1695 		__entry->len,
1696 		__entry->blk,
1697 		__entry->c_len)
1698 );
1699 
1700 TRACE_EVENT(f2fs_update_age_extent_tree_range,
1701 
1702 	TP_PROTO(struct inode *inode, unsigned int pgofs, unsigned int len,
1703 					unsigned long long age,
1704 					unsigned long long last_blks),
1705 
1706 	TP_ARGS(inode, pgofs, len, age, last_blks),
1707 
1708 	TP_STRUCT__entry(
1709 		__field(dev_t,	dev)
1710 		__field(ino_t,	ino)
1711 		__field(unsigned int, pgofs)
1712 		__field(unsigned int, len)
1713 		__field(unsigned long long, age)
1714 		__field(unsigned long long, blocks)
1715 	),
1716 
1717 	TP_fast_assign(
1718 		__entry->dev = inode->i_sb->s_dev;
1719 		__entry->ino = inode->i_ino;
1720 		__entry->pgofs = pgofs;
1721 		__entry->len = len;
1722 		__entry->age = age;
1723 		__entry->blocks = last_blks;
1724 	),
1725 
1726 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1727 				"len = %u, age = %llu, blocks = %llu",
1728 		show_dev_ino(__entry),
1729 		__entry->pgofs,
1730 		__entry->len,
1731 		__entry->age,
1732 		__entry->blocks)
1733 );
1734 
1735 TRACE_EVENT(f2fs_shrink_extent_tree,
1736 
1737 	TP_PROTO(struct f2fs_sb_info *sbi, unsigned int node_cnt,
1738 			unsigned int tree_cnt, enum extent_type type),
1739 
1740 	TP_ARGS(sbi, node_cnt, tree_cnt, type),
1741 
1742 	TP_STRUCT__entry(
1743 		__field(dev_t,	dev)
1744 		__field(unsigned int, node_cnt)
1745 		__field(unsigned int, tree_cnt)
1746 		__field(enum extent_type, type)
1747 	),
1748 
1749 	TP_fast_assign(
1750 		__entry->dev = sbi->sb->s_dev;
1751 		__entry->node_cnt = node_cnt;
1752 		__entry->tree_cnt = tree_cnt;
1753 		__entry->type = type;
1754 	),
1755 
1756 	TP_printk("dev = (%d,%d), shrunk: node_cnt = %u, tree_cnt = %u, type = %s",
1757 		show_dev(__entry->dev),
1758 		__entry->node_cnt,
1759 		__entry->tree_cnt,
1760 		show_extent_type(__entry->type))
1761 );
1762 
1763 TRACE_EVENT(f2fs_destroy_extent_tree,
1764 
1765 	TP_PROTO(struct inode *inode, unsigned int node_cnt,
1766 				enum extent_type type),
1767 
1768 	TP_ARGS(inode, node_cnt, type),
1769 
1770 	TP_STRUCT__entry(
1771 		__field(dev_t,	dev)
1772 		__field(ino_t,	ino)
1773 		__field(unsigned int, node_cnt)
1774 		__field(enum extent_type, type)
1775 	),
1776 
1777 	TP_fast_assign(
1778 		__entry->dev = inode->i_sb->s_dev;
1779 		__entry->ino = inode->i_ino;
1780 		__entry->node_cnt = node_cnt;
1781 		__entry->type = type;
1782 	),
1783 
1784 	TP_printk("dev = (%d,%d), ino = %lu, destroyed: node_cnt = %u, type = %s",
1785 		show_dev_ino(__entry),
1786 		__entry->node_cnt,
1787 		show_extent_type(__entry->type))
1788 );
1789 
1790 DECLARE_EVENT_CLASS(f2fs_sync_dirty_inodes,
1791 
1792 	TP_PROTO(struct super_block *sb, int type, s64 count),
1793 
1794 	TP_ARGS(sb, type, count),
1795 
1796 	TP_STRUCT__entry(
1797 		__field(dev_t, dev)
1798 		__field(int, type)
1799 		__field(s64, count)
1800 	),
1801 
1802 	TP_fast_assign(
1803 		__entry->dev	= sb->s_dev;
1804 		__entry->type	= type;
1805 		__entry->count	= count;
1806 	),
1807 
1808 	TP_printk("dev = (%d,%d), %s, dirty count = %lld",
1809 		show_dev(__entry->dev),
1810 		show_file_type(__entry->type),
1811 		__entry->count)
1812 );
1813 
1814 DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_enter,
1815 
1816 	TP_PROTO(struct super_block *sb, int type, s64 count),
1817 
1818 	TP_ARGS(sb, type, count)
1819 );
1820 
1821 DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_exit,
1822 
1823 	TP_PROTO(struct super_block *sb, int type, s64 count),
1824 
1825 	TP_ARGS(sb, type, count)
1826 );
1827 
1828 TRACE_EVENT(f2fs_shutdown,
1829 
1830 	TP_PROTO(struct f2fs_sb_info *sbi, unsigned int mode, int ret),
1831 
1832 	TP_ARGS(sbi, mode, ret),
1833 
1834 	TP_STRUCT__entry(
1835 		__field(dev_t,	dev)
1836 		__field(unsigned int, mode)
1837 		__field(int, ret)
1838 	),
1839 
1840 	TP_fast_assign(
1841 		__entry->dev = sbi->sb->s_dev;
1842 		__entry->mode = mode;
1843 		__entry->ret = ret;
1844 	),
1845 
1846 	TP_printk("dev = (%d,%d), mode: %s, ret:%d",
1847 		show_dev(__entry->dev),
1848 		show_shutdown_mode(__entry->mode),
1849 		__entry->ret)
1850 );
1851 
1852 DECLARE_EVENT_CLASS(f2fs_zip_start,
1853 
1854 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1855 			unsigned int cluster_size, unsigned char algtype),
1856 
1857 	TP_ARGS(inode, cluster_idx, cluster_size, algtype),
1858 
1859 	TP_STRUCT__entry(
1860 		__field(dev_t,	dev)
1861 		__field(ino_t,	ino)
1862 		__field(pgoff_t, idx)
1863 		__field(unsigned int, size)
1864 		__field(unsigned int, algtype)
1865 	),
1866 
1867 	TP_fast_assign(
1868 		__entry->dev = inode->i_sb->s_dev;
1869 		__entry->ino = inode->i_ino;
1870 		__entry->idx = cluster_idx;
1871 		__entry->size = cluster_size;
1872 		__entry->algtype = algtype;
1873 	),
1874 
1875 	TP_printk("dev = (%d,%d), ino = %lu, cluster_idx:%lu, "
1876 		"cluster_size = %u, algorithm = %s",
1877 		show_dev_ino(__entry),
1878 		__entry->idx,
1879 		__entry->size,
1880 		show_compress_algorithm(__entry->algtype))
1881 );
1882 
1883 DECLARE_EVENT_CLASS(f2fs_zip_end,
1884 
1885 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1886 			unsigned int compressed_size, int ret),
1887 
1888 	TP_ARGS(inode, cluster_idx, compressed_size, ret),
1889 
1890 	TP_STRUCT__entry(
1891 		__field(dev_t,	dev)
1892 		__field(ino_t,	ino)
1893 		__field(pgoff_t, idx)
1894 		__field(unsigned int, size)
1895 		__field(unsigned int, ret)
1896 	),
1897 
1898 	TP_fast_assign(
1899 		__entry->dev = inode->i_sb->s_dev;
1900 		__entry->ino = inode->i_ino;
1901 		__entry->idx = cluster_idx;
1902 		__entry->size = compressed_size;
1903 		__entry->ret = ret;
1904 	),
1905 
1906 	TP_printk("dev = (%d,%d), ino = %lu, cluster_idx:%lu, "
1907 		"compressed_size = %u, ret = %d",
1908 		show_dev_ino(__entry),
1909 		__entry->idx,
1910 		__entry->size,
1911 		__entry->ret)
1912 );
1913 
1914 DEFINE_EVENT(f2fs_zip_start, f2fs_compress_pages_start,
1915 
1916 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1917 		unsigned int cluster_size, unsigned char algtype),
1918 
1919 	TP_ARGS(inode, cluster_idx, cluster_size, algtype)
1920 );
1921 
1922 DEFINE_EVENT(f2fs_zip_start, f2fs_decompress_pages_start,
1923 
1924 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1925 		unsigned int cluster_size, unsigned char algtype),
1926 
1927 	TP_ARGS(inode, cluster_idx, cluster_size, algtype)
1928 );
1929 
1930 DEFINE_EVENT(f2fs_zip_end, f2fs_compress_pages_end,
1931 
1932 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1933 			unsigned int compressed_size, int ret),
1934 
1935 	TP_ARGS(inode, cluster_idx, compressed_size, ret)
1936 );
1937 
1938 DEFINE_EVENT(f2fs_zip_end, f2fs_decompress_pages_end,
1939 
1940 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1941 			unsigned int compressed_size, int ret),
1942 
1943 	TP_ARGS(inode, cluster_idx, compressed_size, ret)
1944 );
1945 
1946 #ifdef CONFIG_F2FS_IOSTAT
1947 TRACE_EVENT(f2fs_iostat,
1948 
1949 	TP_PROTO(struct f2fs_sb_info *sbi, unsigned long long *iostat),
1950 
1951 	TP_ARGS(sbi, iostat),
1952 
1953 	TP_STRUCT__entry(
1954 		__field(dev_t,	dev)
1955 		__field(unsigned long long,	app_dio)
1956 		__field(unsigned long long,	app_bio)
1957 		__field(unsigned long long,	app_wio)
1958 		__field(unsigned long long,	app_mio)
1959 		__field(unsigned long long,	app_bcdio)
1960 		__field(unsigned long long,	app_mcdio)
1961 		__field(unsigned long long,	fs_dio)
1962 		__field(unsigned long long,	fs_cdio)
1963 		__field(unsigned long long,	fs_nio)
1964 		__field(unsigned long long,	fs_mio)
1965 		__field(unsigned long long,	fs_gc_dio)
1966 		__field(unsigned long long,	fs_gc_nio)
1967 		__field(unsigned long long,	fs_cp_dio)
1968 		__field(unsigned long long,	fs_cp_nio)
1969 		__field(unsigned long long,	fs_cp_mio)
1970 		__field(unsigned long long,	app_drio)
1971 		__field(unsigned long long,	app_brio)
1972 		__field(unsigned long long,	app_rio)
1973 		__field(unsigned long long,	app_mrio)
1974 		__field(unsigned long long,	app_bcrio)
1975 		__field(unsigned long long,	app_mcrio)
1976 		__field(unsigned long long,	fs_drio)
1977 		__field(unsigned long long,	fs_gdrio)
1978 		__field(unsigned long long,	fs_cdrio)
1979 		__field(unsigned long long,	fs_nrio)
1980 		__field(unsigned long long,	fs_mrio)
1981 		__field(unsigned long long,	fs_discard)
1982 	),
1983 
1984 	TP_fast_assign(
1985 		__entry->dev		= sbi->sb->s_dev;
1986 		__entry->app_dio	= iostat[APP_DIRECT_IO];
1987 		__entry->app_bio	= iostat[APP_BUFFERED_IO];
1988 		__entry->app_wio	= iostat[APP_WRITE_IO];
1989 		__entry->app_mio	= iostat[APP_MAPPED_IO];
1990 		__entry->app_bcdio	= iostat[APP_BUFFERED_CDATA_IO];
1991 		__entry->app_mcdio	= iostat[APP_MAPPED_CDATA_IO];
1992 		__entry->fs_dio		= iostat[FS_DATA_IO];
1993 		__entry->fs_cdio	= iostat[FS_CDATA_IO];
1994 		__entry->fs_nio		= iostat[FS_NODE_IO];
1995 		__entry->fs_mio		= iostat[FS_META_IO];
1996 		__entry->fs_gc_dio	= iostat[FS_GC_DATA_IO];
1997 		__entry->fs_gc_nio	= iostat[FS_GC_NODE_IO];
1998 		__entry->fs_cp_dio	= iostat[FS_CP_DATA_IO];
1999 		__entry->fs_cp_nio	= iostat[FS_CP_NODE_IO];
2000 		__entry->fs_cp_mio	= iostat[FS_CP_META_IO];
2001 		__entry->app_drio	= iostat[APP_DIRECT_READ_IO];
2002 		__entry->app_brio	= iostat[APP_BUFFERED_READ_IO];
2003 		__entry->app_rio	= iostat[APP_READ_IO];
2004 		__entry->app_mrio	= iostat[APP_MAPPED_READ_IO];
2005 		__entry->app_bcrio	= iostat[APP_BUFFERED_CDATA_READ_IO];
2006 		__entry->app_mcrio	= iostat[APP_MAPPED_CDATA_READ_IO];
2007 		__entry->fs_drio	= iostat[FS_DATA_READ_IO];
2008 		__entry->fs_gdrio	= iostat[FS_GDATA_READ_IO];
2009 		__entry->fs_cdrio	= iostat[FS_CDATA_READ_IO];
2010 		__entry->fs_nrio	= iostat[FS_NODE_READ_IO];
2011 		__entry->fs_mrio	= iostat[FS_META_READ_IO];
2012 		__entry->fs_discard	= iostat[FS_DISCARD_IO];
2013 	),
2014 
2015 	TP_printk("dev = (%d,%d), "
2016 		"app [write=%llu (direct=%llu, buffered=%llu), mapped=%llu, "
2017 		"compr(buffered=%llu, mapped=%llu)], "
2018 		"fs [data=%llu, cdata=%llu, node=%llu, meta=%llu, discard=%llu], "
2019 		"gc [data=%llu, node=%llu], "
2020 		"cp [data=%llu, node=%llu, meta=%llu], "
2021 		"app [read=%llu (direct=%llu, buffered=%llu), mapped=%llu], "
2022 		"compr(buffered=%llu, mapped=%llu)], "
2023 		"fs [data=%llu, (gc_data=%llu, cdata=%llu), "
2024 		"node=%llu, meta=%llu]",
2025 		show_dev(__entry->dev), __entry->app_wio, __entry->app_dio,
2026 		__entry->app_bio, __entry->app_mio, __entry->app_bcdio,
2027 		__entry->app_mcdio, __entry->fs_dio, __entry->fs_cdio,
2028 		__entry->fs_nio, __entry->fs_mio, __entry->fs_discard,
2029 		__entry->fs_gc_dio, __entry->fs_gc_nio, __entry->fs_cp_dio,
2030 		__entry->fs_cp_nio, __entry->fs_cp_mio,
2031 		__entry->app_rio, __entry->app_drio, __entry->app_brio,
2032 		__entry->app_mrio, __entry->app_bcrio, __entry->app_mcrio,
2033 		__entry->fs_drio, __entry->fs_gdrio,
2034 		__entry->fs_cdrio, __entry->fs_nrio, __entry->fs_mrio)
2035 );
2036 
2037 #ifndef __F2FS_IOSTAT_LATENCY_TYPE
2038 #define __F2FS_IOSTAT_LATENCY_TYPE
2039 struct f2fs_iostat_latency {
2040 	unsigned int peak_lat;
2041 	unsigned int avg_lat;
2042 	unsigned int cnt;
2043 };
2044 #endif /* __F2FS_IOSTAT_LATENCY_TYPE */
2045 
2046 TRACE_EVENT(f2fs_iostat_latency,
2047 
2048 	TP_PROTO(struct f2fs_sb_info *sbi, struct f2fs_iostat_latency (*iostat_lat)[NR_PAGE_TYPE]),
2049 
2050 	TP_ARGS(sbi, iostat_lat),
2051 
2052 	TP_STRUCT__entry(
2053 		__field(dev_t,	dev)
2054 		__field(unsigned int,	d_rd_peak)
2055 		__field(unsigned int,	d_rd_avg)
2056 		__field(unsigned int,	d_rd_cnt)
2057 		__field(unsigned int,	n_rd_peak)
2058 		__field(unsigned int,	n_rd_avg)
2059 		__field(unsigned int,	n_rd_cnt)
2060 		__field(unsigned int,	m_rd_peak)
2061 		__field(unsigned int,	m_rd_avg)
2062 		__field(unsigned int,	m_rd_cnt)
2063 		__field(unsigned int,	d_wr_s_peak)
2064 		__field(unsigned int,	d_wr_s_avg)
2065 		__field(unsigned int,	d_wr_s_cnt)
2066 		__field(unsigned int,	n_wr_s_peak)
2067 		__field(unsigned int,	n_wr_s_avg)
2068 		__field(unsigned int,	n_wr_s_cnt)
2069 		__field(unsigned int,	m_wr_s_peak)
2070 		__field(unsigned int,	m_wr_s_avg)
2071 		__field(unsigned int,	m_wr_s_cnt)
2072 		__field(unsigned int,	d_wr_as_peak)
2073 		__field(unsigned int,	d_wr_as_avg)
2074 		__field(unsigned int,	d_wr_as_cnt)
2075 		__field(unsigned int,	n_wr_as_peak)
2076 		__field(unsigned int,	n_wr_as_avg)
2077 		__field(unsigned int,	n_wr_as_cnt)
2078 		__field(unsigned int,	m_wr_as_peak)
2079 		__field(unsigned int,	m_wr_as_avg)
2080 		__field(unsigned int,	m_wr_as_cnt)
2081 	),
2082 
2083 	TP_fast_assign(
2084 		__entry->dev		= sbi->sb->s_dev;
2085 		__entry->d_rd_peak	= iostat_lat[READ_IO][DATA].peak_lat;
2086 		__entry->d_rd_avg	= iostat_lat[READ_IO][DATA].avg_lat;
2087 		__entry->d_rd_cnt	= iostat_lat[READ_IO][DATA].cnt;
2088 		__entry->n_rd_peak	= iostat_lat[READ_IO][NODE].peak_lat;
2089 		__entry->n_rd_avg	= iostat_lat[READ_IO][NODE].avg_lat;
2090 		__entry->n_rd_cnt	= iostat_lat[READ_IO][NODE].cnt;
2091 		__entry->m_rd_peak	= iostat_lat[READ_IO][META].peak_lat;
2092 		__entry->m_rd_avg	= iostat_lat[READ_IO][META].avg_lat;
2093 		__entry->m_rd_cnt	= iostat_lat[READ_IO][META].cnt;
2094 		__entry->d_wr_s_peak	= iostat_lat[WRITE_SYNC_IO][DATA].peak_lat;
2095 		__entry->d_wr_s_avg	= iostat_lat[WRITE_SYNC_IO][DATA].avg_lat;
2096 		__entry->d_wr_s_cnt	= iostat_lat[WRITE_SYNC_IO][DATA].cnt;
2097 		__entry->n_wr_s_peak	= iostat_lat[WRITE_SYNC_IO][NODE].peak_lat;
2098 		__entry->n_wr_s_avg	= iostat_lat[WRITE_SYNC_IO][NODE].avg_lat;
2099 		__entry->n_wr_s_cnt	= iostat_lat[WRITE_SYNC_IO][NODE].cnt;
2100 		__entry->m_wr_s_peak	= iostat_lat[WRITE_SYNC_IO][META].peak_lat;
2101 		__entry->m_wr_s_avg	= iostat_lat[WRITE_SYNC_IO][META].avg_lat;
2102 		__entry->m_wr_s_cnt	= iostat_lat[WRITE_SYNC_IO][META].cnt;
2103 		__entry->d_wr_as_peak	= iostat_lat[WRITE_ASYNC_IO][DATA].peak_lat;
2104 		__entry->d_wr_as_avg	= iostat_lat[WRITE_ASYNC_IO][DATA].avg_lat;
2105 		__entry->d_wr_as_cnt	= iostat_lat[WRITE_ASYNC_IO][DATA].cnt;
2106 		__entry->n_wr_as_peak	= iostat_lat[WRITE_ASYNC_IO][NODE].peak_lat;
2107 		__entry->n_wr_as_avg	= iostat_lat[WRITE_ASYNC_IO][NODE].avg_lat;
2108 		__entry->n_wr_as_cnt	= iostat_lat[WRITE_ASYNC_IO][NODE].cnt;
2109 		__entry->m_wr_as_peak	= iostat_lat[WRITE_ASYNC_IO][META].peak_lat;
2110 		__entry->m_wr_as_avg	= iostat_lat[WRITE_ASYNC_IO][META].avg_lat;
2111 		__entry->m_wr_as_cnt	= iostat_lat[WRITE_ASYNC_IO][META].cnt;
2112 	),
2113 
2114 	TP_printk("dev = (%d,%d), "
2115 		"iotype [peak lat.(ms)/avg lat.(ms)/count], "
2116 		"rd_data [%u/%u/%u], rd_node [%u/%u/%u], rd_meta [%u/%u/%u], "
2117 		"wr_sync_data [%u/%u/%u], wr_sync_node [%u/%u/%u], "
2118 		"wr_sync_meta [%u/%u/%u], wr_async_data [%u/%u/%u], "
2119 		"wr_async_node [%u/%u/%u], wr_async_meta [%u/%u/%u]",
2120 		show_dev(__entry->dev),
2121 		__entry->d_rd_peak, __entry->d_rd_avg, __entry->d_rd_cnt,
2122 		__entry->n_rd_peak, __entry->n_rd_avg, __entry->n_rd_cnt,
2123 		__entry->m_rd_peak, __entry->m_rd_avg, __entry->m_rd_cnt,
2124 		__entry->d_wr_s_peak, __entry->d_wr_s_avg, __entry->d_wr_s_cnt,
2125 		__entry->n_wr_s_peak, __entry->n_wr_s_avg, __entry->n_wr_s_cnt,
2126 		__entry->m_wr_s_peak, __entry->m_wr_s_avg, __entry->m_wr_s_cnt,
2127 		__entry->d_wr_as_peak, __entry->d_wr_as_avg, __entry->d_wr_as_cnt,
2128 		__entry->n_wr_as_peak, __entry->n_wr_as_avg, __entry->n_wr_as_cnt,
2129 		__entry->m_wr_as_peak, __entry->m_wr_as_avg, __entry->m_wr_as_cnt)
2130 );
2131 #endif
2132 
2133 TRACE_EVENT(f2fs_bmap,
2134 
2135 	TP_PROTO(struct inode *inode, sector_t lblock, sector_t pblock),
2136 
2137 	TP_ARGS(inode, lblock, pblock),
2138 
2139 	TP_STRUCT__entry(
2140 		__field(dev_t, dev)
2141 		__field(ino_t, ino)
2142 		__field(sector_t, lblock)
2143 		__field(sector_t, pblock)
2144 	),
2145 
2146 	TP_fast_assign(
2147 		__entry->dev		= inode->i_sb->s_dev;
2148 		__entry->ino		= inode->i_ino;
2149 		__entry->lblock		= lblock;
2150 		__entry->pblock		= pblock;
2151 	),
2152 
2153 	TP_printk("dev = (%d,%d), ino = %lu, lblock:%lld, pblock:%lld",
2154 		show_dev_ino(__entry),
2155 		(unsigned long long)__entry->lblock,
2156 		(unsigned long long)__entry->pblock)
2157 );
2158 
2159 TRACE_EVENT(f2fs_fiemap,
2160 
2161 	TP_PROTO(struct inode *inode, sector_t lblock, sector_t pblock,
2162 		unsigned long long len, unsigned int flags, int ret),
2163 
2164 	TP_ARGS(inode, lblock, pblock, len, flags, ret),
2165 
2166 	TP_STRUCT__entry(
2167 		__field(dev_t, dev)
2168 		__field(ino_t, ino)
2169 		__field(sector_t, lblock)
2170 		__field(sector_t, pblock)
2171 		__field(unsigned long long, len)
2172 		__field(unsigned int, flags)
2173 		__field(int, ret)
2174 	),
2175 
2176 	TP_fast_assign(
2177 		__entry->dev		= inode->i_sb->s_dev;
2178 		__entry->ino		= inode->i_ino;
2179 		__entry->lblock		= lblock;
2180 		__entry->pblock		= pblock;
2181 		__entry->len		= len;
2182 		__entry->flags		= flags;
2183 		__entry->ret		= ret;
2184 	),
2185 
2186 	TP_printk("dev = (%d,%d), ino = %lu, lblock:%lld, pblock:%lld, "
2187 		"len:%llu, flags:%u, ret:%d",
2188 		show_dev_ino(__entry),
2189 		(unsigned long long)__entry->lblock,
2190 		(unsigned long long)__entry->pblock,
2191 		__entry->len,
2192 		__entry->flags,
2193 		__entry->ret)
2194 );
2195 
2196 DECLARE_EVENT_CLASS(f2fs__rw_start,
2197 
2198 	TP_PROTO(struct inode *inode, loff_t offset, int bytes,
2199 			pid_t pid, char *pathname, char *command),
2200 
2201 	TP_ARGS(inode, offset, bytes, pid, pathname, command),
2202 
2203 	TP_STRUCT__entry(
2204 		__string(pathbuf, pathname)
2205 		__field(loff_t, offset)
2206 		__field(int, bytes)
2207 		__field(loff_t, i_size)
2208 		__string(cmdline, command)
2209 		__field(pid_t, pid)
2210 		__field(ino_t, ino)
2211 	),
2212 
2213 	TP_fast_assign(
2214 		/*
2215 		 * Replace the spaces in filenames and cmdlines
2216 		 * because this screws up the tooling that parses
2217 		 * the traces.
2218 		 */
2219 		__assign_str(pathbuf, pathname);
2220 		(void)strreplace(__get_str(pathbuf), ' ', '_');
2221 		__entry->offset = offset;
2222 		__entry->bytes = bytes;
2223 		__entry->i_size = i_size_read(inode);
2224 		__assign_str(cmdline, command);
2225 		(void)strreplace(__get_str(cmdline), ' ', '_');
2226 		__entry->pid = pid;
2227 		__entry->ino = inode->i_ino;
2228 	),
2229 
2230 	TP_printk("entry_name %s, offset %llu, bytes %d, cmdline %s,"
2231 		" pid %d, i_size %llu, ino %lu",
2232 		__get_str(pathbuf), __entry->offset, __entry->bytes,
2233 		__get_str(cmdline), __entry->pid, __entry->i_size,
2234 		(unsigned long) __entry->ino)
2235 );
2236 
2237 DECLARE_EVENT_CLASS(f2fs__rw_end,
2238 
2239 	TP_PROTO(struct inode *inode, loff_t offset, int bytes),
2240 
2241 	TP_ARGS(inode, offset, bytes),
2242 
2243 	TP_STRUCT__entry(
2244 		__field(ino_t,	ino)
2245 		__field(loff_t,	offset)
2246 		__field(int,	bytes)
2247 	),
2248 
2249 	TP_fast_assign(
2250 		__entry->ino		= inode->i_ino;
2251 		__entry->offset		= offset;
2252 		__entry->bytes		= bytes;
2253 	),
2254 
2255 	TP_printk("ino %lu, offset %llu, bytes %d",
2256 		(unsigned long) __entry->ino,
2257 		__entry->offset, __entry->bytes)
2258 );
2259 
2260 DEFINE_EVENT(f2fs__rw_start, f2fs_dataread_start,
2261 
2262 	TP_PROTO(struct inode *inode, loff_t offset, int bytes,
2263 		pid_t pid, char *pathname, char *command),
2264 
2265 	TP_ARGS(inode, offset, bytes, pid, pathname, command)
2266 );
2267 
2268 DEFINE_EVENT(f2fs__rw_end, f2fs_dataread_end,
2269 
2270 	TP_PROTO(struct inode *inode, loff_t offset, int bytes),
2271 
2272 	TP_ARGS(inode, offset, bytes)
2273 );
2274 
2275 DEFINE_EVENT(f2fs__rw_start, f2fs_datawrite_start,
2276 
2277 	TP_PROTO(struct inode *inode, loff_t offset, int bytes,
2278 		pid_t pid, char *pathname, char *command),
2279 
2280 	TP_ARGS(inode, offset, bytes, pid, pathname, command)
2281 );
2282 
2283 DEFINE_EVENT(f2fs__rw_end, f2fs_datawrite_end,
2284 
2285 	TP_PROTO(struct inode *inode, loff_t offset, int bytes),
2286 
2287 	TP_ARGS(inode, offset, bytes)
2288 );
2289 
2290 #endif /* _TRACE_F2FS_H */
2291 
2292  /* This part must be outside protection */
2293 #include <trace/define_trace.h>
2294