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