xref: /openbmc/linux/include/trace/events/f2fs.h (revision aaa746ad)
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 		__field(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,
573 				int create, int flag, int ret),
574 
575 	TP_ARGS(inode, map, create, 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,	create)
588 		__field(int,	flag)
589 		__field(int,	ret)
590 	),
591 
592 	TP_fast_assign(
593 		__entry->dev		= map->m_bdev->bd_dev;
594 		__entry->ino		= inode->i_ino;
595 		__entry->m_lblk		= map->m_lblk;
596 		__entry->m_pblk		= map->m_pblk;
597 		__entry->m_len		= map->m_len;
598 		__entry->m_flags	= map->m_flags;
599 		__entry->m_seg_type	= map->m_seg_type;
600 		__entry->m_may_create	= map->m_may_create;
601 		__entry->m_multidev_dio	= map->m_multidev_dio;
602 		__entry->create		= create;
603 		__entry->flag		= flag;
604 		__entry->ret		= ret;
605 	),
606 
607 	TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, "
608 		"start blkaddr = 0x%llx, len = 0x%llx, flags = %u, "
609 		"seg_type = %d, may_create = %d, multidevice = %d, "
610 		"create = %d, flag = %d, err = %d",
611 		show_dev_ino(__entry),
612 		(unsigned long long)__entry->m_lblk,
613 		(unsigned long long)__entry->m_pblk,
614 		(unsigned long long)__entry->m_len,
615 		__entry->m_flags,
616 		__entry->m_seg_type,
617 		__entry->m_may_create,
618 		__entry->m_multidev_dio,
619 		__entry->create,
620 		__entry->flag,
621 		__entry->ret)
622 );
623 
624 TRACE_EVENT(f2fs_background_gc,
625 
626 	TP_PROTO(struct super_block *sb, unsigned int wait_ms,
627 			unsigned int prefree, unsigned int free),
628 
629 	TP_ARGS(sb, wait_ms, prefree, free),
630 
631 	TP_STRUCT__entry(
632 		__field(dev_t,	dev)
633 		__field(unsigned int,	wait_ms)
634 		__field(unsigned int,	prefree)
635 		__field(unsigned int,	free)
636 	),
637 
638 	TP_fast_assign(
639 		__entry->dev		= sb->s_dev;
640 		__entry->wait_ms	= wait_ms;
641 		__entry->prefree	= prefree;
642 		__entry->free		= free;
643 	),
644 
645 	TP_printk("dev = (%d,%d), wait_ms = %u, prefree = %u, free = %u",
646 		show_dev(__entry->dev),
647 		__entry->wait_ms,
648 		__entry->prefree,
649 		__entry->free)
650 );
651 
652 TRACE_EVENT(f2fs_gc_begin,
653 
654 	TP_PROTO(struct super_block *sb, int gc_type, bool no_bg_gc,
655 			unsigned int nr_free_secs,
656 			long long dirty_nodes, long long dirty_dents,
657 			long long dirty_imeta, unsigned int free_sec,
658 			unsigned int free_seg, int reserved_seg,
659 			unsigned int prefree_seg),
660 
661 	TP_ARGS(sb, gc_type, no_bg_gc, nr_free_secs, dirty_nodes,
662 		dirty_dents, dirty_imeta,
663 		free_sec, free_seg, reserved_seg, prefree_seg),
664 
665 	TP_STRUCT__entry(
666 		__field(dev_t,		dev)
667 		__field(int,		gc_type)
668 		__field(bool,		no_bg_gc)
669 		__field(unsigned int,	nr_free_secs)
670 		__field(long long,	dirty_nodes)
671 		__field(long long,	dirty_dents)
672 		__field(long long,	dirty_imeta)
673 		__field(unsigned int,	free_sec)
674 		__field(unsigned int,	free_seg)
675 		__field(int,		reserved_seg)
676 		__field(unsigned int,	prefree_seg)
677 	),
678 
679 	TP_fast_assign(
680 		__entry->dev		= sb->s_dev;
681 		__entry->gc_type	= gc_type;
682 		__entry->no_bg_gc	= no_bg_gc;
683 		__entry->nr_free_secs	= nr_free_secs;
684 		__entry->dirty_nodes	= dirty_nodes;
685 		__entry->dirty_dents	= dirty_dents;
686 		__entry->dirty_imeta	= dirty_imeta;
687 		__entry->free_sec	= free_sec;
688 		__entry->free_seg	= free_seg;
689 		__entry->reserved_seg	= reserved_seg;
690 		__entry->prefree_seg	= prefree_seg;
691 	),
692 
693 	TP_printk("dev = (%d,%d), gc_type = %s, no_background_GC = %d, nr_free_secs = %u, "
694 		"nodes = %lld, dents = %lld, imeta = %lld, free_sec:%u, free_seg:%u, "
695 		"rsv_seg:%d, prefree_seg:%u",
696 		show_dev(__entry->dev),
697 		show_gc_type(__entry->gc_type),
698 		(__entry->gc_type == BG_GC) ? __entry->no_bg_gc : -1,
699 		__entry->nr_free_secs,
700 		__entry->dirty_nodes,
701 		__entry->dirty_dents,
702 		__entry->dirty_imeta,
703 		__entry->free_sec,
704 		__entry->free_seg,
705 		__entry->reserved_seg,
706 		__entry->prefree_seg)
707 );
708 
709 TRACE_EVENT(f2fs_gc_end,
710 
711 	TP_PROTO(struct super_block *sb, int ret, int seg_freed,
712 			int sec_freed, long long dirty_nodes,
713 			long long dirty_dents, long long dirty_imeta,
714 			unsigned int free_sec, unsigned int free_seg,
715 			int reserved_seg, unsigned int prefree_seg),
716 
717 	TP_ARGS(sb, ret, seg_freed, sec_freed, dirty_nodes, dirty_dents,
718 		dirty_imeta, free_sec, free_seg, reserved_seg, prefree_seg),
719 
720 	TP_STRUCT__entry(
721 		__field(dev_t,		dev)
722 		__field(int,		ret)
723 		__field(int,		seg_freed)
724 		__field(int,		sec_freed)
725 		__field(long long,	dirty_nodes)
726 		__field(long long,	dirty_dents)
727 		__field(long long,	dirty_imeta)
728 		__field(unsigned int,	free_sec)
729 		__field(unsigned int,	free_seg)
730 		__field(int,		reserved_seg)
731 		__field(unsigned int,	prefree_seg)
732 	),
733 
734 	TP_fast_assign(
735 		__entry->dev		= sb->s_dev;
736 		__entry->ret		= ret;
737 		__entry->seg_freed	= seg_freed;
738 		__entry->sec_freed	= sec_freed;
739 		__entry->dirty_nodes	= dirty_nodes;
740 		__entry->dirty_dents	= dirty_dents;
741 		__entry->dirty_imeta	= dirty_imeta;
742 		__entry->free_sec	= free_sec;
743 		__entry->free_seg	= free_seg;
744 		__entry->reserved_seg	= reserved_seg;
745 		__entry->prefree_seg	= prefree_seg;
746 	),
747 
748 	TP_printk("dev = (%d,%d), ret = %d, seg_freed = %d, sec_freed = %d, "
749 		"nodes = %lld, dents = %lld, imeta = %lld, free_sec:%u, "
750 		"free_seg:%u, rsv_seg:%d, prefree_seg:%u",
751 		show_dev(__entry->dev),
752 		__entry->ret,
753 		__entry->seg_freed,
754 		__entry->sec_freed,
755 		__entry->dirty_nodes,
756 		__entry->dirty_dents,
757 		__entry->dirty_imeta,
758 		__entry->free_sec,
759 		__entry->free_seg,
760 		__entry->reserved_seg,
761 		__entry->prefree_seg)
762 );
763 
764 TRACE_EVENT(f2fs_get_victim,
765 
766 	TP_PROTO(struct super_block *sb, int type, int gc_type,
767 			struct victim_sel_policy *p, unsigned int pre_victim,
768 			unsigned int prefree, unsigned int free),
769 
770 	TP_ARGS(sb, type, gc_type, p, pre_victim, prefree, free),
771 
772 	TP_STRUCT__entry(
773 		__field(dev_t,	dev)
774 		__field(int,	type)
775 		__field(int,	gc_type)
776 		__field(int,	alloc_mode)
777 		__field(int,	gc_mode)
778 		__field(unsigned int,	victim)
779 		__field(unsigned int,	cost)
780 		__field(unsigned int,	ofs_unit)
781 		__field(unsigned int,	pre_victim)
782 		__field(unsigned int,	prefree)
783 		__field(unsigned int,	free)
784 	),
785 
786 	TP_fast_assign(
787 		__entry->dev		= sb->s_dev;
788 		__entry->type		= type;
789 		__entry->gc_type	= gc_type;
790 		__entry->alloc_mode	= p->alloc_mode;
791 		__entry->gc_mode	= p->gc_mode;
792 		__entry->victim		= p->min_segno;
793 		__entry->cost		= p->min_cost;
794 		__entry->ofs_unit	= p->ofs_unit;
795 		__entry->pre_victim	= pre_victim;
796 		__entry->prefree	= prefree;
797 		__entry->free		= free;
798 	),
799 
800 	TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), "
801 		"victim = %u, cost = %u, ofs_unit = %u, "
802 		"pre_victim_secno = %d, prefree = %u, free = %u",
803 		show_dev(__entry->dev),
804 		show_data_type(__entry->type),
805 		show_gc_type(__entry->gc_type),
806 		show_alloc_mode(__entry->alloc_mode),
807 		show_victim_policy(__entry->gc_mode),
808 		__entry->victim,
809 		__entry->cost,
810 		__entry->ofs_unit,
811 		(int)__entry->pre_victim,
812 		__entry->prefree,
813 		__entry->free)
814 );
815 
816 TRACE_EVENT(f2fs_lookup_start,
817 
818 	TP_PROTO(struct inode *dir, struct dentry *dentry, unsigned int flags),
819 
820 	TP_ARGS(dir, dentry, flags),
821 
822 	TP_STRUCT__entry(
823 		__field(dev_t,	dev)
824 		__field(ino_t,	ino)
825 		__string(name,	dentry->d_name.name)
826 		__field(unsigned int, flags)
827 	),
828 
829 	TP_fast_assign(
830 		__entry->dev	= dir->i_sb->s_dev;
831 		__entry->ino	= dir->i_ino;
832 		__assign_str(name, dentry->d_name.name);
833 		__entry->flags	= flags;
834 	),
835 
836 	TP_printk("dev = (%d,%d), pino = %lu, name:%s, flags:%u",
837 		show_dev_ino(__entry),
838 		__get_str(name),
839 		__entry->flags)
840 );
841 
842 TRACE_EVENT(f2fs_lookup_end,
843 
844 	TP_PROTO(struct inode *dir, struct dentry *dentry, nid_t ino,
845 		int err),
846 
847 	TP_ARGS(dir, dentry, ino, err),
848 
849 	TP_STRUCT__entry(
850 		__field(dev_t,	dev)
851 		__field(ino_t,	ino)
852 		__string(name,	dentry->d_name.name)
853 		__field(nid_t,	cino)
854 		__field(int,	err)
855 	),
856 
857 	TP_fast_assign(
858 		__entry->dev	= dir->i_sb->s_dev;
859 		__entry->ino	= dir->i_ino;
860 		__assign_str(name, dentry->d_name.name);
861 		__entry->cino	= ino;
862 		__entry->err	= err;
863 	),
864 
865 	TP_printk("dev = (%d,%d), pino = %lu, name:%s, ino:%u, err:%d",
866 		show_dev_ino(__entry),
867 		__get_str(name),
868 		__entry->cino,
869 		__entry->err)
870 );
871 
872 TRACE_EVENT(f2fs_readdir,
873 
874 	TP_PROTO(struct inode *dir, loff_t start_pos, loff_t end_pos, int err),
875 
876 	TP_ARGS(dir, start_pos, end_pos, err),
877 
878 	TP_STRUCT__entry(
879 		__field(dev_t,	dev)
880 		__field(ino_t,	ino)
881 		__field(loff_t,	start)
882 		__field(loff_t,	end)
883 		__field(int,	err)
884 	),
885 
886 	TP_fast_assign(
887 		__entry->dev	= dir->i_sb->s_dev;
888 		__entry->ino	= dir->i_ino;
889 		__entry->start	= start_pos;
890 		__entry->end	= end_pos;
891 		__entry->err	= err;
892 	),
893 
894 	TP_printk("dev = (%d,%d), ino = %lu, start_pos:%llu, end_pos:%llu, err:%d",
895 		show_dev_ino(__entry),
896 		__entry->start,
897 		__entry->end,
898 		__entry->err)
899 );
900 
901 TRACE_EVENT(f2fs_fallocate,
902 
903 	TP_PROTO(struct inode *inode, int mode,
904 				loff_t offset, loff_t len, int ret),
905 
906 	TP_ARGS(inode, mode, offset, len, ret),
907 
908 	TP_STRUCT__entry(
909 		__field(dev_t,	dev)
910 		__field(ino_t,	ino)
911 		__field(int,	mode)
912 		__field(loff_t,	offset)
913 		__field(loff_t,	len)
914 		__field(loff_t, size)
915 		__field(blkcnt_t, blocks)
916 		__field(int,	ret)
917 	),
918 
919 	TP_fast_assign(
920 		__entry->dev	= inode->i_sb->s_dev;
921 		__entry->ino	= inode->i_ino;
922 		__entry->mode	= mode;
923 		__entry->offset	= offset;
924 		__entry->len	= len;
925 		__entry->size	= inode->i_size;
926 		__entry->blocks = inode->i_blocks;
927 		__entry->ret	= ret;
928 	),
929 
930 	TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, "
931 		"len = %lld,  i_size = %lld, i_blocks = %llu, ret = %d",
932 		show_dev_ino(__entry),
933 		__entry->mode,
934 		(unsigned long long)__entry->offset,
935 		(unsigned long long)__entry->len,
936 		(unsigned long long)__entry->size,
937 		(unsigned long long)__entry->blocks,
938 		__entry->ret)
939 );
940 
941 TRACE_EVENT(f2fs_direct_IO_enter,
942 
943 	TP_PROTO(struct inode *inode, struct kiocb *iocb, long len, int rw),
944 
945 	TP_ARGS(inode, iocb, len, rw),
946 
947 	TP_STRUCT__entry(
948 		__field(dev_t,	dev)
949 		__field(ino_t,	ino)
950 		__field(loff_t,	ki_pos)
951 		__field(int,	ki_flags)
952 		__field(u16,	ki_ioprio)
953 		__field(unsigned long,	len)
954 		__field(int,	rw)
955 	),
956 
957 	TP_fast_assign(
958 		__entry->dev		= inode->i_sb->s_dev;
959 		__entry->ino		= inode->i_ino;
960 		__entry->ki_pos		= iocb->ki_pos;
961 		__entry->ki_flags	= iocb->ki_flags;
962 		__entry->ki_ioprio	= iocb->ki_ioprio;
963 		__entry->len		= len;
964 		__entry->rw		= rw;
965 	),
966 
967 	TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu ki_flags = %x ki_ioprio = %x rw = %d",
968 		show_dev_ino(__entry),
969 		__entry->ki_pos,
970 		__entry->len,
971 		__entry->ki_flags,
972 		__entry->ki_ioprio,
973 		__entry->rw)
974 );
975 
976 TRACE_EVENT(f2fs_direct_IO_exit,
977 
978 	TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
979 		 int rw, int ret),
980 
981 	TP_ARGS(inode, offset, len, rw, ret),
982 
983 	TP_STRUCT__entry(
984 		__field(dev_t,	dev)
985 		__field(ino_t,	ino)
986 		__field(loff_t,	pos)
987 		__field(unsigned long,	len)
988 		__field(int,	rw)
989 		__field(int,	ret)
990 	),
991 
992 	TP_fast_assign(
993 		__entry->dev	= inode->i_sb->s_dev;
994 		__entry->ino	= inode->i_ino;
995 		__entry->pos	= offset;
996 		__entry->len	= len;
997 		__entry->rw	= rw;
998 		__entry->ret	= ret;
999 	),
1000 
1001 	TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu "
1002 		"rw = %d ret = %d",
1003 		show_dev_ino(__entry),
1004 		__entry->pos,
1005 		__entry->len,
1006 		__entry->rw,
1007 		__entry->ret)
1008 );
1009 
1010 TRACE_EVENT(f2fs_reserve_new_blocks,
1011 
1012 	TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs_in_node,
1013 							blkcnt_t count),
1014 
1015 	TP_ARGS(inode, nid, ofs_in_node, count),
1016 
1017 	TP_STRUCT__entry(
1018 		__field(dev_t,	dev)
1019 		__field(nid_t, nid)
1020 		__field(unsigned int, ofs_in_node)
1021 		__field(blkcnt_t, count)
1022 	),
1023 
1024 	TP_fast_assign(
1025 		__entry->dev	= inode->i_sb->s_dev;
1026 		__entry->nid	= nid;
1027 		__entry->ofs_in_node = ofs_in_node;
1028 		__entry->count = count;
1029 	),
1030 
1031 	TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u, count = %llu",
1032 		show_dev(__entry->dev),
1033 		(unsigned int)__entry->nid,
1034 		__entry->ofs_in_node,
1035 		(unsigned long long)__entry->count)
1036 );
1037 
1038 DECLARE_EVENT_CLASS(f2fs__submit_page_bio,
1039 
1040 	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
1041 
1042 	TP_ARGS(page, fio),
1043 
1044 	TP_STRUCT__entry(
1045 		__field(dev_t, dev)
1046 		__field(ino_t, ino)
1047 		__field(pgoff_t, index)
1048 		__field(block_t, old_blkaddr)
1049 		__field(block_t, new_blkaddr)
1050 		__field(enum req_op, op)
1051 		__field(blk_opf_t, op_flags)
1052 		__field(int, temp)
1053 		__field(int, type)
1054 	),
1055 
1056 	TP_fast_assign(
1057 		__entry->dev		= page_file_mapping(page)->host->i_sb->s_dev;
1058 		__entry->ino		= page_file_mapping(page)->host->i_ino;
1059 		__entry->index		= page->index;
1060 		__entry->old_blkaddr	= fio->old_blkaddr;
1061 		__entry->new_blkaddr	= fio->new_blkaddr;
1062 		__entry->op		= fio->op;
1063 		__entry->op_flags	= fio->op_flags;
1064 		__entry->temp		= fio->temp;
1065 		__entry->type		= fio->type;
1066 	),
1067 
1068 	TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, "
1069 		"oldaddr = 0x%llx, newaddr = 0x%llx, rw = %s(%s), type = %s_%s",
1070 		show_dev_ino(__entry),
1071 		(unsigned long)__entry->index,
1072 		(unsigned long long)__entry->old_blkaddr,
1073 		(unsigned long long)__entry->new_blkaddr,
1074 		show_bio_type(__entry->op, __entry->op_flags),
1075 		show_block_temp(__entry->temp),
1076 		show_block_type(__entry->type))
1077 );
1078 
1079 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_bio,
1080 
1081 	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
1082 
1083 	TP_ARGS(page, fio),
1084 
1085 	TP_CONDITION(page->mapping)
1086 );
1087 
1088 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_write,
1089 
1090 	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
1091 
1092 	TP_ARGS(page, fio),
1093 
1094 	TP_CONDITION(page->mapping)
1095 );
1096 
1097 DECLARE_EVENT_CLASS(f2fs__bio,
1098 
1099 	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1100 
1101 	TP_ARGS(sb, type, bio),
1102 
1103 	TP_STRUCT__entry(
1104 		__field(dev_t,	dev)
1105 		__field(dev_t,	target)
1106 		__field(enum req_op,	op)
1107 		__field(blk_opf_t,	op_flags)
1108 		__field(int,	type)
1109 		__field(sector_t,	sector)
1110 		__field(unsigned int,	size)
1111 	),
1112 
1113 	TP_fast_assign(
1114 		__entry->dev		= sb->s_dev;
1115 		__entry->target		= bio_dev(bio);
1116 		__entry->op		= bio_op(bio);
1117 		__entry->op_flags	= bio->bi_opf;
1118 		__entry->type		= type;
1119 		__entry->sector		= bio->bi_iter.bi_sector;
1120 		__entry->size		= bio->bi_iter.bi_size;
1121 	),
1122 
1123 	TP_printk("dev = (%d,%d)/(%d,%d), rw = %s(%s), %s, sector = %lld, size = %u",
1124 		show_dev(__entry->target),
1125 		show_dev(__entry->dev),
1126 		show_bio_type(__entry->op, __entry->op_flags),
1127 		show_block_type(__entry->type),
1128 		(unsigned long long)__entry->sector,
1129 		__entry->size)
1130 );
1131 
1132 DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_prepare_write_bio,
1133 
1134 	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1135 
1136 	TP_ARGS(sb, type, bio),
1137 
1138 	TP_CONDITION(bio)
1139 );
1140 
1141 DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_prepare_read_bio,
1142 
1143 	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1144 
1145 	TP_ARGS(sb, type, bio),
1146 
1147 	TP_CONDITION(bio)
1148 );
1149 
1150 DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_read_bio,
1151 
1152 	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1153 
1154 	TP_ARGS(sb, type, bio),
1155 
1156 	TP_CONDITION(bio)
1157 );
1158 
1159 DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_write_bio,
1160 
1161 	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1162 
1163 	TP_ARGS(sb, type, bio),
1164 
1165 	TP_CONDITION(bio)
1166 );
1167 
1168 TRACE_EVENT(f2fs_write_begin,
1169 
1170 	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len),
1171 
1172 	TP_ARGS(inode, pos, len),
1173 
1174 	TP_STRUCT__entry(
1175 		__field(dev_t,	dev)
1176 		__field(ino_t,	ino)
1177 		__field(loff_t,	pos)
1178 		__field(unsigned int, len)
1179 	),
1180 
1181 	TP_fast_assign(
1182 		__entry->dev	= inode->i_sb->s_dev;
1183 		__entry->ino	= inode->i_ino;
1184 		__entry->pos	= pos;
1185 		__entry->len	= len;
1186 	),
1187 
1188 	TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u",
1189 		show_dev_ino(__entry),
1190 		(unsigned long long)__entry->pos,
1191 		__entry->len)
1192 );
1193 
1194 TRACE_EVENT(f2fs_write_end,
1195 
1196 	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
1197 				unsigned int copied),
1198 
1199 	TP_ARGS(inode, pos, len, copied),
1200 
1201 	TP_STRUCT__entry(
1202 		__field(dev_t,	dev)
1203 		__field(ino_t,	ino)
1204 		__field(loff_t,	pos)
1205 		__field(unsigned int, len)
1206 		__field(unsigned int, copied)
1207 	),
1208 
1209 	TP_fast_assign(
1210 		__entry->dev	= inode->i_sb->s_dev;
1211 		__entry->ino	= inode->i_ino;
1212 		__entry->pos	= pos;
1213 		__entry->len	= len;
1214 		__entry->copied	= copied;
1215 	),
1216 
1217 	TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u",
1218 		show_dev_ino(__entry),
1219 		(unsigned long long)__entry->pos,
1220 		__entry->len,
1221 		__entry->copied)
1222 );
1223 
1224 DECLARE_EVENT_CLASS(f2fs__page,
1225 
1226 	TP_PROTO(struct page *page, int type),
1227 
1228 	TP_ARGS(page, type),
1229 
1230 	TP_STRUCT__entry(
1231 		__field(dev_t,	dev)
1232 		__field(ino_t,	ino)
1233 		__field(int, type)
1234 		__field(int, dir)
1235 		__field(pgoff_t, index)
1236 		__field(int, dirty)
1237 		__field(int, uptodate)
1238 	),
1239 
1240 	TP_fast_assign(
1241 		__entry->dev	= page_file_mapping(page)->host->i_sb->s_dev;
1242 		__entry->ino	= page_file_mapping(page)->host->i_ino;
1243 		__entry->type	= type;
1244 		__entry->dir	=
1245 			S_ISDIR(page_file_mapping(page)->host->i_mode);
1246 		__entry->index	= page->index;
1247 		__entry->dirty	= PageDirty(page);
1248 		__entry->uptodate = PageUptodate(page);
1249 	),
1250 
1251 	TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, "
1252 		"dirty = %d, uptodate = %d",
1253 		show_dev_ino(__entry),
1254 		show_block_type(__entry->type),
1255 		show_file_type(__entry->dir),
1256 		(unsigned long)__entry->index,
1257 		__entry->dirty,
1258 		__entry->uptodate)
1259 );
1260 
1261 DEFINE_EVENT(f2fs__page, f2fs_writepage,
1262 
1263 	TP_PROTO(struct page *page, int type),
1264 
1265 	TP_ARGS(page, type)
1266 );
1267 
1268 DEFINE_EVENT(f2fs__page, f2fs_do_write_data_page,
1269 
1270 	TP_PROTO(struct page *page, int type),
1271 
1272 	TP_ARGS(page, type)
1273 );
1274 
1275 DEFINE_EVENT(f2fs__page, f2fs_readpage,
1276 
1277 	TP_PROTO(struct page *page, int type),
1278 
1279 	TP_ARGS(page, type)
1280 );
1281 
1282 DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty,
1283 
1284 	TP_PROTO(struct page *page, int type),
1285 
1286 	TP_ARGS(page, type)
1287 );
1288 
1289 DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite,
1290 
1291 	TP_PROTO(struct page *page, int type),
1292 
1293 	TP_ARGS(page, type)
1294 );
1295 
1296 TRACE_EVENT(f2fs_filemap_fault,
1297 
1298 	TP_PROTO(struct inode *inode, pgoff_t index, unsigned long ret),
1299 
1300 	TP_ARGS(inode, index, ret),
1301 
1302 	TP_STRUCT__entry(
1303 		__field(dev_t,	dev)
1304 		__field(ino_t,	ino)
1305 		__field(pgoff_t, index)
1306 		__field(unsigned long, ret)
1307 	),
1308 
1309 	TP_fast_assign(
1310 		__entry->dev	= inode->i_sb->s_dev;
1311 		__entry->ino	= inode->i_ino;
1312 		__entry->index	= index;
1313 		__entry->ret	= ret;
1314 	),
1315 
1316 	TP_printk("dev = (%d,%d), ino = %lu, index = %lu, ret = %lx",
1317 		show_dev_ino(__entry),
1318 		(unsigned long)__entry->index,
1319 		__entry->ret)
1320 );
1321 
1322 TRACE_EVENT(f2fs_writepages,
1323 
1324 	TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type),
1325 
1326 	TP_ARGS(inode, wbc, type),
1327 
1328 	TP_STRUCT__entry(
1329 		__field(dev_t,	dev)
1330 		__field(ino_t,	ino)
1331 		__field(int,	type)
1332 		__field(int,	dir)
1333 		__field(long,	nr_to_write)
1334 		__field(long,	pages_skipped)
1335 		__field(loff_t,	range_start)
1336 		__field(loff_t,	range_end)
1337 		__field(pgoff_t, writeback_index)
1338 		__field(int,	sync_mode)
1339 		__field(char,	for_kupdate)
1340 		__field(char,	for_background)
1341 		__field(char,	tagged_writepages)
1342 		__field(char,	for_reclaim)
1343 		__field(char,	range_cyclic)
1344 		__field(char,	for_sync)
1345 	),
1346 
1347 	TP_fast_assign(
1348 		__entry->dev		= inode->i_sb->s_dev;
1349 		__entry->ino		= inode->i_ino;
1350 		__entry->type		= type;
1351 		__entry->dir		= S_ISDIR(inode->i_mode);
1352 		__entry->nr_to_write	= wbc->nr_to_write;
1353 		__entry->pages_skipped	= wbc->pages_skipped;
1354 		__entry->range_start	= wbc->range_start;
1355 		__entry->range_end	= wbc->range_end;
1356 		__entry->writeback_index = inode->i_mapping->writeback_index;
1357 		__entry->sync_mode	= wbc->sync_mode;
1358 		__entry->for_kupdate	= wbc->for_kupdate;
1359 		__entry->for_background	= wbc->for_background;
1360 		__entry->tagged_writepages	= wbc->tagged_writepages;
1361 		__entry->for_reclaim	= wbc->for_reclaim;
1362 		__entry->range_cyclic	= wbc->range_cyclic;
1363 		__entry->for_sync	= wbc->for_sync;
1364 	),
1365 
1366 	TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
1367 		"skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
1368 		"kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
1369 		show_dev_ino(__entry),
1370 		show_block_type(__entry->type),
1371 		show_file_type(__entry->dir),
1372 		__entry->nr_to_write,
1373 		__entry->pages_skipped,
1374 		__entry->range_start,
1375 		__entry->range_end,
1376 		(unsigned long)__entry->writeback_index,
1377 		__entry->sync_mode,
1378 		__entry->for_kupdate,
1379 		__entry->for_background,
1380 		__entry->tagged_writepages,
1381 		__entry->for_reclaim,
1382 		__entry->range_cyclic,
1383 		__entry->for_sync)
1384 );
1385 
1386 TRACE_EVENT(f2fs_readpages,
1387 
1388 	TP_PROTO(struct inode *inode, pgoff_t start, unsigned int nrpage),
1389 
1390 	TP_ARGS(inode, start, nrpage),
1391 
1392 	TP_STRUCT__entry(
1393 		__field(dev_t,	dev)
1394 		__field(ino_t,	ino)
1395 		__field(pgoff_t,	start)
1396 		__field(unsigned int,	nrpage)
1397 	),
1398 
1399 	TP_fast_assign(
1400 		__entry->dev	= inode->i_sb->s_dev;
1401 		__entry->ino	= inode->i_ino;
1402 		__entry->start	= start;
1403 		__entry->nrpage	= nrpage;
1404 	),
1405 
1406 	TP_printk("dev = (%d,%d), ino = %lu, start = %lu nrpage = %u",
1407 		show_dev_ino(__entry),
1408 		(unsigned long)__entry->start,
1409 		__entry->nrpage)
1410 );
1411 
1412 TRACE_EVENT(f2fs_write_checkpoint,
1413 
1414 	TP_PROTO(struct super_block *sb, int reason, const char *msg),
1415 
1416 	TP_ARGS(sb, reason, msg),
1417 
1418 	TP_STRUCT__entry(
1419 		__field(dev_t,	dev)
1420 		__field(int,	reason)
1421 		__string(dest_msg, msg)
1422 	),
1423 
1424 	TP_fast_assign(
1425 		__entry->dev		= sb->s_dev;
1426 		__entry->reason		= reason;
1427 		__assign_str(dest_msg, msg);
1428 	),
1429 
1430 	TP_printk("dev = (%d,%d), checkpoint for %s, state = %s",
1431 		show_dev(__entry->dev),
1432 		show_cpreason(__entry->reason),
1433 		__get_str(dest_msg))
1434 );
1435 
1436 DECLARE_EVENT_CLASS(f2fs_discard,
1437 
1438 	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1439 
1440 	TP_ARGS(dev, blkstart, blklen),
1441 
1442 	TP_STRUCT__entry(
1443 		__field(dev_t,	dev)
1444 		__field(block_t, blkstart)
1445 		__field(block_t, blklen)
1446 	),
1447 
1448 	TP_fast_assign(
1449 		__entry->dev	= dev->bd_dev;
1450 		__entry->blkstart = blkstart;
1451 		__entry->blklen = blklen;
1452 	),
1453 
1454 	TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx",
1455 		show_dev(__entry->dev),
1456 		(unsigned long long)__entry->blkstart,
1457 		(unsigned long long)__entry->blklen)
1458 );
1459 
1460 DEFINE_EVENT(f2fs_discard, f2fs_queue_discard,
1461 
1462 	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1463 
1464 	TP_ARGS(dev, blkstart, blklen)
1465 );
1466 
1467 DEFINE_EVENT(f2fs_discard, f2fs_issue_discard,
1468 
1469 	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1470 
1471 	TP_ARGS(dev, blkstart, blklen)
1472 );
1473 
1474 DEFINE_EVENT(f2fs_discard, f2fs_remove_discard,
1475 
1476 	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1477 
1478 	TP_ARGS(dev, blkstart, blklen)
1479 );
1480 
1481 TRACE_EVENT(f2fs_issue_reset_zone,
1482 
1483 	TP_PROTO(struct block_device *dev, block_t blkstart),
1484 
1485 	TP_ARGS(dev, blkstart),
1486 
1487 	TP_STRUCT__entry(
1488 		__field(dev_t,	dev)
1489 		__field(block_t, blkstart)
1490 	),
1491 
1492 	TP_fast_assign(
1493 		__entry->dev	= dev->bd_dev;
1494 		__entry->blkstart = blkstart;
1495 	),
1496 
1497 	TP_printk("dev = (%d,%d), reset zone at block = 0x%llx",
1498 		show_dev(__entry->dev),
1499 		(unsigned long long)__entry->blkstart)
1500 );
1501 
1502 TRACE_EVENT(f2fs_issue_flush,
1503 
1504 	TP_PROTO(struct block_device *dev, unsigned int nobarrier,
1505 				unsigned int flush_merge, int ret),
1506 
1507 	TP_ARGS(dev, nobarrier, flush_merge, ret),
1508 
1509 	TP_STRUCT__entry(
1510 		__field(dev_t,	dev)
1511 		__field(unsigned int, nobarrier)
1512 		__field(unsigned int, flush_merge)
1513 		__field(int,  ret)
1514 	),
1515 
1516 	TP_fast_assign(
1517 		__entry->dev	= dev->bd_dev;
1518 		__entry->nobarrier = nobarrier;
1519 		__entry->flush_merge = flush_merge;
1520 		__entry->ret = ret;
1521 	),
1522 
1523 	TP_printk("dev = (%d,%d), %s %s, ret = %d",
1524 		show_dev(__entry->dev),
1525 		__entry->nobarrier ? "skip (nobarrier)" : "issue",
1526 		__entry->flush_merge ? " with flush_merge" : "",
1527 		__entry->ret)
1528 );
1529 
1530 TRACE_EVENT(f2fs_lookup_extent_tree_start,
1531 
1532 	TP_PROTO(struct inode *inode, unsigned int pgofs, enum extent_type type),
1533 
1534 	TP_ARGS(inode, pgofs, type),
1535 
1536 	TP_STRUCT__entry(
1537 		__field(dev_t,	dev)
1538 		__field(ino_t,	ino)
1539 		__field(unsigned int, pgofs)
1540 		__field(enum extent_type, type)
1541 	),
1542 
1543 	TP_fast_assign(
1544 		__entry->dev = inode->i_sb->s_dev;
1545 		__entry->ino = inode->i_ino;
1546 		__entry->pgofs = pgofs;
1547 		__entry->type = type;
1548 	),
1549 
1550 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, type = %s",
1551 		show_dev_ino(__entry),
1552 		__entry->pgofs,
1553 		show_extent_type(__entry->type))
1554 );
1555 
1556 TRACE_EVENT_CONDITION(f2fs_lookup_read_extent_tree_end,
1557 
1558 	TP_PROTO(struct inode *inode, unsigned int pgofs,
1559 						struct extent_info *ei),
1560 
1561 	TP_ARGS(inode, pgofs, ei),
1562 
1563 	TP_CONDITION(ei),
1564 
1565 	TP_STRUCT__entry(
1566 		__field(dev_t,	dev)
1567 		__field(ino_t,	ino)
1568 		__field(unsigned int, pgofs)
1569 		__field(unsigned int, fofs)
1570 		__field(unsigned int, len)
1571 		__field(u32, blk)
1572 	),
1573 
1574 	TP_fast_assign(
1575 		__entry->dev = inode->i_sb->s_dev;
1576 		__entry->ino = inode->i_ino;
1577 		__entry->pgofs = pgofs;
1578 		__entry->fofs = ei->fofs;
1579 		__entry->len = ei->len;
1580 		__entry->blk = ei->blk;
1581 	),
1582 
1583 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1584 		"read_ext_info(fofs: %u, len: %u, blk: %u)",
1585 		show_dev_ino(__entry),
1586 		__entry->pgofs,
1587 		__entry->fofs,
1588 		__entry->len,
1589 		__entry->blk)
1590 );
1591 
1592 TRACE_EVENT_CONDITION(f2fs_lookup_age_extent_tree_end,
1593 
1594 	TP_PROTO(struct inode *inode, unsigned int pgofs,
1595 						struct extent_info *ei),
1596 
1597 	TP_ARGS(inode, pgofs, ei),
1598 
1599 	TP_CONDITION(ei),
1600 
1601 	TP_STRUCT__entry(
1602 		__field(dev_t,	dev)
1603 		__field(ino_t,	ino)
1604 		__field(unsigned int, pgofs)
1605 		__field(unsigned int, fofs)
1606 		__field(unsigned int, len)
1607 		__field(unsigned long long, age)
1608 		__field(unsigned long long, blocks)
1609 	),
1610 
1611 	TP_fast_assign(
1612 		__entry->dev = inode->i_sb->s_dev;
1613 		__entry->ino = inode->i_ino;
1614 		__entry->pgofs = pgofs;
1615 		__entry->fofs = ei->fofs;
1616 		__entry->len = ei->len;
1617 		__entry->age = ei->age;
1618 		__entry->blocks = ei->last_blocks;
1619 	),
1620 
1621 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1622 		"age_ext_info(fofs: %u, len: %u, age: %llu, blocks: %llu)",
1623 		show_dev_ino(__entry),
1624 		__entry->pgofs,
1625 		__entry->fofs,
1626 		__entry->len,
1627 		__entry->age,
1628 		__entry->blocks)
1629 );
1630 
1631 TRACE_EVENT(f2fs_update_read_extent_tree_range,
1632 
1633 	TP_PROTO(struct inode *inode, unsigned int pgofs, unsigned int len,
1634 						block_t blkaddr,
1635 						unsigned int c_len),
1636 
1637 	TP_ARGS(inode, pgofs, len, blkaddr, c_len),
1638 
1639 	TP_STRUCT__entry(
1640 		__field(dev_t,	dev)
1641 		__field(ino_t,	ino)
1642 		__field(unsigned int, pgofs)
1643 		__field(u32, blk)
1644 		__field(unsigned int, len)
1645 		__field(unsigned int, c_len)
1646 	),
1647 
1648 	TP_fast_assign(
1649 		__entry->dev = inode->i_sb->s_dev;
1650 		__entry->ino = inode->i_ino;
1651 		__entry->pgofs = pgofs;
1652 		__entry->len = len;
1653 		__entry->blk = blkaddr;
1654 		__entry->c_len = c_len;
1655 	),
1656 
1657 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1658 				"len = %u, blkaddr = %u, c_len = %u",
1659 		show_dev_ino(__entry),
1660 		__entry->pgofs,
1661 		__entry->len,
1662 		__entry->blk,
1663 		__entry->c_len)
1664 );
1665 
1666 TRACE_EVENT(f2fs_update_age_extent_tree_range,
1667 
1668 	TP_PROTO(struct inode *inode, unsigned int pgofs, unsigned int len,
1669 					unsigned long long age,
1670 					unsigned long long last_blks),
1671 
1672 	TP_ARGS(inode, pgofs, len, age, last_blks),
1673 
1674 	TP_STRUCT__entry(
1675 		__field(dev_t,	dev)
1676 		__field(ino_t,	ino)
1677 		__field(unsigned int, pgofs)
1678 		__field(unsigned int, len)
1679 		__field(unsigned long long, age)
1680 		__field(unsigned long long, blocks)
1681 	),
1682 
1683 	TP_fast_assign(
1684 		__entry->dev = inode->i_sb->s_dev;
1685 		__entry->ino = inode->i_ino;
1686 		__entry->pgofs = pgofs;
1687 		__entry->len = len;
1688 		__entry->age = age;
1689 		__entry->blocks = last_blks;
1690 	),
1691 
1692 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1693 				"len = %u, age = %llu, blocks = %llu",
1694 		show_dev_ino(__entry),
1695 		__entry->pgofs,
1696 		__entry->len,
1697 		__entry->age,
1698 		__entry->blocks)
1699 );
1700 
1701 TRACE_EVENT(f2fs_shrink_extent_tree,
1702 
1703 	TP_PROTO(struct f2fs_sb_info *sbi, unsigned int node_cnt,
1704 			unsigned int tree_cnt, enum extent_type type),
1705 
1706 	TP_ARGS(sbi, node_cnt, tree_cnt, type),
1707 
1708 	TP_STRUCT__entry(
1709 		__field(dev_t,	dev)
1710 		__field(unsigned int, node_cnt)
1711 		__field(unsigned int, tree_cnt)
1712 		__field(enum extent_type, type)
1713 	),
1714 
1715 	TP_fast_assign(
1716 		__entry->dev = sbi->sb->s_dev;
1717 		__entry->node_cnt = node_cnt;
1718 		__entry->tree_cnt = tree_cnt;
1719 		__entry->type = type;
1720 	),
1721 
1722 	TP_printk("dev = (%d,%d), shrunk: node_cnt = %u, tree_cnt = %u, type = %s",
1723 		show_dev(__entry->dev),
1724 		__entry->node_cnt,
1725 		__entry->tree_cnt,
1726 		show_extent_type(__entry->type))
1727 );
1728 
1729 TRACE_EVENT(f2fs_destroy_extent_tree,
1730 
1731 	TP_PROTO(struct inode *inode, unsigned int node_cnt,
1732 				enum extent_type type),
1733 
1734 	TP_ARGS(inode, node_cnt, type),
1735 
1736 	TP_STRUCT__entry(
1737 		__field(dev_t,	dev)
1738 		__field(ino_t,	ino)
1739 		__field(unsigned int, node_cnt)
1740 		__field(enum extent_type, type)
1741 	),
1742 
1743 	TP_fast_assign(
1744 		__entry->dev = inode->i_sb->s_dev;
1745 		__entry->ino = inode->i_ino;
1746 		__entry->node_cnt = node_cnt;
1747 		__entry->type = type;
1748 	),
1749 
1750 	TP_printk("dev = (%d,%d), ino = %lu, destroyed: node_cnt = %u, type = %s",
1751 		show_dev_ino(__entry),
1752 		__entry->node_cnt,
1753 		show_extent_type(__entry->type))
1754 );
1755 
1756 DECLARE_EVENT_CLASS(f2fs_sync_dirty_inodes,
1757 
1758 	TP_PROTO(struct super_block *sb, int type, s64 count),
1759 
1760 	TP_ARGS(sb, type, count),
1761 
1762 	TP_STRUCT__entry(
1763 		__field(dev_t, dev)
1764 		__field(int, type)
1765 		__field(s64, count)
1766 	),
1767 
1768 	TP_fast_assign(
1769 		__entry->dev	= sb->s_dev;
1770 		__entry->type	= type;
1771 		__entry->count	= count;
1772 	),
1773 
1774 	TP_printk("dev = (%d,%d), %s, dirty count = %lld",
1775 		show_dev(__entry->dev),
1776 		show_file_type(__entry->type),
1777 		__entry->count)
1778 );
1779 
1780 DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_enter,
1781 
1782 	TP_PROTO(struct super_block *sb, int type, s64 count),
1783 
1784 	TP_ARGS(sb, type, count)
1785 );
1786 
1787 DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_exit,
1788 
1789 	TP_PROTO(struct super_block *sb, int type, s64 count),
1790 
1791 	TP_ARGS(sb, type, count)
1792 );
1793 
1794 TRACE_EVENT(f2fs_shutdown,
1795 
1796 	TP_PROTO(struct f2fs_sb_info *sbi, unsigned int mode, int ret),
1797 
1798 	TP_ARGS(sbi, mode, ret),
1799 
1800 	TP_STRUCT__entry(
1801 		__field(dev_t,	dev)
1802 		__field(unsigned int, mode)
1803 		__field(int, ret)
1804 	),
1805 
1806 	TP_fast_assign(
1807 		__entry->dev = sbi->sb->s_dev;
1808 		__entry->mode = mode;
1809 		__entry->ret = ret;
1810 	),
1811 
1812 	TP_printk("dev = (%d,%d), mode: %s, ret:%d",
1813 		show_dev(__entry->dev),
1814 		show_shutdown_mode(__entry->mode),
1815 		__entry->ret)
1816 );
1817 
1818 DECLARE_EVENT_CLASS(f2fs_zip_start,
1819 
1820 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1821 			unsigned int cluster_size, unsigned char algtype),
1822 
1823 	TP_ARGS(inode, cluster_idx, cluster_size, algtype),
1824 
1825 	TP_STRUCT__entry(
1826 		__field(dev_t,	dev)
1827 		__field(ino_t,	ino)
1828 		__field(pgoff_t, idx)
1829 		__field(unsigned int, size)
1830 		__field(unsigned int, algtype)
1831 	),
1832 
1833 	TP_fast_assign(
1834 		__entry->dev = inode->i_sb->s_dev;
1835 		__entry->ino = inode->i_ino;
1836 		__entry->idx = cluster_idx;
1837 		__entry->size = cluster_size;
1838 		__entry->algtype = algtype;
1839 	),
1840 
1841 	TP_printk("dev = (%d,%d), ino = %lu, cluster_idx:%lu, "
1842 		"cluster_size = %u, algorithm = %s",
1843 		show_dev_ino(__entry),
1844 		__entry->idx,
1845 		__entry->size,
1846 		show_compress_algorithm(__entry->algtype))
1847 );
1848 
1849 DECLARE_EVENT_CLASS(f2fs_zip_end,
1850 
1851 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1852 			unsigned int compressed_size, int ret),
1853 
1854 	TP_ARGS(inode, cluster_idx, compressed_size, ret),
1855 
1856 	TP_STRUCT__entry(
1857 		__field(dev_t,	dev)
1858 		__field(ino_t,	ino)
1859 		__field(pgoff_t, idx)
1860 		__field(unsigned int, size)
1861 		__field(unsigned int, ret)
1862 	),
1863 
1864 	TP_fast_assign(
1865 		__entry->dev = inode->i_sb->s_dev;
1866 		__entry->ino = inode->i_ino;
1867 		__entry->idx = cluster_idx;
1868 		__entry->size = compressed_size;
1869 		__entry->ret = ret;
1870 	),
1871 
1872 	TP_printk("dev = (%d,%d), ino = %lu, cluster_idx:%lu, "
1873 		"compressed_size = %u, ret = %d",
1874 		show_dev_ino(__entry),
1875 		__entry->idx,
1876 		__entry->size,
1877 		__entry->ret)
1878 );
1879 
1880 DEFINE_EVENT(f2fs_zip_start, f2fs_compress_pages_start,
1881 
1882 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1883 		unsigned int cluster_size, unsigned char algtype),
1884 
1885 	TP_ARGS(inode, cluster_idx, cluster_size, algtype)
1886 );
1887 
1888 DEFINE_EVENT(f2fs_zip_start, f2fs_decompress_pages_start,
1889 
1890 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1891 		unsigned int cluster_size, unsigned char algtype),
1892 
1893 	TP_ARGS(inode, cluster_idx, cluster_size, algtype)
1894 );
1895 
1896 DEFINE_EVENT(f2fs_zip_end, f2fs_compress_pages_end,
1897 
1898 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1899 			unsigned int compressed_size, int ret),
1900 
1901 	TP_ARGS(inode, cluster_idx, compressed_size, ret)
1902 );
1903 
1904 DEFINE_EVENT(f2fs_zip_end, f2fs_decompress_pages_end,
1905 
1906 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1907 			unsigned int compressed_size, int ret),
1908 
1909 	TP_ARGS(inode, cluster_idx, compressed_size, ret)
1910 );
1911 
1912 #ifdef CONFIG_F2FS_IOSTAT
1913 TRACE_EVENT(f2fs_iostat,
1914 
1915 	TP_PROTO(struct f2fs_sb_info *sbi, unsigned long long *iostat),
1916 
1917 	TP_ARGS(sbi, iostat),
1918 
1919 	TP_STRUCT__entry(
1920 		__field(dev_t,	dev)
1921 		__field(unsigned long long,	app_dio)
1922 		__field(unsigned long long,	app_bio)
1923 		__field(unsigned long long,	app_wio)
1924 		__field(unsigned long long,	app_mio)
1925 		__field(unsigned long long,	app_bcdio)
1926 		__field(unsigned long long,	app_mcdio)
1927 		__field(unsigned long long,	fs_dio)
1928 		__field(unsigned long long,	fs_cdio)
1929 		__field(unsigned long long,	fs_nio)
1930 		__field(unsigned long long,	fs_mio)
1931 		__field(unsigned long long,	fs_gc_dio)
1932 		__field(unsigned long long,	fs_gc_nio)
1933 		__field(unsigned long long,	fs_cp_dio)
1934 		__field(unsigned long long,	fs_cp_nio)
1935 		__field(unsigned long long,	fs_cp_mio)
1936 		__field(unsigned long long,	app_drio)
1937 		__field(unsigned long long,	app_brio)
1938 		__field(unsigned long long,	app_rio)
1939 		__field(unsigned long long,	app_mrio)
1940 		__field(unsigned long long,	app_bcrio)
1941 		__field(unsigned long long,	app_mcrio)
1942 		__field(unsigned long long,	fs_drio)
1943 		__field(unsigned long long,	fs_gdrio)
1944 		__field(unsigned long long,	fs_cdrio)
1945 		__field(unsigned long long,	fs_nrio)
1946 		__field(unsigned long long,	fs_mrio)
1947 		__field(unsigned long long,	fs_discard)
1948 	),
1949 
1950 	TP_fast_assign(
1951 		__entry->dev		= sbi->sb->s_dev;
1952 		__entry->app_dio	= iostat[APP_DIRECT_IO];
1953 		__entry->app_bio	= iostat[APP_BUFFERED_IO];
1954 		__entry->app_wio	= iostat[APP_WRITE_IO];
1955 		__entry->app_mio	= iostat[APP_MAPPED_IO];
1956 		__entry->app_bcdio	= iostat[APP_BUFFERED_CDATA_IO];
1957 		__entry->app_mcdio	= iostat[APP_MAPPED_CDATA_IO];
1958 		__entry->fs_dio		= iostat[FS_DATA_IO];
1959 		__entry->fs_cdio	= iostat[FS_CDATA_IO];
1960 		__entry->fs_nio		= iostat[FS_NODE_IO];
1961 		__entry->fs_mio		= iostat[FS_META_IO];
1962 		__entry->fs_gc_dio	= iostat[FS_GC_DATA_IO];
1963 		__entry->fs_gc_nio	= iostat[FS_GC_NODE_IO];
1964 		__entry->fs_cp_dio	= iostat[FS_CP_DATA_IO];
1965 		__entry->fs_cp_nio	= iostat[FS_CP_NODE_IO];
1966 		__entry->fs_cp_mio	= iostat[FS_CP_META_IO];
1967 		__entry->app_drio	= iostat[APP_DIRECT_READ_IO];
1968 		__entry->app_brio	= iostat[APP_BUFFERED_READ_IO];
1969 		__entry->app_rio	= iostat[APP_READ_IO];
1970 		__entry->app_mrio	= iostat[APP_MAPPED_READ_IO];
1971 		__entry->app_bcrio	= iostat[APP_BUFFERED_CDATA_READ_IO];
1972 		__entry->app_mcrio	= iostat[APP_MAPPED_CDATA_READ_IO];
1973 		__entry->fs_drio	= iostat[FS_DATA_READ_IO];
1974 		__entry->fs_gdrio	= iostat[FS_GDATA_READ_IO];
1975 		__entry->fs_cdrio	= iostat[FS_CDATA_READ_IO];
1976 		__entry->fs_nrio	= iostat[FS_NODE_READ_IO];
1977 		__entry->fs_mrio	= iostat[FS_META_READ_IO];
1978 		__entry->fs_discard	= iostat[FS_DISCARD];
1979 	),
1980 
1981 	TP_printk("dev = (%d,%d), "
1982 		"app [write=%llu (direct=%llu, buffered=%llu), mapped=%llu, "
1983 		"compr(buffered=%llu, mapped=%llu)], "
1984 		"fs [data=%llu, cdata=%llu, node=%llu, meta=%llu, discard=%llu], "
1985 		"gc [data=%llu, node=%llu], "
1986 		"cp [data=%llu, node=%llu, meta=%llu], "
1987 		"app [read=%llu (direct=%llu, buffered=%llu), mapped=%llu], "
1988 		"compr(buffered=%llu, mapped=%llu)], "
1989 		"fs [data=%llu, (gc_data=%llu, cdata=%llu), "
1990 		"node=%llu, meta=%llu]",
1991 		show_dev(__entry->dev), __entry->app_wio, __entry->app_dio,
1992 		__entry->app_bio, __entry->app_mio, __entry->app_bcdio,
1993 		__entry->app_mcdio, __entry->fs_dio, __entry->fs_cdio,
1994 		__entry->fs_nio, __entry->fs_mio, __entry->fs_discard,
1995 		__entry->fs_gc_dio, __entry->fs_gc_nio, __entry->fs_cp_dio,
1996 		__entry->fs_cp_nio, __entry->fs_cp_mio,
1997 		__entry->app_rio, __entry->app_drio, __entry->app_brio,
1998 		__entry->app_mrio, __entry->app_bcrio, __entry->app_mcrio,
1999 		__entry->fs_drio, __entry->fs_gdrio,
2000 		__entry->fs_cdrio, __entry->fs_nrio, __entry->fs_mrio)
2001 );
2002 
2003 #ifndef __F2FS_IOSTAT_LATENCY_TYPE
2004 #define __F2FS_IOSTAT_LATENCY_TYPE
2005 struct f2fs_iostat_latency {
2006 	unsigned int peak_lat;
2007 	unsigned int avg_lat;
2008 	unsigned int cnt;
2009 };
2010 #endif /* __F2FS_IOSTAT_LATENCY_TYPE */
2011 
2012 TRACE_EVENT(f2fs_iostat_latency,
2013 
2014 	TP_PROTO(struct f2fs_sb_info *sbi, struct f2fs_iostat_latency (*iostat_lat)[NR_PAGE_TYPE]),
2015 
2016 	TP_ARGS(sbi, iostat_lat),
2017 
2018 	TP_STRUCT__entry(
2019 		__field(dev_t,	dev)
2020 		__field(unsigned int,	d_rd_peak)
2021 		__field(unsigned int,	d_rd_avg)
2022 		__field(unsigned int,	d_rd_cnt)
2023 		__field(unsigned int,	n_rd_peak)
2024 		__field(unsigned int,	n_rd_avg)
2025 		__field(unsigned int,	n_rd_cnt)
2026 		__field(unsigned int,	m_rd_peak)
2027 		__field(unsigned int,	m_rd_avg)
2028 		__field(unsigned int,	m_rd_cnt)
2029 		__field(unsigned int,	d_wr_s_peak)
2030 		__field(unsigned int,	d_wr_s_avg)
2031 		__field(unsigned int,	d_wr_s_cnt)
2032 		__field(unsigned int,	n_wr_s_peak)
2033 		__field(unsigned int,	n_wr_s_avg)
2034 		__field(unsigned int,	n_wr_s_cnt)
2035 		__field(unsigned int,	m_wr_s_peak)
2036 		__field(unsigned int,	m_wr_s_avg)
2037 		__field(unsigned int,	m_wr_s_cnt)
2038 		__field(unsigned int,	d_wr_as_peak)
2039 		__field(unsigned int,	d_wr_as_avg)
2040 		__field(unsigned int,	d_wr_as_cnt)
2041 		__field(unsigned int,	n_wr_as_peak)
2042 		__field(unsigned int,	n_wr_as_avg)
2043 		__field(unsigned int,	n_wr_as_cnt)
2044 		__field(unsigned int,	m_wr_as_peak)
2045 		__field(unsigned int,	m_wr_as_avg)
2046 		__field(unsigned int,	m_wr_as_cnt)
2047 	),
2048 
2049 	TP_fast_assign(
2050 		__entry->dev		= sbi->sb->s_dev;
2051 		__entry->d_rd_peak	= iostat_lat[0][DATA].peak_lat;
2052 		__entry->d_rd_avg	= iostat_lat[0][DATA].avg_lat;
2053 		__entry->d_rd_cnt	= iostat_lat[0][DATA].cnt;
2054 		__entry->n_rd_peak	= iostat_lat[0][NODE].peak_lat;
2055 		__entry->n_rd_avg	= iostat_lat[0][NODE].avg_lat;
2056 		__entry->n_rd_cnt	= iostat_lat[0][NODE].cnt;
2057 		__entry->m_rd_peak	= iostat_lat[0][META].peak_lat;
2058 		__entry->m_rd_avg	= iostat_lat[0][META].avg_lat;
2059 		__entry->m_rd_cnt	= iostat_lat[0][META].cnt;
2060 		__entry->d_wr_s_peak	= iostat_lat[1][DATA].peak_lat;
2061 		__entry->d_wr_s_avg	= iostat_lat[1][DATA].avg_lat;
2062 		__entry->d_wr_s_cnt	= iostat_lat[1][DATA].cnt;
2063 		__entry->n_wr_s_peak	= iostat_lat[1][NODE].peak_lat;
2064 		__entry->n_wr_s_avg	= iostat_lat[1][NODE].avg_lat;
2065 		__entry->n_wr_s_cnt	= iostat_lat[1][NODE].cnt;
2066 		__entry->m_wr_s_peak	= iostat_lat[1][META].peak_lat;
2067 		__entry->m_wr_s_avg	= iostat_lat[1][META].avg_lat;
2068 		__entry->m_wr_s_cnt	= iostat_lat[1][META].cnt;
2069 		__entry->d_wr_as_peak	= iostat_lat[2][DATA].peak_lat;
2070 		__entry->d_wr_as_avg	= iostat_lat[2][DATA].avg_lat;
2071 		__entry->d_wr_as_cnt	= iostat_lat[2][DATA].cnt;
2072 		__entry->n_wr_as_peak	= iostat_lat[2][NODE].peak_lat;
2073 		__entry->n_wr_as_avg	= iostat_lat[2][NODE].avg_lat;
2074 		__entry->n_wr_as_cnt	= iostat_lat[2][NODE].cnt;
2075 		__entry->m_wr_as_peak	= iostat_lat[2][META].peak_lat;
2076 		__entry->m_wr_as_avg	= iostat_lat[2][META].avg_lat;
2077 		__entry->m_wr_as_cnt	= iostat_lat[2][META].cnt;
2078 	),
2079 
2080 	TP_printk("dev = (%d,%d), "
2081 		"iotype [peak lat.(ms)/avg lat.(ms)/count], "
2082 		"rd_data [%u/%u/%u], rd_node [%u/%u/%u], rd_meta [%u/%u/%u], "
2083 		"wr_sync_data [%u/%u/%u], wr_sync_node [%u/%u/%u], "
2084 		"wr_sync_meta [%u/%u/%u], wr_async_data [%u/%u/%u], "
2085 		"wr_async_node [%u/%u/%u], wr_async_meta [%u/%u/%u]",
2086 		show_dev(__entry->dev),
2087 		__entry->d_rd_peak, __entry->d_rd_avg, __entry->d_rd_cnt,
2088 		__entry->n_rd_peak, __entry->n_rd_avg, __entry->n_rd_cnt,
2089 		__entry->m_rd_peak, __entry->m_rd_avg, __entry->m_rd_cnt,
2090 		__entry->d_wr_s_peak, __entry->d_wr_s_avg, __entry->d_wr_s_cnt,
2091 		__entry->n_wr_s_peak, __entry->n_wr_s_avg, __entry->n_wr_s_cnt,
2092 		__entry->m_wr_s_peak, __entry->m_wr_s_avg, __entry->m_wr_s_cnt,
2093 		__entry->d_wr_as_peak, __entry->d_wr_as_avg, __entry->d_wr_as_cnt,
2094 		__entry->n_wr_as_peak, __entry->n_wr_as_avg, __entry->n_wr_as_cnt,
2095 		__entry->m_wr_as_peak, __entry->m_wr_as_avg, __entry->m_wr_as_cnt)
2096 );
2097 #endif
2098 
2099 TRACE_EVENT(f2fs_bmap,
2100 
2101 	TP_PROTO(struct inode *inode, sector_t lblock, sector_t pblock),
2102 
2103 	TP_ARGS(inode, lblock, pblock),
2104 
2105 	TP_STRUCT__entry(
2106 		__field(dev_t, dev)
2107 		__field(ino_t, ino)
2108 		__field(sector_t, lblock)
2109 		__field(sector_t, pblock)
2110 	),
2111 
2112 	TP_fast_assign(
2113 		__entry->dev		= inode->i_sb->s_dev;
2114 		__entry->ino		= inode->i_ino;
2115 		__entry->lblock		= lblock;
2116 		__entry->pblock		= pblock;
2117 	),
2118 
2119 	TP_printk("dev = (%d,%d), ino = %lu, lblock:%lld, pblock:%lld",
2120 		show_dev_ino(__entry),
2121 		(unsigned long long)__entry->lblock,
2122 		(unsigned long long)__entry->pblock)
2123 );
2124 
2125 TRACE_EVENT(f2fs_fiemap,
2126 
2127 	TP_PROTO(struct inode *inode, sector_t lblock, sector_t pblock,
2128 		unsigned long long len, unsigned int flags, int ret),
2129 
2130 	TP_ARGS(inode, lblock, pblock, len, flags, ret),
2131 
2132 	TP_STRUCT__entry(
2133 		__field(dev_t, dev)
2134 		__field(ino_t, ino)
2135 		__field(sector_t, lblock)
2136 		__field(sector_t, pblock)
2137 		__field(unsigned long long, len)
2138 		__field(unsigned int, flags)
2139 		__field(int, ret)
2140 	),
2141 
2142 	TP_fast_assign(
2143 		__entry->dev		= inode->i_sb->s_dev;
2144 		__entry->ino		= inode->i_ino;
2145 		__entry->lblock		= lblock;
2146 		__entry->pblock		= pblock;
2147 		__entry->len		= len;
2148 		__entry->flags		= flags;
2149 		__entry->ret		= ret;
2150 	),
2151 
2152 	TP_printk("dev = (%d,%d), ino = %lu, lblock:%lld, pblock:%lld, "
2153 		"len:%llu, flags:%u, ret:%d",
2154 		show_dev_ino(__entry),
2155 		(unsigned long long)__entry->lblock,
2156 		(unsigned long long)__entry->pblock,
2157 		__entry->len,
2158 		__entry->flags,
2159 		__entry->ret)
2160 );
2161 
2162 DECLARE_EVENT_CLASS(f2fs__rw_start,
2163 
2164 	TP_PROTO(struct inode *inode, loff_t offset, int bytes,
2165 			pid_t pid, char *pathname, char *command),
2166 
2167 	TP_ARGS(inode, offset, bytes, pid, pathname, command),
2168 
2169 	TP_STRUCT__entry(
2170 		__string(pathbuf, pathname)
2171 		__field(loff_t, offset)
2172 		__field(int, bytes)
2173 		__field(loff_t, i_size)
2174 		__string(cmdline, command)
2175 		__field(pid_t, pid)
2176 		__field(ino_t, ino)
2177 	),
2178 
2179 	TP_fast_assign(
2180 		/*
2181 		 * Replace the spaces in filenames and cmdlines
2182 		 * because this screws up the tooling that parses
2183 		 * the traces.
2184 		 */
2185 		__assign_str(pathbuf, pathname);
2186 		(void)strreplace(__get_str(pathbuf), ' ', '_');
2187 		__entry->offset = offset;
2188 		__entry->bytes = bytes;
2189 		__entry->i_size = i_size_read(inode);
2190 		__assign_str(cmdline, command);
2191 		(void)strreplace(__get_str(cmdline), ' ', '_');
2192 		__entry->pid = pid;
2193 		__entry->ino = inode->i_ino;
2194 	),
2195 
2196 	TP_printk("entry_name %s, offset %llu, bytes %d, cmdline %s,"
2197 		" pid %d, i_size %llu, ino %lu",
2198 		__get_str(pathbuf), __entry->offset, __entry->bytes,
2199 		__get_str(cmdline), __entry->pid, __entry->i_size,
2200 		(unsigned long) __entry->ino)
2201 );
2202 
2203 DECLARE_EVENT_CLASS(f2fs__rw_end,
2204 
2205 	TP_PROTO(struct inode *inode, loff_t offset, int bytes),
2206 
2207 	TP_ARGS(inode, offset, bytes),
2208 
2209 	TP_STRUCT__entry(
2210 		__field(ino_t,	ino)
2211 		__field(loff_t,	offset)
2212 		__field(int,	bytes)
2213 	),
2214 
2215 	TP_fast_assign(
2216 		__entry->ino		= inode->i_ino;
2217 		__entry->offset		= offset;
2218 		__entry->bytes		= bytes;
2219 	),
2220 
2221 	TP_printk("ino %lu, offset %llu, bytes %d",
2222 		(unsigned long) __entry->ino,
2223 		__entry->offset, __entry->bytes)
2224 );
2225 
2226 DEFINE_EVENT(f2fs__rw_start, f2fs_dataread_start,
2227 
2228 	TP_PROTO(struct inode *inode, loff_t offset, int bytes,
2229 		pid_t pid, char *pathname, char *command),
2230 
2231 	TP_ARGS(inode, offset, bytes, pid, pathname, command)
2232 );
2233 
2234 DEFINE_EVENT(f2fs__rw_end, f2fs_dataread_end,
2235 
2236 	TP_PROTO(struct inode *inode, loff_t offset, int bytes),
2237 
2238 	TP_ARGS(inode, offset, bytes)
2239 );
2240 
2241 DEFINE_EVENT(f2fs__rw_start, f2fs_datawrite_start,
2242 
2243 	TP_PROTO(struct inode *inode, loff_t offset, int bytes,
2244 		pid_t pid, char *pathname, char *command),
2245 
2246 	TP_ARGS(inode, offset, bytes, pid, pathname, command)
2247 );
2248 
2249 DEFINE_EVENT(f2fs__rw_end, f2fs_datawrite_end,
2250 
2251 	TP_PROTO(struct inode *inode, loff_t offset, int bytes),
2252 
2253 	TP_ARGS(inode, offset, bytes)
2254 );
2255 
2256 #endif /* _TRACE_F2FS_H */
2257 
2258  /* This part must be outside protection */
2259 #include <trace/define_trace.h>
2260