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