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