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