xref: /openbmc/linux/include/trace/events/f2fs.h (revision 15e3ae36)
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 
10 #define show_dev(dev)		MAJOR(dev), MINOR(dev)
11 #define show_dev_ino(entry)	show_dev(entry->dev), (unsigned long)entry->ino
12 
13 TRACE_DEFINE_ENUM(NODE);
14 TRACE_DEFINE_ENUM(DATA);
15 TRACE_DEFINE_ENUM(META);
16 TRACE_DEFINE_ENUM(META_FLUSH);
17 TRACE_DEFINE_ENUM(INMEM);
18 TRACE_DEFINE_ENUM(INMEM_DROP);
19 TRACE_DEFINE_ENUM(INMEM_INVALIDATE);
20 TRACE_DEFINE_ENUM(INMEM_REVOKE);
21 TRACE_DEFINE_ENUM(IPU);
22 TRACE_DEFINE_ENUM(OPU);
23 TRACE_DEFINE_ENUM(HOT);
24 TRACE_DEFINE_ENUM(WARM);
25 TRACE_DEFINE_ENUM(COLD);
26 TRACE_DEFINE_ENUM(CURSEG_HOT_DATA);
27 TRACE_DEFINE_ENUM(CURSEG_WARM_DATA);
28 TRACE_DEFINE_ENUM(CURSEG_COLD_DATA);
29 TRACE_DEFINE_ENUM(CURSEG_HOT_NODE);
30 TRACE_DEFINE_ENUM(CURSEG_WARM_NODE);
31 TRACE_DEFINE_ENUM(CURSEG_COLD_NODE);
32 TRACE_DEFINE_ENUM(NO_CHECK_TYPE);
33 TRACE_DEFINE_ENUM(GC_GREEDY);
34 TRACE_DEFINE_ENUM(GC_CB);
35 TRACE_DEFINE_ENUM(FG_GC);
36 TRACE_DEFINE_ENUM(BG_GC);
37 TRACE_DEFINE_ENUM(LFS);
38 TRACE_DEFINE_ENUM(SSR);
39 TRACE_DEFINE_ENUM(__REQ_RAHEAD);
40 TRACE_DEFINE_ENUM(__REQ_SYNC);
41 TRACE_DEFINE_ENUM(__REQ_IDLE);
42 TRACE_DEFINE_ENUM(__REQ_PREFLUSH);
43 TRACE_DEFINE_ENUM(__REQ_FUA);
44 TRACE_DEFINE_ENUM(__REQ_PRIO);
45 TRACE_DEFINE_ENUM(__REQ_META);
46 TRACE_DEFINE_ENUM(CP_UMOUNT);
47 TRACE_DEFINE_ENUM(CP_FASTBOOT);
48 TRACE_DEFINE_ENUM(CP_SYNC);
49 TRACE_DEFINE_ENUM(CP_RECOVERY);
50 TRACE_DEFINE_ENUM(CP_DISCARD);
51 TRACE_DEFINE_ENUM(CP_TRIMMED);
52 TRACE_DEFINE_ENUM(CP_PAUSE);
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 		{ INMEM,	"INMEM" },				\
61 		{ INMEM_DROP,	"INMEM_DROP" },				\
62 		{ INMEM_INVALIDATE,	"INMEM_INVALIDATE" },		\
63 		{ INMEM_REVOKE,	"INMEM_REVOKE" },			\
64 		{ IPU,		"IN-PLACE" },				\
65 		{ OPU,		"OUT-OF-PLACE" })
66 
67 #define show_block_temp(temp)						\
68 	__print_symbolic(temp,						\
69 		{ HOT,		"HOT" },				\
70 		{ WARM,		"WARM" },				\
71 		{ COLD,		"COLD" })
72 
73 #define F2FS_OP_FLAGS (REQ_RAHEAD | REQ_SYNC | REQ_META | REQ_PRIO |	\
74 			REQ_PREFLUSH | REQ_FUA)
75 #define F2FS_BIO_FLAG_MASK(t)	(t & F2FS_OP_FLAGS)
76 
77 #define show_bio_type(op,op_flags)	show_bio_op(op),		\
78 						show_bio_op_flags(op_flags)
79 
80 #define show_bio_op(op)		blk_op_str(op)
81 
82 #define show_bio_op_flags(flags)					\
83 	__print_flags(F2FS_BIO_FLAG_MASK(flags), "|",			\
84 		{ REQ_RAHEAD,		"R" },				\
85 		{ REQ_SYNC,		"S" },				\
86 		{ REQ_META,		"M" },				\
87 		{ REQ_PRIO,		"P" },				\
88 		{ REQ_PREFLUSH,		"PF" },				\
89 		{ REQ_FUA,		"FUA" })
90 
91 #define show_data_type(type)						\
92 	__print_symbolic(type,						\
93 		{ CURSEG_HOT_DATA, 	"Hot DATA" },			\
94 		{ CURSEG_WARM_DATA, 	"Warm DATA" },			\
95 		{ CURSEG_COLD_DATA, 	"Cold DATA" },			\
96 		{ CURSEG_HOT_NODE, 	"Hot NODE" },			\
97 		{ CURSEG_WARM_NODE, 	"Warm NODE" },			\
98 		{ CURSEG_COLD_NODE, 	"Cold NODE" },			\
99 		{ NO_CHECK_TYPE, 	"No TYPE" })
100 
101 #define show_file_type(type)						\
102 	__print_symbolic(type,						\
103 		{ 0,		"FILE" },				\
104 		{ 1,		"DIR" })
105 
106 #define show_gc_type(type)						\
107 	__print_symbolic(type,						\
108 		{ FG_GC,	"Foreground GC" },			\
109 		{ BG_GC,	"Background GC" })
110 
111 #define show_alloc_mode(type)						\
112 	__print_symbolic(type,						\
113 		{ LFS,	"LFS-mode" },					\
114 		{ SSR,	"SSR-mode" })
115 
116 #define show_victim_policy(type)					\
117 	__print_symbolic(type,						\
118 		{ GC_GREEDY,	"Greedy" },				\
119 		{ GC_CB,	"Cost-Benefit" })
120 
121 #define show_cpreason(type)						\
122 	__print_flags(type, "|",					\
123 		{ CP_UMOUNT,	"Umount" },				\
124 		{ CP_FASTBOOT,	"Fastboot" },				\
125 		{ CP_SYNC,	"Sync" },				\
126 		{ CP_RECOVERY,	"Recovery" },				\
127 		{ CP_DISCARD,	"Discard" },				\
128 		{ CP_PAUSE,	"Pause" },				\
129 		{ CP_TRIMMED,	"Trimmed" })
130 
131 #define show_fsync_cpreason(type)					\
132 	__print_symbolic(type,						\
133 		{ CP_NO_NEEDED,		"no needed" },			\
134 		{ CP_NON_REGULAR,	"non regular" },		\
135 		{ CP_COMPRESSED,	"compreesed" },			\
136 		{ CP_HARDLINK,		"hardlink" },			\
137 		{ CP_SB_NEED_CP,	"sb needs cp" },		\
138 		{ CP_WRONG_PINO,	"wrong pino" },			\
139 		{ CP_NO_SPC_ROLL,	"no space roll forward" },	\
140 		{ CP_NODE_NEED_CP,	"node needs cp" },		\
141 		{ CP_FASTBOOT_MODE,	"fastboot mode" },		\
142 		{ CP_SPEC_LOG_NUM,	"log type is 2" },		\
143 		{ CP_RECOVER_DIR,	"dir needs recovery" })
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 
159 struct f2fs_sb_info;
160 struct f2fs_io_info;
161 struct extent_info;
162 struct victim_sel_policy;
163 struct f2fs_map_blocks;
164 
165 DECLARE_EVENT_CLASS(f2fs__inode,
166 
167 	TP_PROTO(struct inode *inode),
168 
169 	TP_ARGS(inode),
170 
171 	TP_STRUCT__entry(
172 		__field(dev_t,	dev)
173 		__field(ino_t,	ino)
174 		__field(ino_t,	pino)
175 		__field(umode_t, mode)
176 		__field(loff_t,	size)
177 		__field(unsigned int, nlink)
178 		__field(blkcnt_t, blocks)
179 		__field(__u8,	advise)
180 	),
181 
182 	TP_fast_assign(
183 		__entry->dev	= inode->i_sb->s_dev;
184 		__entry->ino	= inode->i_ino;
185 		__entry->pino	= F2FS_I(inode)->i_pino;
186 		__entry->mode	= inode->i_mode;
187 		__entry->nlink	= inode->i_nlink;
188 		__entry->size	= inode->i_size;
189 		__entry->blocks	= inode->i_blocks;
190 		__entry->advise	= F2FS_I(inode)->i_advise;
191 	),
192 
193 	TP_printk("dev = (%d,%d), ino = %lu, pino = %lu, i_mode = 0x%hx, "
194 		"i_size = %lld, i_nlink = %u, i_blocks = %llu, i_advise = 0x%x",
195 		show_dev_ino(__entry),
196 		(unsigned long)__entry->pino,
197 		__entry->mode,
198 		__entry->size,
199 		(unsigned int)__entry->nlink,
200 		(unsigned long long)__entry->blocks,
201 		(unsigned char)__entry->advise)
202 );
203 
204 DECLARE_EVENT_CLASS(f2fs__inode_exit,
205 
206 	TP_PROTO(struct inode *inode, int ret),
207 
208 	TP_ARGS(inode, ret),
209 
210 	TP_STRUCT__entry(
211 		__field(dev_t,	dev)
212 		__field(ino_t,	ino)
213 		__field(int,	ret)
214 	),
215 
216 	TP_fast_assign(
217 		__entry->dev	= inode->i_sb->s_dev;
218 		__entry->ino	= inode->i_ino;
219 		__entry->ret	= ret;
220 	),
221 
222 	TP_printk("dev = (%d,%d), ino = %lu, ret = %d",
223 		show_dev_ino(__entry),
224 		__entry->ret)
225 );
226 
227 DEFINE_EVENT(f2fs__inode, f2fs_sync_file_enter,
228 
229 	TP_PROTO(struct inode *inode),
230 
231 	TP_ARGS(inode)
232 );
233 
234 TRACE_EVENT(f2fs_sync_file_exit,
235 
236 	TP_PROTO(struct inode *inode, int cp_reason, int datasync, int ret),
237 
238 	TP_ARGS(inode, cp_reason, datasync, ret),
239 
240 	TP_STRUCT__entry(
241 		__field(dev_t,	dev)
242 		__field(ino_t,	ino)
243 		__field(int,	cp_reason)
244 		__field(int,	datasync)
245 		__field(int,	ret)
246 	),
247 
248 	TP_fast_assign(
249 		__entry->dev		= inode->i_sb->s_dev;
250 		__entry->ino		= inode->i_ino;
251 		__entry->cp_reason	= cp_reason;
252 		__entry->datasync	= datasync;
253 		__entry->ret		= ret;
254 	),
255 
256 	TP_printk("dev = (%d,%d), ino = %lu, cp_reason: %s, "
257 		"datasync = %d, ret = %d",
258 		show_dev_ino(__entry),
259 		show_fsync_cpreason(__entry->cp_reason),
260 		__entry->datasync,
261 		__entry->ret)
262 );
263 
264 TRACE_EVENT(f2fs_sync_fs,
265 
266 	TP_PROTO(struct super_block *sb, int wait),
267 
268 	TP_ARGS(sb, wait),
269 
270 	TP_STRUCT__entry(
271 		__field(dev_t,	dev)
272 		__field(int,	dirty)
273 		__field(int,	wait)
274 	),
275 
276 	TP_fast_assign(
277 		__entry->dev	= sb->s_dev;
278 		__entry->dirty	= is_sbi_flag_set(F2FS_SB(sb), SBI_IS_DIRTY);
279 		__entry->wait	= wait;
280 	),
281 
282 	TP_printk("dev = (%d,%d), superblock is %s, wait = %d",
283 		show_dev(__entry->dev),
284 		__entry->dirty ? "dirty" : "not dirty",
285 		__entry->wait)
286 );
287 
288 DEFINE_EVENT(f2fs__inode, f2fs_iget,
289 
290 	TP_PROTO(struct inode *inode),
291 
292 	TP_ARGS(inode)
293 );
294 
295 DEFINE_EVENT(f2fs__inode_exit, f2fs_iget_exit,
296 
297 	TP_PROTO(struct inode *inode, int ret),
298 
299 	TP_ARGS(inode, ret)
300 );
301 
302 DEFINE_EVENT(f2fs__inode, f2fs_evict_inode,
303 
304 	TP_PROTO(struct inode *inode),
305 
306 	TP_ARGS(inode)
307 );
308 
309 DEFINE_EVENT(f2fs__inode_exit, f2fs_new_inode,
310 
311 	TP_PROTO(struct inode *inode, int ret),
312 
313 	TP_ARGS(inode, ret)
314 );
315 
316 TRACE_EVENT(f2fs_unlink_enter,
317 
318 	TP_PROTO(struct inode *dir, struct dentry *dentry),
319 
320 	TP_ARGS(dir, dentry),
321 
322 	TP_STRUCT__entry(
323 		__field(dev_t,	dev)
324 		__field(ino_t,	ino)
325 		__field(loff_t,	size)
326 		__field(blkcnt_t, blocks)
327 		__field(const char *,	name)
328 	),
329 
330 	TP_fast_assign(
331 		__entry->dev	= dir->i_sb->s_dev;
332 		__entry->ino	= dir->i_ino;
333 		__entry->size	= dir->i_size;
334 		__entry->blocks	= dir->i_blocks;
335 		__entry->name	= dentry->d_name.name;
336 	),
337 
338 	TP_printk("dev = (%d,%d), dir ino = %lu, i_size = %lld, "
339 		"i_blocks = %llu, name = %s",
340 		show_dev_ino(__entry),
341 		__entry->size,
342 		(unsigned long long)__entry->blocks,
343 		__entry->name)
344 );
345 
346 DEFINE_EVENT(f2fs__inode_exit, f2fs_unlink_exit,
347 
348 	TP_PROTO(struct inode *inode, int ret),
349 
350 	TP_ARGS(inode, ret)
351 );
352 
353 DEFINE_EVENT(f2fs__inode_exit, f2fs_drop_inode,
354 
355 	TP_PROTO(struct inode *inode, int ret),
356 
357 	TP_ARGS(inode, ret)
358 );
359 
360 DEFINE_EVENT(f2fs__inode, f2fs_truncate,
361 
362 	TP_PROTO(struct inode *inode),
363 
364 	TP_ARGS(inode)
365 );
366 
367 TRACE_EVENT(f2fs_truncate_data_blocks_range,
368 
369 	TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs, int free),
370 
371 	TP_ARGS(inode, nid,  ofs, free),
372 
373 	TP_STRUCT__entry(
374 		__field(dev_t,	dev)
375 		__field(ino_t,	ino)
376 		__field(nid_t,	nid)
377 		__field(unsigned int,	ofs)
378 		__field(int,	free)
379 	),
380 
381 	TP_fast_assign(
382 		__entry->dev	= inode->i_sb->s_dev;
383 		__entry->ino	= inode->i_ino;
384 		__entry->nid	= nid;
385 		__entry->ofs	= ofs;
386 		__entry->free	= free;
387 	),
388 
389 	TP_printk("dev = (%d,%d), ino = %lu, nid = %u, offset = %u, freed = %d",
390 		show_dev_ino(__entry),
391 		(unsigned int)__entry->nid,
392 		__entry->ofs,
393 		__entry->free)
394 );
395 
396 DECLARE_EVENT_CLASS(f2fs__truncate_op,
397 
398 	TP_PROTO(struct inode *inode, u64 from),
399 
400 	TP_ARGS(inode, from),
401 
402 	TP_STRUCT__entry(
403 		__field(dev_t,	dev)
404 		__field(ino_t,	ino)
405 		__field(loff_t,	size)
406 		__field(blkcnt_t, blocks)
407 		__field(u64,	from)
408 	),
409 
410 	TP_fast_assign(
411 		__entry->dev	= inode->i_sb->s_dev;
412 		__entry->ino	= inode->i_ino;
413 		__entry->size	= inode->i_size;
414 		__entry->blocks	= inode->i_blocks;
415 		__entry->from	= from;
416 	),
417 
418 	TP_printk("dev = (%d,%d), ino = %lu, i_size = %lld, i_blocks = %llu, "
419 		"start file offset = %llu",
420 		show_dev_ino(__entry),
421 		__entry->size,
422 		(unsigned long long)__entry->blocks,
423 		(unsigned long long)__entry->from)
424 );
425 
426 DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_blocks_enter,
427 
428 	TP_PROTO(struct inode *inode, u64 from),
429 
430 	TP_ARGS(inode, from)
431 );
432 
433 DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_blocks_exit,
434 
435 	TP_PROTO(struct inode *inode, int ret),
436 
437 	TP_ARGS(inode, ret)
438 );
439 
440 DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_inode_blocks_enter,
441 
442 	TP_PROTO(struct inode *inode, u64 from),
443 
444 	TP_ARGS(inode, from)
445 );
446 
447 DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_inode_blocks_exit,
448 
449 	TP_PROTO(struct inode *inode, int ret),
450 
451 	TP_ARGS(inode, ret)
452 );
453 
454 DECLARE_EVENT_CLASS(f2fs__truncate_node,
455 
456 	TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
457 
458 	TP_ARGS(inode, nid, blk_addr),
459 
460 	TP_STRUCT__entry(
461 		__field(dev_t,	dev)
462 		__field(ino_t,	ino)
463 		__field(nid_t,	nid)
464 		__field(block_t,	blk_addr)
465 	),
466 
467 	TP_fast_assign(
468 		__entry->dev		= inode->i_sb->s_dev;
469 		__entry->ino		= inode->i_ino;
470 		__entry->nid		= nid;
471 		__entry->blk_addr	= blk_addr;
472 	),
473 
474 	TP_printk("dev = (%d,%d), ino = %lu, nid = %u, block_address = 0x%llx",
475 		show_dev_ino(__entry),
476 		(unsigned int)__entry->nid,
477 		(unsigned long long)__entry->blk_addr)
478 );
479 
480 DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_nodes_enter,
481 
482 	TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
483 
484 	TP_ARGS(inode, nid, blk_addr)
485 );
486 
487 DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_nodes_exit,
488 
489 	TP_PROTO(struct inode *inode, int ret),
490 
491 	TP_ARGS(inode, ret)
492 );
493 
494 DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_node,
495 
496 	TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
497 
498 	TP_ARGS(inode, nid, blk_addr)
499 );
500 
501 TRACE_EVENT(f2fs_truncate_partial_nodes,
502 
503 	TP_PROTO(struct inode *inode, nid_t *nid, int depth, int err),
504 
505 	TP_ARGS(inode, nid, depth, err),
506 
507 	TP_STRUCT__entry(
508 		__field(dev_t,	dev)
509 		__field(ino_t,	ino)
510 		__field(nid_t,	nid[3])
511 		__field(int,	depth)
512 		__field(int,	err)
513 	),
514 
515 	TP_fast_assign(
516 		__entry->dev	= inode->i_sb->s_dev;
517 		__entry->ino	= inode->i_ino;
518 		__entry->nid[0]	= nid[0];
519 		__entry->nid[1]	= nid[1];
520 		__entry->nid[2]	= nid[2];
521 		__entry->depth	= depth;
522 		__entry->err	= err;
523 	),
524 
525 	TP_printk("dev = (%d,%d), ino = %lu, "
526 		"nid[0] = %u, nid[1] = %u, nid[2] = %u, depth = %d, err = %d",
527 		show_dev_ino(__entry),
528 		(unsigned int)__entry->nid[0],
529 		(unsigned int)__entry->nid[1],
530 		(unsigned int)__entry->nid[2],
531 		__entry->depth,
532 		__entry->err)
533 );
534 
535 TRACE_EVENT(f2fs_file_write_iter,
536 
537 	TP_PROTO(struct inode *inode, unsigned long offset,
538 		unsigned long length, int ret),
539 
540 	TP_ARGS(inode, offset, length, ret),
541 
542 	TP_STRUCT__entry(
543 		__field(dev_t,	dev)
544 		__field(ino_t,	ino)
545 		__field(unsigned long, offset)
546 		__field(unsigned long, length)
547 		__field(int,	ret)
548 	),
549 
550 	TP_fast_assign(
551 		__entry->dev	= inode->i_sb->s_dev;
552 		__entry->ino	= inode->i_ino;
553 		__entry->offset	= offset;
554 		__entry->length	= length;
555 		__entry->ret	= ret;
556 	),
557 
558 	TP_printk("dev = (%d,%d), ino = %lu, "
559 		"offset = %lu, length = %lu, written(err) = %d",
560 		show_dev_ino(__entry),
561 		__entry->offset,
562 		__entry->length,
563 		__entry->ret)
564 );
565 
566 TRACE_EVENT(f2fs_map_blocks,
567 	TP_PROTO(struct inode *inode, struct f2fs_map_blocks *map, int ret),
568 
569 	TP_ARGS(inode, map, ret),
570 
571 	TP_STRUCT__entry(
572 		__field(dev_t,	dev)
573 		__field(ino_t,	ino)
574 		__field(block_t,	m_lblk)
575 		__field(block_t,	m_pblk)
576 		__field(unsigned int,	m_len)
577 		__field(unsigned int,	m_flags)
578 		__field(int,	m_seg_type)
579 		__field(bool,	m_may_create)
580 		__field(int,	ret)
581 	),
582 
583 	TP_fast_assign(
584 		__entry->dev		= inode->i_sb->s_dev;
585 		__entry->ino		= inode->i_ino;
586 		__entry->m_lblk		= map->m_lblk;
587 		__entry->m_pblk		= map->m_pblk;
588 		__entry->m_len		= map->m_len;
589 		__entry->m_flags	= map->m_flags;
590 		__entry->m_seg_type	= map->m_seg_type;
591 		__entry->m_may_create	= map->m_may_create;
592 		__entry->ret		= ret;
593 	),
594 
595 	TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, "
596 		"start blkaddr = 0x%llx, len = 0x%llx, flags = %u,"
597 		"seg_type = %d, may_create = %d, err = %d",
598 		show_dev_ino(__entry),
599 		(unsigned long long)__entry->m_lblk,
600 		(unsigned long long)__entry->m_pblk,
601 		(unsigned long long)__entry->m_len,
602 		__entry->m_flags,
603 		__entry->m_seg_type,
604 		__entry->m_may_create,
605 		__entry->ret)
606 );
607 
608 TRACE_EVENT(f2fs_background_gc,
609 
610 	TP_PROTO(struct super_block *sb, unsigned int wait_ms,
611 			unsigned int prefree, unsigned int free),
612 
613 	TP_ARGS(sb, wait_ms, prefree, free),
614 
615 	TP_STRUCT__entry(
616 		__field(dev_t,	dev)
617 		__field(unsigned int,	wait_ms)
618 		__field(unsigned int,	prefree)
619 		__field(unsigned int,	free)
620 	),
621 
622 	TP_fast_assign(
623 		__entry->dev		= sb->s_dev;
624 		__entry->wait_ms	= wait_ms;
625 		__entry->prefree	= prefree;
626 		__entry->free		= free;
627 	),
628 
629 	TP_printk("dev = (%d,%d), wait_ms = %u, prefree = %u, free = %u",
630 		show_dev(__entry->dev),
631 		__entry->wait_ms,
632 		__entry->prefree,
633 		__entry->free)
634 );
635 
636 TRACE_EVENT(f2fs_gc_begin,
637 
638 	TP_PROTO(struct super_block *sb, bool sync, bool background,
639 			long long dirty_nodes, long long dirty_dents,
640 			long long dirty_imeta, unsigned int free_sec,
641 			unsigned int free_seg, int reserved_seg,
642 			unsigned int prefree_seg),
643 
644 	TP_ARGS(sb, sync, background, dirty_nodes, dirty_dents, dirty_imeta,
645 		free_sec, free_seg, reserved_seg, prefree_seg),
646 
647 	TP_STRUCT__entry(
648 		__field(dev_t,		dev)
649 		__field(bool,		sync)
650 		__field(bool,		background)
651 		__field(long long,	dirty_nodes)
652 		__field(long long,	dirty_dents)
653 		__field(long long,	dirty_imeta)
654 		__field(unsigned int,	free_sec)
655 		__field(unsigned int,	free_seg)
656 		__field(int,		reserved_seg)
657 		__field(unsigned int,	prefree_seg)
658 	),
659 
660 	TP_fast_assign(
661 		__entry->dev		= sb->s_dev;
662 		__entry->sync		= sync;
663 		__entry->background	= background;
664 		__entry->dirty_nodes	= dirty_nodes;
665 		__entry->dirty_dents	= dirty_dents;
666 		__entry->dirty_imeta	= dirty_imeta;
667 		__entry->free_sec	= free_sec;
668 		__entry->free_seg	= free_seg;
669 		__entry->reserved_seg	= reserved_seg;
670 		__entry->prefree_seg	= prefree_seg;
671 	),
672 
673 	TP_printk("dev = (%d,%d), sync = %d, background = %d, nodes = %lld, "
674 		"dents = %lld, imeta = %lld, free_sec:%u, free_seg:%u, "
675 		"rsv_seg:%d, prefree_seg:%u",
676 		show_dev(__entry->dev),
677 		__entry->sync,
678 		__entry->background,
679 		__entry->dirty_nodes,
680 		__entry->dirty_dents,
681 		__entry->dirty_imeta,
682 		__entry->free_sec,
683 		__entry->free_seg,
684 		__entry->reserved_seg,
685 		__entry->prefree_seg)
686 );
687 
688 TRACE_EVENT(f2fs_gc_end,
689 
690 	TP_PROTO(struct super_block *sb, int ret, int seg_freed,
691 			int sec_freed, long long dirty_nodes,
692 			long long dirty_dents, long long dirty_imeta,
693 			unsigned int free_sec, unsigned int free_seg,
694 			int reserved_seg, unsigned int prefree_seg),
695 
696 	TP_ARGS(sb, ret, seg_freed, sec_freed, dirty_nodes, dirty_dents,
697 		dirty_imeta, free_sec, free_seg, reserved_seg, prefree_seg),
698 
699 	TP_STRUCT__entry(
700 		__field(dev_t,		dev)
701 		__field(int,		ret)
702 		__field(int,		seg_freed)
703 		__field(int,		sec_freed)
704 		__field(long long,	dirty_nodes)
705 		__field(long long,	dirty_dents)
706 		__field(long long,	dirty_imeta)
707 		__field(unsigned int,	free_sec)
708 		__field(unsigned int,	free_seg)
709 		__field(int,		reserved_seg)
710 		__field(unsigned int,	prefree_seg)
711 	),
712 
713 	TP_fast_assign(
714 		__entry->dev		= sb->s_dev;
715 		__entry->ret		= ret;
716 		__entry->seg_freed	= seg_freed;
717 		__entry->sec_freed	= sec_freed;
718 		__entry->dirty_nodes	= dirty_nodes;
719 		__entry->dirty_dents	= dirty_dents;
720 		__entry->dirty_imeta	= dirty_imeta;
721 		__entry->free_sec	= free_sec;
722 		__entry->free_seg	= free_seg;
723 		__entry->reserved_seg	= reserved_seg;
724 		__entry->prefree_seg	= prefree_seg;
725 	),
726 
727 	TP_printk("dev = (%d,%d), ret = %d, seg_freed = %d, sec_freed = %d, "
728 		"nodes = %lld, dents = %lld, imeta = %lld, free_sec:%u, "
729 		"free_seg:%u, rsv_seg:%d, prefree_seg:%u",
730 		show_dev(__entry->dev),
731 		__entry->ret,
732 		__entry->seg_freed,
733 		__entry->sec_freed,
734 		__entry->dirty_nodes,
735 		__entry->dirty_dents,
736 		__entry->dirty_imeta,
737 		__entry->free_sec,
738 		__entry->free_seg,
739 		__entry->reserved_seg,
740 		__entry->prefree_seg)
741 );
742 
743 TRACE_EVENT(f2fs_get_victim,
744 
745 	TP_PROTO(struct super_block *sb, int type, int gc_type,
746 			struct victim_sel_policy *p, unsigned int pre_victim,
747 			unsigned int prefree, unsigned int free),
748 
749 	TP_ARGS(sb, type, gc_type, p, pre_victim, prefree, free),
750 
751 	TP_STRUCT__entry(
752 		__field(dev_t,	dev)
753 		__field(int,	type)
754 		__field(int,	gc_type)
755 		__field(int,	alloc_mode)
756 		__field(int,	gc_mode)
757 		__field(unsigned int,	victim)
758 		__field(unsigned int,	cost)
759 		__field(unsigned int,	ofs_unit)
760 		__field(unsigned int,	pre_victim)
761 		__field(unsigned int,	prefree)
762 		__field(unsigned int,	free)
763 	),
764 
765 	TP_fast_assign(
766 		__entry->dev		= sb->s_dev;
767 		__entry->type		= type;
768 		__entry->gc_type	= gc_type;
769 		__entry->alloc_mode	= p->alloc_mode;
770 		__entry->gc_mode	= p->gc_mode;
771 		__entry->victim		= p->min_segno;
772 		__entry->cost		= p->min_cost;
773 		__entry->ofs_unit	= p->ofs_unit;
774 		__entry->pre_victim	= pre_victim;
775 		__entry->prefree	= prefree;
776 		__entry->free		= free;
777 	),
778 
779 	TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), "
780 		"victim = %u, cost = %u, ofs_unit = %u, "
781 		"pre_victim_secno = %d, prefree = %u, free = %u",
782 		show_dev(__entry->dev),
783 		show_data_type(__entry->type),
784 		show_gc_type(__entry->gc_type),
785 		show_alloc_mode(__entry->alloc_mode),
786 		show_victim_policy(__entry->gc_mode),
787 		__entry->victim,
788 		__entry->cost,
789 		__entry->ofs_unit,
790 		(int)__entry->pre_victim,
791 		__entry->prefree,
792 		__entry->free)
793 );
794 
795 TRACE_EVENT(f2fs_lookup_start,
796 
797 	TP_PROTO(struct inode *dir, struct dentry *dentry, unsigned int flags),
798 
799 	TP_ARGS(dir, dentry, flags),
800 
801 	TP_STRUCT__entry(
802 		__field(dev_t,	dev)
803 		__field(ino_t,	ino)
804 		__field(const char *,	name)
805 		__field(unsigned int, flags)
806 	),
807 
808 	TP_fast_assign(
809 		__entry->dev	= dir->i_sb->s_dev;
810 		__entry->ino	= dir->i_ino;
811 		__entry->name	= dentry->d_name.name;
812 		__entry->flags	= flags;
813 	),
814 
815 	TP_printk("dev = (%d,%d), pino = %lu, name:%s, flags:%u",
816 		show_dev_ino(__entry),
817 		__entry->name,
818 		__entry->flags)
819 );
820 
821 TRACE_EVENT(f2fs_lookup_end,
822 
823 	TP_PROTO(struct inode *dir, struct dentry *dentry, nid_t ino,
824 		int err),
825 
826 	TP_ARGS(dir, dentry, ino, err),
827 
828 	TP_STRUCT__entry(
829 		__field(dev_t,	dev)
830 		__field(ino_t,	ino)
831 		__field(const char *,	name)
832 		__field(nid_t,	cino)
833 		__field(int,	err)
834 	),
835 
836 	TP_fast_assign(
837 		__entry->dev	= dir->i_sb->s_dev;
838 		__entry->ino	= dir->i_ino;
839 		__entry->name	= dentry->d_name.name;
840 		__entry->cino	= ino;
841 		__entry->err	= err;
842 	),
843 
844 	TP_printk("dev = (%d,%d), pino = %lu, name:%s, ino:%u, err:%d",
845 		show_dev_ino(__entry),
846 		__entry->name,
847 		__entry->cino,
848 		__entry->err)
849 );
850 
851 TRACE_EVENT(f2fs_readdir,
852 
853 	TP_PROTO(struct inode *dir, loff_t start_pos, loff_t end_pos, int err),
854 
855 	TP_ARGS(dir, start_pos, end_pos, err),
856 
857 	TP_STRUCT__entry(
858 		__field(dev_t,	dev)
859 		__field(ino_t,	ino)
860 		__field(loff_t,	start)
861 		__field(loff_t,	end)
862 		__field(int,	err)
863 	),
864 
865 	TP_fast_assign(
866 		__entry->dev	= dir->i_sb->s_dev;
867 		__entry->ino	= dir->i_ino;
868 		__entry->start	= start_pos;
869 		__entry->end	= end_pos;
870 		__entry->err	= err;
871 	),
872 
873 	TP_printk("dev = (%d,%d), ino = %lu, start_pos:%llu, end_pos:%llu, err:%d",
874 		show_dev_ino(__entry),
875 		__entry->start,
876 		__entry->end,
877 		__entry->err)
878 );
879 
880 TRACE_EVENT(f2fs_fallocate,
881 
882 	TP_PROTO(struct inode *inode, int mode,
883 				loff_t offset, loff_t len, int ret),
884 
885 	TP_ARGS(inode, mode, offset, len, ret),
886 
887 	TP_STRUCT__entry(
888 		__field(dev_t,	dev)
889 		__field(ino_t,	ino)
890 		__field(int,	mode)
891 		__field(loff_t,	offset)
892 		__field(loff_t,	len)
893 		__field(loff_t, size)
894 		__field(blkcnt_t, blocks)
895 		__field(int,	ret)
896 	),
897 
898 	TP_fast_assign(
899 		__entry->dev	= inode->i_sb->s_dev;
900 		__entry->ino	= inode->i_ino;
901 		__entry->mode	= mode;
902 		__entry->offset	= offset;
903 		__entry->len	= len;
904 		__entry->size	= inode->i_size;
905 		__entry->blocks = inode->i_blocks;
906 		__entry->ret	= ret;
907 	),
908 
909 	TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, "
910 		"len = %lld,  i_size = %lld, i_blocks = %llu, ret = %d",
911 		show_dev_ino(__entry),
912 		__entry->mode,
913 		(unsigned long long)__entry->offset,
914 		(unsigned long long)__entry->len,
915 		(unsigned long long)__entry->size,
916 		(unsigned long long)__entry->blocks,
917 		__entry->ret)
918 );
919 
920 TRACE_EVENT(f2fs_direct_IO_enter,
921 
922 	TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw),
923 
924 	TP_ARGS(inode, offset, len, rw),
925 
926 	TP_STRUCT__entry(
927 		__field(dev_t,	dev)
928 		__field(ino_t,	ino)
929 		__field(loff_t,	pos)
930 		__field(unsigned long,	len)
931 		__field(int,	rw)
932 	),
933 
934 	TP_fast_assign(
935 		__entry->dev	= inode->i_sb->s_dev;
936 		__entry->ino	= inode->i_ino;
937 		__entry->pos	= offset;
938 		__entry->len	= len;
939 		__entry->rw	= rw;
940 	),
941 
942 	TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu rw = %d",
943 		show_dev_ino(__entry),
944 		__entry->pos,
945 		__entry->len,
946 		__entry->rw)
947 );
948 
949 TRACE_EVENT(f2fs_direct_IO_exit,
950 
951 	TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
952 		 int rw, int ret),
953 
954 	TP_ARGS(inode, offset, len, rw, ret),
955 
956 	TP_STRUCT__entry(
957 		__field(dev_t,	dev)
958 		__field(ino_t,	ino)
959 		__field(loff_t,	pos)
960 		__field(unsigned long,	len)
961 		__field(int,	rw)
962 		__field(int,	ret)
963 	),
964 
965 	TP_fast_assign(
966 		__entry->dev	= inode->i_sb->s_dev;
967 		__entry->ino	= inode->i_ino;
968 		__entry->pos	= offset;
969 		__entry->len	= len;
970 		__entry->rw	= rw;
971 		__entry->ret	= ret;
972 	),
973 
974 	TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu "
975 		"rw = %d ret = %d",
976 		show_dev_ino(__entry),
977 		__entry->pos,
978 		__entry->len,
979 		__entry->rw,
980 		__entry->ret)
981 );
982 
983 TRACE_EVENT(f2fs_reserve_new_blocks,
984 
985 	TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs_in_node,
986 							blkcnt_t count),
987 
988 	TP_ARGS(inode, nid, ofs_in_node, count),
989 
990 	TP_STRUCT__entry(
991 		__field(dev_t,	dev)
992 		__field(nid_t, nid)
993 		__field(unsigned int, ofs_in_node)
994 		__field(blkcnt_t, count)
995 	),
996 
997 	TP_fast_assign(
998 		__entry->dev	= inode->i_sb->s_dev;
999 		__entry->nid	= nid;
1000 		__entry->ofs_in_node = ofs_in_node;
1001 		__entry->count = count;
1002 	),
1003 
1004 	TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u, count = %llu",
1005 		show_dev(__entry->dev),
1006 		(unsigned int)__entry->nid,
1007 		__entry->ofs_in_node,
1008 		(unsigned long long)__entry->count)
1009 );
1010 
1011 DECLARE_EVENT_CLASS(f2fs__submit_page_bio,
1012 
1013 	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
1014 
1015 	TP_ARGS(page, fio),
1016 
1017 	TP_STRUCT__entry(
1018 		__field(dev_t, dev)
1019 		__field(ino_t, ino)
1020 		__field(pgoff_t, index)
1021 		__field(block_t, old_blkaddr)
1022 		__field(block_t, new_blkaddr)
1023 		__field(int, op)
1024 		__field(int, op_flags)
1025 		__field(int, temp)
1026 		__field(int, type)
1027 	),
1028 
1029 	TP_fast_assign(
1030 		__entry->dev		= page_file_mapping(page)->host->i_sb->s_dev;
1031 		__entry->ino		= page_file_mapping(page)->host->i_ino;
1032 		__entry->index		= page->index;
1033 		__entry->old_blkaddr	= fio->old_blkaddr;
1034 		__entry->new_blkaddr	= fio->new_blkaddr;
1035 		__entry->op		= fio->op;
1036 		__entry->op_flags	= fio->op_flags;
1037 		__entry->temp		= fio->temp;
1038 		__entry->type		= fio->type;
1039 	),
1040 
1041 	TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, "
1042 		"oldaddr = 0x%llx, newaddr = 0x%llx, rw = %s(%s), type = %s_%s",
1043 		show_dev_ino(__entry),
1044 		(unsigned long)__entry->index,
1045 		(unsigned long long)__entry->old_blkaddr,
1046 		(unsigned long long)__entry->new_blkaddr,
1047 		show_bio_type(__entry->op, __entry->op_flags),
1048 		show_block_temp(__entry->temp),
1049 		show_block_type(__entry->type))
1050 );
1051 
1052 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_bio,
1053 
1054 	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
1055 
1056 	TP_ARGS(page, fio),
1057 
1058 	TP_CONDITION(page->mapping)
1059 );
1060 
1061 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_write,
1062 
1063 	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
1064 
1065 	TP_ARGS(page, fio),
1066 
1067 	TP_CONDITION(page->mapping)
1068 );
1069 
1070 DECLARE_EVENT_CLASS(f2fs__bio,
1071 
1072 	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1073 
1074 	TP_ARGS(sb, type, bio),
1075 
1076 	TP_STRUCT__entry(
1077 		__field(dev_t,	dev)
1078 		__field(dev_t,	target)
1079 		__field(int,	op)
1080 		__field(int,	op_flags)
1081 		__field(int,	type)
1082 		__field(sector_t,	sector)
1083 		__field(unsigned int,	size)
1084 	),
1085 
1086 	TP_fast_assign(
1087 		__entry->dev		= sb->s_dev;
1088 		__entry->target		= bio_dev(bio);
1089 		__entry->op		= bio_op(bio);
1090 		__entry->op_flags	= bio->bi_opf;
1091 		__entry->type		= type;
1092 		__entry->sector		= bio->bi_iter.bi_sector;
1093 		__entry->size		= bio->bi_iter.bi_size;
1094 	),
1095 
1096 	TP_printk("dev = (%d,%d)/(%d,%d), rw = %s(%s), %s, sector = %lld, size = %u",
1097 		show_dev(__entry->target),
1098 		show_dev(__entry->dev),
1099 		show_bio_type(__entry->op, __entry->op_flags),
1100 		show_block_type(__entry->type),
1101 		(unsigned long long)__entry->sector,
1102 		__entry->size)
1103 );
1104 
1105 DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_prepare_write_bio,
1106 
1107 	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1108 
1109 	TP_ARGS(sb, type, bio),
1110 
1111 	TP_CONDITION(bio)
1112 );
1113 
1114 DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_prepare_read_bio,
1115 
1116 	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1117 
1118 	TP_ARGS(sb, type, bio),
1119 
1120 	TP_CONDITION(bio)
1121 );
1122 
1123 DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_read_bio,
1124 
1125 	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1126 
1127 	TP_ARGS(sb, type, bio),
1128 
1129 	TP_CONDITION(bio)
1130 );
1131 
1132 DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_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 TRACE_EVENT(f2fs_write_begin,
1142 
1143 	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
1144 				unsigned int flags),
1145 
1146 	TP_ARGS(inode, pos, len, flags),
1147 
1148 	TP_STRUCT__entry(
1149 		__field(dev_t,	dev)
1150 		__field(ino_t,	ino)
1151 		__field(loff_t,	pos)
1152 		__field(unsigned int, len)
1153 		__field(unsigned int, flags)
1154 	),
1155 
1156 	TP_fast_assign(
1157 		__entry->dev	= inode->i_sb->s_dev;
1158 		__entry->ino	= inode->i_ino;
1159 		__entry->pos	= pos;
1160 		__entry->len	= len;
1161 		__entry->flags	= flags;
1162 	),
1163 
1164 	TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u",
1165 		show_dev_ino(__entry),
1166 		(unsigned long long)__entry->pos,
1167 		__entry->len,
1168 		__entry->flags)
1169 );
1170 
1171 TRACE_EVENT(f2fs_write_end,
1172 
1173 	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
1174 				unsigned int copied),
1175 
1176 	TP_ARGS(inode, pos, len, copied),
1177 
1178 	TP_STRUCT__entry(
1179 		__field(dev_t,	dev)
1180 		__field(ino_t,	ino)
1181 		__field(loff_t,	pos)
1182 		__field(unsigned int, len)
1183 		__field(unsigned int, copied)
1184 	),
1185 
1186 	TP_fast_assign(
1187 		__entry->dev	= inode->i_sb->s_dev;
1188 		__entry->ino	= inode->i_ino;
1189 		__entry->pos	= pos;
1190 		__entry->len	= len;
1191 		__entry->copied	= copied;
1192 	),
1193 
1194 	TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u",
1195 		show_dev_ino(__entry),
1196 		(unsigned long long)__entry->pos,
1197 		__entry->len,
1198 		__entry->copied)
1199 );
1200 
1201 DECLARE_EVENT_CLASS(f2fs__page,
1202 
1203 	TP_PROTO(struct page *page, int type),
1204 
1205 	TP_ARGS(page, type),
1206 
1207 	TP_STRUCT__entry(
1208 		__field(dev_t,	dev)
1209 		__field(ino_t,	ino)
1210 		__field(int, type)
1211 		__field(int, dir)
1212 		__field(pgoff_t, index)
1213 		__field(int, dirty)
1214 		__field(int, uptodate)
1215 	),
1216 
1217 	TP_fast_assign(
1218 		__entry->dev	= page_file_mapping(page)->host->i_sb->s_dev;
1219 		__entry->ino	= page_file_mapping(page)->host->i_ino;
1220 		__entry->type	= type;
1221 		__entry->dir	=
1222 			S_ISDIR(page_file_mapping(page)->host->i_mode);
1223 		__entry->index	= page->index;
1224 		__entry->dirty	= PageDirty(page);
1225 		__entry->uptodate = PageUptodate(page);
1226 	),
1227 
1228 	TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, "
1229 		"dirty = %d, uptodate = %d",
1230 		show_dev_ino(__entry),
1231 		show_block_type(__entry->type),
1232 		show_file_type(__entry->dir),
1233 		(unsigned long)__entry->index,
1234 		__entry->dirty,
1235 		__entry->uptodate)
1236 );
1237 
1238 DEFINE_EVENT(f2fs__page, f2fs_writepage,
1239 
1240 	TP_PROTO(struct page *page, int type),
1241 
1242 	TP_ARGS(page, type)
1243 );
1244 
1245 DEFINE_EVENT(f2fs__page, f2fs_do_write_data_page,
1246 
1247 	TP_PROTO(struct page *page, int type),
1248 
1249 	TP_ARGS(page, type)
1250 );
1251 
1252 DEFINE_EVENT(f2fs__page, f2fs_readpage,
1253 
1254 	TP_PROTO(struct page *page, int type),
1255 
1256 	TP_ARGS(page, type)
1257 );
1258 
1259 DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty,
1260 
1261 	TP_PROTO(struct page *page, int type),
1262 
1263 	TP_ARGS(page, type)
1264 );
1265 
1266 DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite,
1267 
1268 	TP_PROTO(struct page *page, int type),
1269 
1270 	TP_ARGS(page, type)
1271 );
1272 
1273 DEFINE_EVENT(f2fs__page, f2fs_register_inmem_page,
1274 
1275 	TP_PROTO(struct page *page, int type),
1276 
1277 	TP_ARGS(page, type)
1278 );
1279 
1280 DEFINE_EVENT(f2fs__page, f2fs_commit_inmem_page,
1281 
1282 	TP_PROTO(struct page *page, int type),
1283 
1284 	TP_ARGS(page, type)
1285 );
1286 
1287 TRACE_EVENT(f2fs_filemap_fault,
1288 
1289 	TP_PROTO(struct inode *inode, pgoff_t index, unsigned long ret),
1290 
1291 	TP_ARGS(inode, index, ret),
1292 
1293 	TP_STRUCT__entry(
1294 		__field(dev_t,	dev)
1295 		__field(ino_t,	ino)
1296 		__field(pgoff_t, index)
1297 		__field(unsigned long, ret)
1298 	),
1299 
1300 	TP_fast_assign(
1301 		__entry->dev	= inode->i_sb->s_dev;
1302 		__entry->ino	= inode->i_ino;
1303 		__entry->index	= index;
1304 		__entry->ret	= ret;
1305 	),
1306 
1307 	TP_printk("dev = (%d,%d), ino = %lu, index = %lu, ret = %lx",
1308 		show_dev_ino(__entry),
1309 		(unsigned long)__entry->index,
1310 		__entry->ret)
1311 );
1312 
1313 TRACE_EVENT(f2fs_writepages,
1314 
1315 	TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type),
1316 
1317 	TP_ARGS(inode, wbc, type),
1318 
1319 	TP_STRUCT__entry(
1320 		__field(dev_t,	dev)
1321 		__field(ino_t,	ino)
1322 		__field(int,	type)
1323 		__field(int,	dir)
1324 		__field(long,	nr_to_write)
1325 		__field(long,	pages_skipped)
1326 		__field(loff_t,	range_start)
1327 		__field(loff_t,	range_end)
1328 		__field(pgoff_t, writeback_index)
1329 		__field(int,	sync_mode)
1330 		__field(char,	for_kupdate)
1331 		__field(char,	for_background)
1332 		__field(char,	tagged_writepages)
1333 		__field(char,	for_reclaim)
1334 		__field(char,	range_cyclic)
1335 		__field(char,	for_sync)
1336 	),
1337 
1338 	TP_fast_assign(
1339 		__entry->dev		= inode->i_sb->s_dev;
1340 		__entry->ino		= inode->i_ino;
1341 		__entry->type		= type;
1342 		__entry->dir		= S_ISDIR(inode->i_mode);
1343 		__entry->nr_to_write	= wbc->nr_to_write;
1344 		__entry->pages_skipped	= wbc->pages_skipped;
1345 		__entry->range_start	= wbc->range_start;
1346 		__entry->range_end	= wbc->range_end;
1347 		__entry->writeback_index = inode->i_mapping->writeback_index;
1348 		__entry->sync_mode	= wbc->sync_mode;
1349 		__entry->for_kupdate	= wbc->for_kupdate;
1350 		__entry->for_background	= wbc->for_background;
1351 		__entry->tagged_writepages	= wbc->tagged_writepages;
1352 		__entry->for_reclaim	= wbc->for_reclaim;
1353 		__entry->range_cyclic	= wbc->range_cyclic;
1354 		__entry->for_sync	= wbc->for_sync;
1355 	),
1356 
1357 	TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
1358 		"skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
1359 		"kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
1360 		show_dev_ino(__entry),
1361 		show_block_type(__entry->type),
1362 		show_file_type(__entry->dir),
1363 		__entry->nr_to_write,
1364 		__entry->pages_skipped,
1365 		__entry->range_start,
1366 		__entry->range_end,
1367 		(unsigned long)__entry->writeback_index,
1368 		__entry->sync_mode,
1369 		__entry->for_kupdate,
1370 		__entry->for_background,
1371 		__entry->tagged_writepages,
1372 		__entry->for_reclaim,
1373 		__entry->range_cyclic,
1374 		__entry->for_sync)
1375 );
1376 
1377 TRACE_EVENT(f2fs_readpages,
1378 
1379 	TP_PROTO(struct inode *inode, struct page *page, unsigned int nrpage),
1380 
1381 	TP_ARGS(inode, page, nrpage),
1382 
1383 	TP_STRUCT__entry(
1384 		__field(dev_t,	dev)
1385 		__field(ino_t,	ino)
1386 		__field(pgoff_t,	start)
1387 		__field(unsigned int,	nrpage)
1388 	),
1389 
1390 	TP_fast_assign(
1391 		__entry->dev	= inode->i_sb->s_dev;
1392 		__entry->ino	= inode->i_ino;
1393 		__entry->start	= page->index;
1394 		__entry->nrpage	= nrpage;
1395 	),
1396 
1397 	TP_printk("dev = (%d,%d), ino = %lu, start = %lu nrpage = %u",
1398 		show_dev_ino(__entry),
1399 		(unsigned long)__entry->start,
1400 		__entry->nrpage)
1401 );
1402 
1403 TRACE_EVENT(f2fs_write_checkpoint,
1404 
1405 	TP_PROTO(struct super_block *sb, int reason, char *msg),
1406 
1407 	TP_ARGS(sb, reason, msg),
1408 
1409 	TP_STRUCT__entry(
1410 		__field(dev_t,	dev)
1411 		__field(int,	reason)
1412 		__field(char *,	msg)
1413 	),
1414 
1415 	TP_fast_assign(
1416 		__entry->dev		= sb->s_dev;
1417 		__entry->reason		= reason;
1418 		__entry->msg		= msg;
1419 	),
1420 
1421 	TP_printk("dev = (%d,%d), checkpoint for %s, state = %s",
1422 		show_dev(__entry->dev),
1423 		show_cpreason(__entry->reason),
1424 		__entry->msg)
1425 );
1426 
1427 DECLARE_EVENT_CLASS(f2fs_discard,
1428 
1429 	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1430 
1431 	TP_ARGS(dev, blkstart, blklen),
1432 
1433 	TP_STRUCT__entry(
1434 		__field(dev_t,	dev)
1435 		__field(block_t, blkstart)
1436 		__field(block_t, blklen)
1437 	),
1438 
1439 	TP_fast_assign(
1440 		__entry->dev	= dev->bd_dev;
1441 		__entry->blkstart = blkstart;
1442 		__entry->blklen = blklen;
1443 	),
1444 
1445 	TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx",
1446 		show_dev(__entry->dev),
1447 		(unsigned long long)__entry->blkstart,
1448 		(unsigned long long)__entry->blklen)
1449 );
1450 
1451 DEFINE_EVENT(f2fs_discard, f2fs_queue_discard,
1452 
1453 	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1454 
1455 	TP_ARGS(dev, blkstart, blklen)
1456 );
1457 
1458 DEFINE_EVENT(f2fs_discard, f2fs_issue_discard,
1459 
1460 	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1461 
1462 	TP_ARGS(dev, blkstart, blklen)
1463 );
1464 
1465 DEFINE_EVENT(f2fs_discard, f2fs_remove_discard,
1466 
1467 	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1468 
1469 	TP_ARGS(dev, blkstart, blklen)
1470 );
1471 
1472 TRACE_EVENT(f2fs_issue_reset_zone,
1473 
1474 	TP_PROTO(struct block_device *dev, block_t blkstart),
1475 
1476 	TP_ARGS(dev, blkstart),
1477 
1478 	TP_STRUCT__entry(
1479 		__field(dev_t,	dev)
1480 		__field(block_t, blkstart)
1481 	),
1482 
1483 	TP_fast_assign(
1484 		__entry->dev	= dev->bd_dev;
1485 		__entry->blkstart = blkstart;
1486 	),
1487 
1488 	TP_printk("dev = (%d,%d), reset zone at block = 0x%llx",
1489 		show_dev(__entry->dev),
1490 		(unsigned long long)__entry->blkstart)
1491 );
1492 
1493 TRACE_EVENT(f2fs_issue_flush,
1494 
1495 	TP_PROTO(struct block_device *dev, unsigned int nobarrier,
1496 				unsigned int flush_merge, int ret),
1497 
1498 	TP_ARGS(dev, nobarrier, flush_merge, ret),
1499 
1500 	TP_STRUCT__entry(
1501 		__field(dev_t,	dev)
1502 		__field(unsigned int, nobarrier)
1503 		__field(unsigned int, flush_merge)
1504 		__field(int,  ret)
1505 	),
1506 
1507 	TP_fast_assign(
1508 		__entry->dev	= dev->bd_dev;
1509 		__entry->nobarrier = nobarrier;
1510 		__entry->flush_merge = flush_merge;
1511 		__entry->ret = ret;
1512 	),
1513 
1514 	TP_printk("dev = (%d,%d), %s %s, ret = %d",
1515 		show_dev(__entry->dev),
1516 		__entry->nobarrier ? "skip (nobarrier)" : "issue",
1517 		__entry->flush_merge ? " with flush_merge" : "",
1518 		__entry->ret)
1519 );
1520 
1521 TRACE_EVENT(f2fs_lookup_extent_tree_start,
1522 
1523 	TP_PROTO(struct inode *inode, unsigned int pgofs),
1524 
1525 	TP_ARGS(inode, pgofs),
1526 
1527 	TP_STRUCT__entry(
1528 		__field(dev_t,	dev)
1529 		__field(ino_t,	ino)
1530 		__field(unsigned int, pgofs)
1531 	),
1532 
1533 	TP_fast_assign(
1534 		__entry->dev = inode->i_sb->s_dev;
1535 		__entry->ino = inode->i_ino;
1536 		__entry->pgofs = pgofs;
1537 	),
1538 
1539 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u",
1540 		show_dev_ino(__entry),
1541 		__entry->pgofs)
1542 );
1543 
1544 TRACE_EVENT_CONDITION(f2fs_lookup_extent_tree_end,
1545 
1546 	TP_PROTO(struct inode *inode, unsigned int pgofs,
1547 						struct extent_info *ei),
1548 
1549 	TP_ARGS(inode, pgofs, ei),
1550 
1551 	TP_CONDITION(ei),
1552 
1553 	TP_STRUCT__entry(
1554 		__field(dev_t,	dev)
1555 		__field(ino_t,	ino)
1556 		__field(unsigned int, pgofs)
1557 		__field(unsigned int, fofs)
1558 		__field(u32, blk)
1559 		__field(unsigned int, len)
1560 	),
1561 
1562 	TP_fast_assign(
1563 		__entry->dev = inode->i_sb->s_dev;
1564 		__entry->ino = inode->i_ino;
1565 		__entry->pgofs = pgofs;
1566 		__entry->fofs = ei->fofs;
1567 		__entry->blk = ei->blk;
1568 		__entry->len = ei->len;
1569 	),
1570 
1571 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1572 		"ext_info(fofs: %u, blk: %u, len: %u)",
1573 		show_dev_ino(__entry),
1574 		__entry->pgofs,
1575 		__entry->fofs,
1576 		__entry->blk,
1577 		__entry->len)
1578 );
1579 
1580 TRACE_EVENT(f2fs_update_extent_tree_range,
1581 
1582 	TP_PROTO(struct inode *inode, unsigned int pgofs, block_t blkaddr,
1583 						unsigned int len),
1584 
1585 	TP_ARGS(inode, pgofs, blkaddr, len),
1586 
1587 	TP_STRUCT__entry(
1588 		__field(dev_t,	dev)
1589 		__field(ino_t,	ino)
1590 		__field(unsigned int, pgofs)
1591 		__field(u32, blk)
1592 		__field(unsigned int, len)
1593 	),
1594 
1595 	TP_fast_assign(
1596 		__entry->dev = inode->i_sb->s_dev;
1597 		__entry->ino = inode->i_ino;
1598 		__entry->pgofs = pgofs;
1599 		__entry->blk = blkaddr;
1600 		__entry->len = len;
1601 	),
1602 
1603 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1604 					"blkaddr = %u, len = %u",
1605 		show_dev_ino(__entry),
1606 		__entry->pgofs,
1607 		__entry->blk,
1608 		__entry->len)
1609 );
1610 
1611 TRACE_EVENT(f2fs_shrink_extent_tree,
1612 
1613 	TP_PROTO(struct f2fs_sb_info *sbi, unsigned int node_cnt,
1614 						unsigned int tree_cnt),
1615 
1616 	TP_ARGS(sbi, node_cnt, tree_cnt),
1617 
1618 	TP_STRUCT__entry(
1619 		__field(dev_t,	dev)
1620 		__field(unsigned int, node_cnt)
1621 		__field(unsigned int, tree_cnt)
1622 	),
1623 
1624 	TP_fast_assign(
1625 		__entry->dev = sbi->sb->s_dev;
1626 		__entry->node_cnt = node_cnt;
1627 		__entry->tree_cnt = tree_cnt;
1628 	),
1629 
1630 	TP_printk("dev = (%d,%d), shrunk: node_cnt = %u, tree_cnt = %u",
1631 		show_dev(__entry->dev),
1632 		__entry->node_cnt,
1633 		__entry->tree_cnt)
1634 );
1635 
1636 TRACE_EVENT(f2fs_destroy_extent_tree,
1637 
1638 	TP_PROTO(struct inode *inode, unsigned int node_cnt),
1639 
1640 	TP_ARGS(inode, node_cnt),
1641 
1642 	TP_STRUCT__entry(
1643 		__field(dev_t,	dev)
1644 		__field(ino_t,	ino)
1645 		__field(unsigned int, node_cnt)
1646 	),
1647 
1648 	TP_fast_assign(
1649 		__entry->dev = inode->i_sb->s_dev;
1650 		__entry->ino = inode->i_ino;
1651 		__entry->node_cnt = node_cnt;
1652 	),
1653 
1654 	TP_printk("dev = (%d,%d), ino = %lu, destroyed: node_cnt = %u",
1655 		show_dev_ino(__entry),
1656 		__entry->node_cnt)
1657 );
1658 
1659 DECLARE_EVENT_CLASS(f2fs_sync_dirty_inodes,
1660 
1661 	TP_PROTO(struct super_block *sb, int type, s64 count),
1662 
1663 	TP_ARGS(sb, type, count),
1664 
1665 	TP_STRUCT__entry(
1666 		__field(dev_t, dev)
1667 		__field(int, type)
1668 		__field(s64, count)
1669 	),
1670 
1671 	TP_fast_assign(
1672 		__entry->dev	= sb->s_dev;
1673 		__entry->type	= type;
1674 		__entry->count	= count;
1675 	),
1676 
1677 	TP_printk("dev = (%d,%d), %s, dirty count = %lld",
1678 		show_dev(__entry->dev),
1679 		show_file_type(__entry->type),
1680 		__entry->count)
1681 );
1682 
1683 DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_enter,
1684 
1685 	TP_PROTO(struct super_block *sb, int type, s64 count),
1686 
1687 	TP_ARGS(sb, type, count)
1688 );
1689 
1690 DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_exit,
1691 
1692 	TP_PROTO(struct super_block *sb, int type, s64 count),
1693 
1694 	TP_ARGS(sb, type, count)
1695 );
1696 
1697 TRACE_EVENT(f2fs_shutdown,
1698 
1699 	TP_PROTO(struct f2fs_sb_info *sbi, unsigned int mode, int ret),
1700 
1701 	TP_ARGS(sbi, mode, ret),
1702 
1703 	TP_STRUCT__entry(
1704 		__field(dev_t,	dev)
1705 		__field(unsigned int, mode)
1706 		__field(int, ret)
1707 	),
1708 
1709 	TP_fast_assign(
1710 		__entry->dev = sbi->sb->s_dev;
1711 		__entry->mode = mode;
1712 		__entry->ret = ret;
1713 	),
1714 
1715 	TP_printk("dev = (%d,%d), mode: %s, ret:%d",
1716 		show_dev(__entry->dev),
1717 		show_shutdown_mode(__entry->mode),
1718 		__entry->ret)
1719 );
1720 
1721 DECLARE_EVENT_CLASS(f2fs_zip_start,
1722 
1723 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1724 			unsigned int cluster_size, unsigned char algtype),
1725 
1726 	TP_ARGS(inode, cluster_idx, cluster_size, algtype),
1727 
1728 	TP_STRUCT__entry(
1729 		__field(dev_t,	dev)
1730 		__field(ino_t,	ino)
1731 		__field(pgoff_t, idx)
1732 		__field(unsigned int, size)
1733 		__field(unsigned int, algtype)
1734 	),
1735 
1736 	TP_fast_assign(
1737 		__entry->dev = inode->i_sb->s_dev;
1738 		__entry->ino = inode->i_ino;
1739 		__entry->idx = cluster_idx;
1740 		__entry->size = cluster_size;
1741 		__entry->algtype = algtype;
1742 	),
1743 
1744 	TP_printk("dev = (%d,%d), ino = %lu, cluster_idx:%lu, "
1745 		"cluster_size = %u, algorithm = %s",
1746 		show_dev_ino(__entry),
1747 		__entry->idx,
1748 		__entry->size,
1749 		show_compress_algorithm(__entry->algtype))
1750 );
1751 
1752 DECLARE_EVENT_CLASS(f2fs_zip_end,
1753 
1754 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1755 			unsigned int compressed_size, int ret),
1756 
1757 	TP_ARGS(inode, cluster_idx, compressed_size, ret),
1758 
1759 	TP_STRUCT__entry(
1760 		__field(dev_t,	dev)
1761 		__field(ino_t,	ino)
1762 		__field(pgoff_t, idx)
1763 		__field(unsigned int, size)
1764 		__field(unsigned int, ret)
1765 	),
1766 
1767 	TP_fast_assign(
1768 		__entry->dev = inode->i_sb->s_dev;
1769 		__entry->ino = inode->i_ino;
1770 		__entry->idx = cluster_idx;
1771 		__entry->size = compressed_size;
1772 		__entry->ret = ret;
1773 	),
1774 
1775 	TP_printk("dev = (%d,%d), ino = %lu, cluster_idx:%lu, "
1776 		"compressed_size = %u, ret = %d",
1777 		show_dev_ino(__entry),
1778 		__entry->idx,
1779 		__entry->size,
1780 		__entry->ret)
1781 );
1782 
1783 DEFINE_EVENT(f2fs_zip_start, f2fs_compress_pages_start,
1784 
1785 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1786 		unsigned int cluster_size, unsigned char algtype),
1787 
1788 	TP_ARGS(inode, cluster_idx, cluster_size, algtype)
1789 );
1790 
1791 DEFINE_EVENT(f2fs_zip_start, f2fs_decompress_pages_start,
1792 
1793 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1794 		unsigned int cluster_size, unsigned char algtype),
1795 
1796 	TP_ARGS(inode, cluster_idx, cluster_size, algtype)
1797 );
1798 
1799 DEFINE_EVENT(f2fs_zip_end, f2fs_compress_pages_end,
1800 
1801 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1802 			unsigned int compressed_size, int ret),
1803 
1804 	TP_ARGS(inode, cluster_idx, compressed_size, ret)
1805 );
1806 
1807 DEFINE_EVENT(f2fs_zip_end, f2fs_decompress_pages_end,
1808 
1809 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1810 			unsigned int compressed_size, int ret),
1811 
1812 	TP_ARGS(inode, cluster_idx, compressed_size, ret)
1813 );
1814 
1815 #endif /* _TRACE_F2FS_H */
1816 
1817  /* This part must be outside protection */
1818 #include <trace/define_trace.h>
1819