xref: /openbmc/linux/include/trace/events/f2fs.h (revision 559e87c4)
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(int,	ret)
548 	),
549 
550 	TP_fast_assign(
551 		__entry->dev		= inode->i_sb->s_dev;
552 		__entry->ino		= inode->i_ino;
553 		__entry->m_lblk		= map->m_lblk;
554 		__entry->m_pblk		= map->m_pblk;
555 		__entry->m_len		= map->m_len;
556 		__entry->ret		= ret;
557 	),
558 
559 	TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, "
560 		"start blkaddr = 0x%llx, len = 0x%llx, err = %d",
561 		show_dev_ino(__entry),
562 		(unsigned long long)__entry->m_lblk,
563 		(unsigned long long)__entry->m_pblk,
564 		(unsigned long long)__entry->m_len,
565 		__entry->ret)
566 );
567 
568 TRACE_EVENT(f2fs_background_gc,
569 
570 	TP_PROTO(struct super_block *sb, unsigned int wait_ms,
571 			unsigned int prefree, unsigned int free),
572 
573 	TP_ARGS(sb, wait_ms, prefree, free),
574 
575 	TP_STRUCT__entry(
576 		__field(dev_t,	dev)
577 		__field(unsigned int,	wait_ms)
578 		__field(unsigned int,	prefree)
579 		__field(unsigned int,	free)
580 	),
581 
582 	TP_fast_assign(
583 		__entry->dev		= sb->s_dev;
584 		__entry->wait_ms	= wait_ms;
585 		__entry->prefree	= prefree;
586 		__entry->free		= free;
587 	),
588 
589 	TP_printk("dev = (%d,%d), wait_ms = %u, prefree = %u, free = %u",
590 		show_dev(__entry->dev),
591 		__entry->wait_ms,
592 		__entry->prefree,
593 		__entry->free)
594 );
595 
596 TRACE_EVENT(f2fs_gc_begin,
597 
598 	TP_PROTO(struct super_block *sb, bool sync, bool background,
599 			long long dirty_nodes, long long dirty_dents,
600 			long long dirty_imeta, unsigned int free_sec,
601 			unsigned int free_seg, int reserved_seg,
602 			unsigned int prefree_seg),
603 
604 	TP_ARGS(sb, sync, background, dirty_nodes, dirty_dents, dirty_imeta,
605 		free_sec, free_seg, reserved_seg, prefree_seg),
606 
607 	TP_STRUCT__entry(
608 		__field(dev_t,		dev)
609 		__field(bool,		sync)
610 		__field(bool,		background)
611 		__field(long long,	dirty_nodes)
612 		__field(long long,	dirty_dents)
613 		__field(long long,	dirty_imeta)
614 		__field(unsigned int,	free_sec)
615 		__field(unsigned int,	free_seg)
616 		__field(int,		reserved_seg)
617 		__field(unsigned int,	prefree_seg)
618 	),
619 
620 	TP_fast_assign(
621 		__entry->dev		= sb->s_dev;
622 		__entry->sync		= sync;
623 		__entry->background	= background;
624 		__entry->dirty_nodes	= dirty_nodes;
625 		__entry->dirty_dents	= dirty_dents;
626 		__entry->dirty_imeta	= dirty_imeta;
627 		__entry->free_sec	= free_sec;
628 		__entry->free_seg	= free_seg;
629 		__entry->reserved_seg	= reserved_seg;
630 		__entry->prefree_seg	= prefree_seg;
631 	),
632 
633 	TP_printk("dev = (%d,%d), sync = %d, background = %d, nodes = %lld, "
634 		"dents = %lld, imeta = %lld, free_sec:%u, free_seg:%u, "
635 		"rsv_seg:%d, prefree_seg:%u",
636 		show_dev(__entry->dev),
637 		__entry->sync,
638 		__entry->background,
639 		__entry->dirty_nodes,
640 		__entry->dirty_dents,
641 		__entry->dirty_imeta,
642 		__entry->free_sec,
643 		__entry->free_seg,
644 		__entry->reserved_seg,
645 		__entry->prefree_seg)
646 );
647 
648 TRACE_EVENT(f2fs_gc_end,
649 
650 	TP_PROTO(struct super_block *sb, int ret, int seg_freed,
651 			int sec_freed, long long dirty_nodes,
652 			long long dirty_dents, long long dirty_imeta,
653 			unsigned int free_sec, unsigned int free_seg,
654 			int reserved_seg, unsigned int prefree_seg),
655 
656 	TP_ARGS(sb, ret, seg_freed, sec_freed, dirty_nodes, dirty_dents,
657 		dirty_imeta, free_sec, free_seg, reserved_seg, prefree_seg),
658 
659 	TP_STRUCT__entry(
660 		__field(dev_t,		dev)
661 		__field(int,		ret)
662 		__field(int,		seg_freed)
663 		__field(int,		sec_freed)
664 		__field(long long,	dirty_nodes)
665 		__field(long long,	dirty_dents)
666 		__field(long long,	dirty_imeta)
667 		__field(unsigned int,	free_sec)
668 		__field(unsigned int,	free_seg)
669 		__field(int,		reserved_seg)
670 		__field(unsigned int,	prefree_seg)
671 	),
672 
673 	TP_fast_assign(
674 		__entry->dev		= sb->s_dev;
675 		__entry->ret		= ret;
676 		__entry->seg_freed	= seg_freed;
677 		__entry->sec_freed	= sec_freed;
678 		__entry->dirty_nodes	= dirty_nodes;
679 		__entry->dirty_dents	= dirty_dents;
680 		__entry->dirty_imeta	= dirty_imeta;
681 		__entry->free_sec	= free_sec;
682 		__entry->free_seg	= free_seg;
683 		__entry->reserved_seg	= reserved_seg;
684 		__entry->prefree_seg	= prefree_seg;
685 	),
686 
687 	TP_printk("dev = (%d,%d), ret = %d, seg_freed = %d, sec_freed = %d, "
688 		"nodes = %lld, dents = %lld, imeta = %lld, free_sec:%u, "
689 		"free_seg:%u, rsv_seg:%d, prefree_seg:%u",
690 		show_dev(__entry->dev),
691 		__entry->ret,
692 		__entry->seg_freed,
693 		__entry->sec_freed,
694 		__entry->dirty_nodes,
695 		__entry->dirty_dents,
696 		__entry->dirty_imeta,
697 		__entry->free_sec,
698 		__entry->free_seg,
699 		__entry->reserved_seg,
700 		__entry->prefree_seg)
701 );
702 
703 TRACE_EVENT(f2fs_get_victim,
704 
705 	TP_PROTO(struct super_block *sb, int type, int gc_type,
706 			struct victim_sel_policy *p, unsigned int pre_victim,
707 			unsigned int prefree, unsigned int free),
708 
709 	TP_ARGS(sb, type, gc_type, p, pre_victim, prefree, free),
710 
711 	TP_STRUCT__entry(
712 		__field(dev_t,	dev)
713 		__field(int,	type)
714 		__field(int,	gc_type)
715 		__field(int,	alloc_mode)
716 		__field(int,	gc_mode)
717 		__field(unsigned int,	victim)
718 		__field(unsigned int,	cost)
719 		__field(unsigned int,	ofs_unit)
720 		__field(unsigned int,	pre_victim)
721 		__field(unsigned int,	prefree)
722 		__field(unsigned int,	free)
723 	),
724 
725 	TP_fast_assign(
726 		__entry->dev		= sb->s_dev;
727 		__entry->type		= type;
728 		__entry->gc_type	= gc_type;
729 		__entry->alloc_mode	= p->alloc_mode;
730 		__entry->gc_mode	= p->gc_mode;
731 		__entry->victim		= p->min_segno;
732 		__entry->cost		= p->min_cost;
733 		__entry->ofs_unit	= p->ofs_unit;
734 		__entry->pre_victim	= pre_victim;
735 		__entry->prefree	= prefree;
736 		__entry->free		= free;
737 	),
738 
739 	TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), "
740 		"victim = %u, cost = %u, ofs_unit = %u, "
741 		"pre_victim_secno = %d, prefree = %u, free = %u",
742 		show_dev(__entry->dev),
743 		show_data_type(__entry->type),
744 		show_gc_type(__entry->gc_type),
745 		show_alloc_mode(__entry->alloc_mode),
746 		show_victim_policy(__entry->gc_mode),
747 		__entry->victim,
748 		__entry->cost,
749 		__entry->ofs_unit,
750 		(int)__entry->pre_victim,
751 		__entry->prefree,
752 		__entry->free)
753 );
754 
755 TRACE_EVENT(f2fs_lookup_start,
756 
757 	TP_PROTO(struct inode *dir, struct dentry *dentry, unsigned int flags),
758 
759 	TP_ARGS(dir, dentry, flags),
760 
761 	TP_STRUCT__entry(
762 		__field(dev_t,	dev)
763 		__field(ino_t,	ino)
764 		__field(const char *,	name)
765 		__field(unsigned int, flags)
766 	),
767 
768 	TP_fast_assign(
769 		__entry->dev	= dir->i_sb->s_dev;
770 		__entry->ino	= dir->i_ino;
771 		__entry->name	= dentry->d_name.name;
772 		__entry->flags	= flags;
773 	),
774 
775 	TP_printk("dev = (%d,%d), pino = %lu, name:%s, flags:%u",
776 		show_dev_ino(__entry),
777 		__entry->name,
778 		__entry->flags)
779 );
780 
781 TRACE_EVENT(f2fs_lookup_end,
782 
783 	TP_PROTO(struct inode *dir, struct dentry *dentry, nid_t ino,
784 		int err),
785 
786 	TP_ARGS(dir, dentry, ino, err),
787 
788 	TP_STRUCT__entry(
789 		__field(dev_t,	dev)
790 		__field(ino_t,	ino)
791 		__field(const char *,	name)
792 		__field(nid_t,	cino)
793 		__field(int,	err)
794 	),
795 
796 	TP_fast_assign(
797 		__entry->dev	= dir->i_sb->s_dev;
798 		__entry->ino	= dir->i_ino;
799 		__entry->name	= dentry->d_name.name;
800 		__entry->cino	= ino;
801 		__entry->err	= err;
802 	),
803 
804 	TP_printk("dev = (%d,%d), pino = %lu, name:%s, ino:%u, err:%d",
805 		show_dev_ino(__entry),
806 		__entry->name,
807 		__entry->cino,
808 		__entry->err)
809 );
810 
811 TRACE_EVENT(f2fs_readdir,
812 
813 	TP_PROTO(struct inode *dir, loff_t start_pos, loff_t end_pos, int err),
814 
815 	TP_ARGS(dir, start_pos, end_pos, err),
816 
817 	TP_STRUCT__entry(
818 		__field(dev_t,	dev)
819 		__field(ino_t,	ino)
820 		__field(loff_t,	start)
821 		__field(loff_t,	end)
822 		__field(int,	err)
823 	),
824 
825 	TP_fast_assign(
826 		__entry->dev	= dir->i_sb->s_dev;
827 		__entry->ino	= dir->i_ino;
828 		__entry->start	= start_pos;
829 		__entry->end	= end_pos;
830 		__entry->err	= err;
831 	),
832 
833 	TP_printk("dev = (%d,%d), ino = %lu, start_pos:%llu, end_pos:%llu, err:%d",
834 		show_dev_ino(__entry),
835 		__entry->start,
836 		__entry->end,
837 		__entry->err)
838 );
839 
840 TRACE_EVENT(f2fs_fallocate,
841 
842 	TP_PROTO(struct inode *inode, int mode,
843 				loff_t offset, loff_t len, int ret),
844 
845 	TP_ARGS(inode, mode, offset, len, ret),
846 
847 	TP_STRUCT__entry(
848 		__field(dev_t,	dev)
849 		__field(ino_t,	ino)
850 		__field(int,	mode)
851 		__field(loff_t,	offset)
852 		__field(loff_t,	len)
853 		__field(loff_t, size)
854 		__field(blkcnt_t, blocks)
855 		__field(int,	ret)
856 	),
857 
858 	TP_fast_assign(
859 		__entry->dev	= inode->i_sb->s_dev;
860 		__entry->ino	= inode->i_ino;
861 		__entry->mode	= mode;
862 		__entry->offset	= offset;
863 		__entry->len	= len;
864 		__entry->size	= inode->i_size;
865 		__entry->blocks = inode->i_blocks;
866 		__entry->ret	= ret;
867 	),
868 
869 	TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, "
870 		"len = %lld,  i_size = %lld, i_blocks = %llu, ret = %d",
871 		show_dev_ino(__entry),
872 		__entry->mode,
873 		(unsigned long long)__entry->offset,
874 		(unsigned long long)__entry->len,
875 		(unsigned long long)__entry->size,
876 		(unsigned long long)__entry->blocks,
877 		__entry->ret)
878 );
879 
880 TRACE_EVENT(f2fs_direct_IO_enter,
881 
882 	TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw),
883 
884 	TP_ARGS(inode, offset, len, rw),
885 
886 	TP_STRUCT__entry(
887 		__field(dev_t,	dev)
888 		__field(ino_t,	ino)
889 		__field(loff_t,	pos)
890 		__field(unsigned long,	len)
891 		__field(int,	rw)
892 	),
893 
894 	TP_fast_assign(
895 		__entry->dev	= inode->i_sb->s_dev;
896 		__entry->ino	= inode->i_ino;
897 		__entry->pos	= offset;
898 		__entry->len	= len;
899 		__entry->rw	= rw;
900 	),
901 
902 	TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu rw = %d",
903 		show_dev_ino(__entry),
904 		__entry->pos,
905 		__entry->len,
906 		__entry->rw)
907 );
908 
909 TRACE_EVENT(f2fs_direct_IO_exit,
910 
911 	TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
912 		 int rw, int ret),
913 
914 	TP_ARGS(inode, offset, len, rw, ret),
915 
916 	TP_STRUCT__entry(
917 		__field(dev_t,	dev)
918 		__field(ino_t,	ino)
919 		__field(loff_t,	pos)
920 		__field(unsigned long,	len)
921 		__field(int,	rw)
922 		__field(int,	ret)
923 	),
924 
925 	TP_fast_assign(
926 		__entry->dev	= inode->i_sb->s_dev;
927 		__entry->ino	= inode->i_ino;
928 		__entry->pos	= offset;
929 		__entry->len	= len;
930 		__entry->rw	= rw;
931 		__entry->ret	= ret;
932 	),
933 
934 	TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu "
935 		"rw = %d ret = %d",
936 		show_dev_ino(__entry),
937 		__entry->pos,
938 		__entry->len,
939 		__entry->rw,
940 		__entry->ret)
941 );
942 
943 TRACE_EVENT(f2fs_reserve_new_blocks,
944 
945 	TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs_in_node,
946 							blkcnt_t count),
947 
948 	TP_ARGS(inode, nid, ofs_in_node, count),
949 
950 	TP_STRUCT__entry(
951 		__field(dev_t,	dev)
952 		__field(nid_t, nid)
953 		__field(unsigned int, ofs_in_node)
954 		__field(blkcnt_t, count)
955 	),
956 
957 	TP_fast_assign(
958 		__entry->dev	= inode->i_sb->s_dev;
959 		__entry->nid	= nid;
960 		__entry->ofs_in_node = ofs_in_node;
961 		__entry->count = count;
962 	),
963 
964 	TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u, count = %llu",
965 		show_dev(__entry->dev),
966 		(unsigned int)__entry->nid,
967 		__entry->ofs_in_node,
968 		(unsigned long long)__entry->count)
969 );
970 
971 DECLARE_EVENT_CLASS(f2fs__submit_page_bio,
972 
973 	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
974 
975 	TP_ARGS(page, fio),
976 
977 	TP_STRUCT__entry(
978 		__field(dev_t, dev)
979 		__field(ino_t, ino)
980 		__field(pgoff_t, index)
981 		__field(block_t, old_blkaddr)
982 		__field(block_t, new_blkaddr)
983 		__field(int, op)
984 		__field(int, op_flags)
985 		__field(int, temp)
986 		__field(int, type)
987 	),
988 
989 	TP_fast_assign(
990 		__entry->dev		= page->mapping->host->i_sb->s_dev;
991 		__entry->ino		= page->mapping->host->i_ino;
992 		__entry->index		= page->index;
993 		__entry->old_blkaddr	= fio->old_blkaddr;
994 		__entry->new_blkaddr	= fio->new_blkaddr;
995 		__entry->op		= fio->op;
996 		__entry->op_flags	= fio->op_flags;
997 		__entry->temp		= fio->temp;
998 		__entry->type		= fio->type;
999 	),
1000 
1001 	TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, "
1002 		"oldaddr = 0x%llx, newaddr = 0x%llx, rw = %s(%s), type = %s_%s",
1003 		show_dev_ino(__entry),
1004 		(unsigned long)__entry->index,
1005 		(unsigned long long)__entry->old_blkaddr,
1006 		(unsigned long long)__entry->new_blkaddr,
1007 		show_bio_type(__entry->op, __entry->op_flags),
1008 		show_block_temp(__entry->temp),
1009 		show_block_type(__entry->type))
1010 );
1011 
1012 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_bio,
1013 
1014 	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
1015 
1016 	TP_ARGS(page, fio),
1017 
1018 	TP_CONDITION(page->mapping)
1019 );
1020 
1021 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_write,
1022 
1023 	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
1024 
1025 	TP_ARGS(page, fio),
1026 
1027 	TP_CONDITION(page->mapping)
1028 );
1029 
1030 DECLARE_EVENT_CLASS(f2fs__bio,
1031 
1032 	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1033 
1034 	TP_ARGS(sb, type, bio),
1035 
1036 	TP_STRUCT__entry(
1037 		__field(dev_t,	dev)
1038 		__field(dev_t,	target)
1039 		__field(int,	op)
1040 		__field(int,	op_flags)
1041 		__field(int,	type)
1042 		__field(sector_t,	sector)
1043 		__field(unsigned int,	size)
1044 	),
1045 
1046 	TP_fast_assign(
1047 		__entry->dev		= sb->s_dev;
1048 		__entry->target		= bio_dev(bio);
1049 		__entry->op		= bio_op(bio);
1050 		__entry->op_flags	= bio->bi_opf;
1051 		__entry->type		= type;
1052 		__entry->sector		= bio->bi_iter.bi_sector;
1053 		__entry->size		= bio->bi_iter.bi_size;
1054 	),
1055 
1056 	TP_printk("dev = (%d,%d)/(%d,%d), rw = %s(%s), %s, sector = %lld, size = %u",
1057 		show_dev(__entry->target),
1058 		show_dev(__entry->dev),
1059 		show_bio_type(__entry->op, __entry->op_flags),
1060 		show_block_type(__entry->type),
1061 		(unsigned long long)__entry->sector,
1062 		__entry->size)
1063 );
1064 
1065 DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_prepare_write_bio,
1066 
1067 	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1068 
1069 	TP_ARGS(sb, type, bio),
1070 
1071 	TP_CONDITION(bio)
1072 );
1073 
1074 DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_prepare_read_bio,
1075 
1076 	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1077 
1078 	TP_ARGS(sb, type, bio),
1079 
1080 	TP_CONDITION(bio)
1081 );
1082 
1083 DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_read_bio,
1084 
1085 	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1086 
1087 	TP_ARGS(sb, type, bio),
1088 
1089 	TP_CONDITION(bio)
1090 );
1091 
1092 DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_write_bio,
1093 
1094 	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1095 
1096 	TP_ARGS(sb, type, bio),
1097 
1098 	TP_CONDITION(bio)
1099 );
1100 
1101 TRACE_EVENT(f2fs_write_begin,
1102 
1103 	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
1104 				unsigned int flags),
1105 
1106 	TP_ARGS(inode, pos, len, flags),
1107 
1108 	TP_STRUCT__entry(
1109 		__field(dev_t,	dev)
1110 		__field(ino_t,	ino)
1111 		__field(loff_t,	pos)
1112 		__field(unsigned int, len)
1113 		__field(unsigned int, flags)
1114 	),
1115 
1116 	TP_fast_assign(
1117 		__entry->dev	= inode->i_sb->s_dev;
1118 		__entry->ino	= inode->i_ino;
1119 		__entry->pos	= pos;
1120 		__entry->len	= len;
1121 		__entry->flags	= flags;
1122 	),
1123 
1124 	TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u",
1125 		show_dev_ino(__entry),
1126 		(unsigned long long)__entry->pos,
1127 		__entry->len,
1128 		__entry->flags)
1129 );
1130 
1131 TRACE_EVENT(f2fs_write_end,
1132 
1133 	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
1134 				unsigned int copied),
1135 
1136 	TP_ARGS(inode, pos, len, copied),
1137 
1138 	TP_STRUCT__entry(
1139 		__field(dev_t,	dev)
1140 		__field(ino_t,	ino)
1141 		__field(loff_t,	pos)
1142 		__field(unsigned int, len)
1143 		__field(unsigned int, copied)
1144 	),
1145 
1146 	TP_fast_assign(
1147 		__entry->dev	= inode->i_sb->s_dev;
1148 		__entry->ino	= inode->i_ino;
1149 		__entry->pos	= pos;
1150 		__entry->len	= len;
1151 		__entry->copied	= copied;
1152 	),
1153 
1154 	TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u",
1155 		show_dev_ino(__entry),
1156 		(unsigned long long)__entry->pos,
1157 		__entry->len,
1158 		__entry->copied)
1159 );
1160 
1161 DECLARE_EVENT_CLASS(f2fs__page,
1162 
1163 	TP_PROTO(struct page *page, int type),
1164 
1165 	TP_ARGS(page, type),
1166 
1167 	TP_STRUCT__entry(
1168 		__field(dev_t,	dev)
1169 		__field(ino_t,	ino)
1170 		__field(int, type)
1171 		__field(int, dir)
1172 		__field(pgoff_t, index)
1173 		__field(int, dirty)
1174 		__field(int, uptodate)
1175 	),
1176 
1177 	TP_fast_assign(
1178 		__entry->dev	= page->mapping->host->i_sb->s_dev;
1179 		__entry->ino	= page->mapping->host->i_ino;
1180 		__entry->type	= type;
1181 		__entry->dir	= S_ISDIR(page->mapping->host->i_mode);
1182 		__entry->index	= page->index;
1183 		__entry->dirty	= PageDirty(page);
1184 		__entry->uptodate = PageUptodate(page);
1185 	),
1186 
1187 	TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, "
1188 		"dirty = %d, uptodate = %d",
1189 		show_dev_ino(__entry),
1190 		show_block_type(__entry->type),
1191 		show_file_type(__entry->dir),
1192 		(unsigned long)__entry->index,
1193 		__entry->dirty,
1194 		__entry->uptodate)
1195 );
1196 
1197 DEFINE_EVENT(f2fs__page, f2fs_writepage,
1198 
1199 	TP_PROTO(struct page *page, int type),
1200 
1201 	TP_ARGS(page, type)
1202 );
1203 
1204 DEFINE_EVENT(f2fs__page, f2fs_do_write_data_page,
1205 
1206 	TP_PROTO(struct page *page, int type),
1207 
1208 	TP_ARGS(page, type)
1209 );
1210 
1211 DEFINE_EVENT(f2fs__page, f2fs_readpage,
1212 
1213 	TP_PROTO(struct page *page, int type),
1214 
1215 	TP_ARGS(page, type)
1216 );
1217 
1218 DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty,
1219 
1220 	TP_PROTO(struct page *page, int type),
1221 
1222 	TP_ARGS(page, type)
1223 );
1224 
1225 DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite,
1226 
1227 	TP_PROTO(struct page *page, int type),
1228 
1229 	TP_ARGS(page, type)
1230 );
1231 
1232 DEFINE_EVENT(f2fs__page, f2fs_register_inmem_page,
1233 
1234 	TP_PROTO(struct page *page, int type),
1235 
1236 	TP_ARGS(page, type)
1237 );
1238 
1239 DEFINE_EVENT(f2fs__page, f2fs_commit_inmem_page,
1240 
1241 	TP_PROTO(struct page *page, int type),
1242 
1243 	TP_ARGS(page, type)
1244 );
1245 
1246 TRACE_EVENT(f2fs_writepages,
1247 
1248 	TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type),
1249 
1250 	TP_ARGS(inode, wbc, type),
1251 
1252 	TP_STRUCT__entry(
1253 		__field(dev_t,	dev)
1254 		__field(ino_t,	ino)
1255 		__field(int,	type)
1256 		__field(int,	dir)
1257 		__field(long,	nr_to_write)
1258 		__field(long,	pages_skipped)
1259 		__field(loff_t,	range_start)
1260 		__field(loff_t,	range_end)
1261 		__field(pgoff_t, writeback_index)
1262 		__field(int,	sync_mode)
1263 		__field(char,	for_kupdate)
1264 		__field(char,	for_background)
1265 		__field(char,	tagged_writepages)
1266 		__field(char,	for_reclaim)
1267 		__field(char,	range_cyclic)
1268 		__field(char,	for_sync)
1269 	),
1270 
1271 	TP_fast_assign(
1272 		__entry->dev		= inode->i_sb->s_dev;
1273 		__entry->ino		= inode->i_ino;
1274 		__entry->type		= type;
1275 		__entry->dir		= S_ISDIR(inode->i_mode);
1276 		__entry->nr_to_write	= wbc->nr_to_write;
1277 		__entry->pages_skipped	= wbc->pages_skipped;
1278 		__entry->range_start	= wbc->range_start;
1279 		__entry->range_end	= wbc->range_end;
1280 		__entry->writeback_index = inode->i_mapping->writeback_index;
1281 		__entry->sync_mode	= wbc->sync_mode;
1282 		__entry->for_kupdate	= wbc->for_kupdate;
1283 		__entry->for_background	= wbc->for_background;
1284 		__entry->tagged_writepages	= wbc->tagged_writepages;
1285 		__entry->for_reclaim	= wbc->for_reclaim;
1286 		__entry->range_cyclic	= wbc->range_cyclic;
1287 		__entry->for_sync	= wbc->for_sync;
1288 	),
1289 
1290 	TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
1291 		"skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
1292 		"kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
1293 		show_dev_ino(__entry),
1294 		show_block_type(__entry->type),
1295 		show_file_type(__entry->dir),
1296 		__entry->nr_to_write,
1297 		__entry->pages_skipped,
1298 		__entry->range_start,
1299 		__entry->range_end,
1300 		(unsigned long)__entry->writeback_index,
1301 		__entry->sync_mode,
1302 		__entry->for_kupdate,
1303 		__entry->for_background,
1304 		__entry->tagged_writepages,
1305 		__entry->for_reclaim,
1306 		__entry->range_cyclic,
1307 		__entry->for_sync)
1308 );
1309 
1310 TRACE_EVENT(f2fs_readpages,
1311 
1312 	TP_PROTO(struct inode *inode, struct page *page, unsigned int nrpage),
1313 
1314 	TP_ARGS(inode, page, nrpage),
1315 
1316 	TP_STRUCT__entry(
1317 		__field(dev_t,	dev)
1318 		__field(ino_t,	ino)
1319 		__field(pgoff_t,	start)
1320 		__field(unsigned int,	nrpage)
1321 	),
1322 
1323 	TP_fast_assign(
1324 		__entry->dev	= inode->i_sb->s_dev;
1325 		__entry->ino	= inode->i_ino;
1326 		__entry->start	= page->index;
1327 		__entry->nrpage	= nrpage;
1328 	),
1329 
1330 	TP_printk("dev = (%d,%d), ino = %lu, start = %lu nrpage = %u",
1331 		show_dev_ino(__entry),
1332 		(unsigned long)__entry->start,
1333 		__entry->nrpage)
1334 );
1335 
1336 TRACE_EVENT(f2fs_write_checkpoint,
1337 
1338 	TP_PROTO(struct super_block *sb, int reason, char *msg),
1339 
1340 	TP_ARGS(sb, reason, msg),
1341 
1342 	TP_STRUCT__entry(
1343 		__field(dev_t,	dev)
1344 		__field(int,	reason)
1345 		__field(char *,	msg)
1346 	),
1347 
1348 	TP_fast_assign(
1349 		__entry->dev		= sb->s_dev;
1350 		__entry->reason		= reason;
1351 		__entry->msg		= msg;
1352 	),
1353 
1354 	TP_printk("dev = (%d,%d), checkpoint for %s, state = %s",
1355 		show_dev(__entry->dev),
1356 		show_cpreason(__entry->reason),
1357 		__entry->msg)
1358 );
1359 
1360 DECLARE_EVENT_CLASS(f2fs_discard,
1361 
1362 	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1363 
1364 	TP_ARGS(dev, blkstart, blklen),
1365 
1366 	TP_STRUCT__entry(
1367 		__field(dev_t,	dev)
1368 		__field(block_t, blkstart)
1369 		__field(block_t, blklen)
1370 	),
1371 
1372 	TP_fast_assign(
1373 		__entry->dev	= dev->bd_dev;
1374 		__entry->blkstart = blkstart;
1375 		__entry->blklen = blklen;
1376 	),
1377 
1378 	TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx",
1379 		show_dev(__entry->dev),
1380 		(unsigned long long)__entry->blkstart,
1381 		(unsigned long long)__entry->blklen)
1382 );
1383 
1384 DEFINE_EVENT(f2fs_discard, f2fs_queue_discard,
1385 
1386 	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1387 
1388 	TP_ARGS(dev, blkstart, blklen)
1389 );
1390 
1391 DEFINE_EVENT(f2fs_discard, f2fs_issue_discard,
1392 
1393 	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1394 
1395 	TP_ARGS(dev, blkstart, blklen)
1396 );
1397 
1398 DEFINE_EVENT(f2fs_discard, f2fs_remove_discard,
1399 
1400 	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1401 
1402 	TP_ARGS(dev, blkstart, blklen)
1403 );
1404 
1405 TRACE_EVENT(f2fs_issue_reset_zone,
1406 
1407 	TP_PROTO(struct block_device *dev, block_t blkstart),
1408 
1409 	TP_ARGS(dev, blkstart),
1410 
1411 	TP_STRUCT__entry(
1412 		__field(dev_t,	dev)
1413 		__field(block_t, blkstart)
1414 	),
1415 
1416 	TP_fast_assign(
1417 		__entry->dev	= dev->bd_dev;
1418 		__entry->blkstart = blkstart;
1419 	),
1420 
1421 	TP_printk("dev = (%d,%d), reset zone at block = 0x%llx",
1422 		show_dev(__entry->dev),
1423 		(unsigned long long)__entry->blkstart)
1424 );
1425 
1426 TRACE_EVENT(f2fs_issue_flush,
1427 
1428 	TP_PROTO(struct block_device *dev, unsigned int nobarrier,
1429 				unsigned int flush_merge, int ret),
1430 
1431 	TP_ARGS(dev, nobarrier, flush_merge, ret),
1432 
1433 	TP_STRUCT__entry(
1434 		__field(dev_t,	dev)
1435 		__field(unsigned int, nobarrier)
1436 		__field(unsigned int, flush_merge)
1437 		__field(int,  ret)
1438 	),
1439 
1440 	TP_fast_assign(
1441 		__entry->dev	= dev->bd_dev;
1442 		__entry->nobarrier = nobarrier;
1443 		__entry->flush_merge = flush_merge;
1444 		__entry->ret = ret;
1445 	),
1446 
1447 	TP_printk("dev = (%d,%d), %s %s, ret = %d",
1448 		show_dev(__entry->dev),
1449 		__entry->nobarrier ? "skip (nobarrier)" : "issue",
1450 		__entry->flush_merge ? " with flush_merge" : "",
1451 		__entry->ret)
1452 );
1453 
1454 TRACE_EVENT(f2fs_lookup_extent_tree_start,
1455 
1456 	TP_PROTO(struct inode *inode, unsigned int pgofs),
1457 
1458 	TP_ARGS(inode, pgofs),
1459 
1460 	TP_STRUCT__entry(
1461 		__field(dev_t,	dev)
1462 		__field(ino_t,	ino)
1463 		__field(unsigned int, pgofs)
1464 	),
1465 
1466 	TP_fast_assign(
1467 		__entry->dev = inode->i_sb->s_dev;
1468 		__entry->ino = inode->i_ino;
1469 		__entry->pgofs = pgofs;
1470 	),
1471 
1472 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u",
1473 		show_dev_ino(__entry),
1474 		__entry->pgofs)
1475 );
1476 
1477 TRACE_EVENT_CONDITION(f2fs_lookup_extent_tree_end,
1478 
1479 	TP_PROTO(struct inode *inode, unsigned int pgofs,
1480 						struct extent_info *ei),
1481 
1482 	TP_ARGS(inode, pgofs, ei),
1483 
1484 	TP_CONDITION(ei),
1485 
1486 	TP_STRUCT__entry(
1487 		__field(dev_t,	dev)
1488 		__field(ino_t,	ino)
1489 		__field(unsigned int, pgofs)
1490 		__field(unsigned int, fofs)
1491 		__field(u32, blk)
1492 		__field(unsigned int, len)
1493 	),
1494 
1495 	TP_fast_assign(
1496 		__entry->dev = inode->i_sb->s_dev;
1497 		__entry->ino = inode->i_ino;
1498 		__entry->pgofs = pgofs;
1499 		__entry->fofs = ei->fofs;
1500 		__entry->blk = ei->blk;
1501 		__entry->len = ei->len;
1502 	),
1503 
1504 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1505 		"ext_info(fofs: %u, blk: %u, len: %u)",
1506 		show_dev_ino(__entry),
1507 		__entry->pgofs,
1508 		__entry->fofs,
1509 		__entry->blk,
1510 		__entry->len)
1511 );
1512 
1513 TRACE_EVENT(f2fs_update_extent_tree_range,
1514 
1515 	TP_PROTO(struct inode *inode, unsigned int pgofs, block_t blkaddr,
1516 						unsigned int len),
1517 
1518 	TP_ARGS(inode, pgofs, blkaddr, len),
1519 
1520 	TP_STRUCT__entry(
1521 		__field(dev_t,	dev)
1522 		__field(ino_t,	ino)
1523 		__field(unsigned int, pgofs)
1524 		__field(u32, blk)
1525 		__field(unsigned int, len)
1526 	),
1527 
1528 	TP_fast_assign(
1529 		__entry->dev = inode->i_sb->s_dev;
1530 		__entry->ino = inode->i_ino;
1531 		__entry->pgofs = pgofs;
1532 		__entry->blk = blkaddr;
1533 		__entry->len = len;
1534 	),
1535 
1536 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1537 					"blkaddr = %u, len = %u",
1538 		show_dev_ino(__entry),
1539 		__entry->pgofs,
1540 		__entry->blk,
1541 		__entry->len)
1542 );
1543 
1544 TRACE_EVENT(f2fs_shrink_extent_tree,
1545 
1546 	TP_PROTO(struct f2fs_sb_info *sbi, unsigned int node_cnt,
1547 						unsigned int tree_cnt),
1548 
1549 	TP_ARGS(sbi, node_cnt, tree_cnt),
1550 
1551 	TP_STRUCT__entry(
1552 		__field(dev_t,	dev)
1553 		__field(unsigned int, node_cnt)
1554 		__field(unsigned int, tree_cnt)
1555 	),
1556 
1557 	TP_fast_assign(
1558 		__entry->dev = sbi->sb->s_dev;
1559 		__entry->node_cnt = node_cnt;
1560 		__entry->tree_cnt = tree_cnt;
1561 	),
1562 
1563 	TP_printk("dev = (%d,%d), shrunk: node_cnt = %u, tree_cnt = %u",
1564 		show_dev(__entry->dev),
1565 		__entry->node_cnt,
1566 		__entry->tree_cnt)
1567 );
1568 
1569 TRACE_EVENT(f2fs_destroy_extent_tree,
1570 
1571 	TP_PROTO(struct inode *inode, unsigned int node_cnt),
1572 
1573 	TP_ARGS(inode, node_cnt),
1574 
1575 	TP_STRUCT__entry(
1576 		__field(dev_t,	dev)
1577 		__field(ino_t,	ino)
1578 		__field(unsigned int, node_cnt)
1579 	),
1580 
1581 	TP_fast_assign(
1582 		__entry->dev = inode->i_sb->s_dev;
1583 		__entry->ino = inode->i_ino;
1584 		__entry->node_cnt = node_cnt;
1585 	),
1586 
1587 	TP_printk("dev = (%d,%d), ino = %lu, destroyed: node_cnt = %u",
1588 		show_dev_ino(__entry),
1589 		__entry->node_cnt)
1590 );
1591 
1592 DECLARE_EVENT_CLASS(f2fs_sync_dirty_inodes,
1593 
1594 	TP_PROTO(struct super_block *sb, int type, s64 count),
1595 
1596 	TP_ARGS(sb, type, count),
1597 
1598 	TP_STRUCT__entry(
1599 		__field(dev_t, dev)
1600 		__field(int, type)
1601 		__field(s64, count)
1602 	),
1603 
1604 	TP_fast_assign(
1605 		__entry->dev	= sb->s_dev;
1606 		__entry->type	= type;
1607 		__entry->count	= count;
1608 	),
1609 
1610 	TP_printk("dev = (%d,%d), %s, dirty count = %lld",
1611 		show_dev(__entry->dev),
1612 		show_file_type(__entry->type),
1613 		__entry->count)
1614 );
1615 
1616 DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_enter,
1617 
1618 	TP_PROTO(struct super_block *sb, int type, s64 count),
1619 
1620 	TP_ARGS(sb, type, count)
1621 );
1622 
1623 DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_exit,
1624 
1625 	TP_PROTO(struct super_block *sb, int type, s64 count),
1626 
1627 	TP_ARGS(sb, type, count)
1628 );
1629 
1630 TRACE_EVENT(f2fs_shutdown,
1631 
1632 	TP_PROTO(struct f2fs_sb_info *sbi, unsigned int mode, int ret),
1633 
1634 	TP_ARGS(sbi, mode, ret),
1635 
1636 	TP_STRUCT__entry(
1637 		__field(dev_t,	dev)
1638 		__field(unsigned int, mode)
1639 		__field(int, ret)
1640 	),
1641 
1642 	TP_fast_assign(
1643 		__entry->dev = sbi->sb->s_dev;
1644 		__entry->mode = mode;
1645 		__entry->ret = ret;
1646 	),
1647 
1648 	TP_printk("dev = (%d,%d), mode: %s, ret:%d",
1649 		show_dev(__entry->dev),
1650 		show_shutdown_mode(__entry->mode),
1651 		__entry->ret)
1652 );
1653 
1654 #endif /* _TRACE_F2FS_H */
1655 
1656  /* This part must be outside protection */
1657 #include <trace/define_trace.h>
1658