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