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