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