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