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 #include <uapi/linux/f2fs.h>
10 
11 #define show_dev(dev)		MAJOR(dev), MINOR(dev)
12 #define show_dev_ino(entry)	show_dev(entry->dev), (unsigned long)entry->ino
13 
14 TRACE_DEFINE_ENUM(NODE);
15 TRACE_DEFINE_ENUM(DATA);
16 TRACE_DEFINE_ENUM(META);
17 TRACE_DEFINE_ENUM(META_FLUSH);
18 TRACE_DEFINE_ENUM(IPU);
19 TRACE_DEFINE_ENUM(OPU);
20 TRACE_DEFINE_ENUM(HOT);
21 TRACE_DEFINE_ENUM(WARM);
22 TRACE_DEFINE_ENUM(COLD);
23 TRACE_DEFINE_ENUM(CURSEG_HOT_DATA);
24 TRACE_DEFINE_ENUM(CURSEG_WARM_DATA);
25 TRACE_DEFINE_ENUM(CURSEG_COLD_DATA);
26 TRACE_DEFINE_ENUM(CURSEG_HOT_NODE);
27 TRACE_DEFINE_ENUM(CURSEG_WARM_NODE);
28 TRACE_DEFINE_ENUM(CURSEG_COLD_NODE);
29 TRACE_DEFINE_ENUM(NO_CHECK_TYPE);
30 TRACE_DEFINE_ENUM(GC_GREEDY);
31 TRACE_DEFINE_ENUM(GC_CB);
32 TRACE_DEFINE_ENUM(FG_GC);
33 TRACE_DEFINE_ENUM(BG_GC);
34 TRACE_DEFINE_ENUM(LFS);
35 TRACE_DEFINE_ENUM(SSR);
36 TRACE_DEFINE_ENUM(__REQ_RAHEAD);
37 TRACE_DEFINE_ENUM(__REQ_SYNC);
38 TRACE_DEFINE_ENUM(__REQ_IDLE);
39 TRACE_DEFINE_ENUM(__REQ_PREFLUSH);
40 TRACE_DEFINE_ENUM(__REQ_FUA);
41 TRACE_DEFINE_ENUM(__REQ_PRIO);
42 TRACE_DEFINE_ENUM(__REQ_META);
43 TRACE_DEFINE_ENUM(CP_UMOUNT);
44 TRACE_DEFINE_ENUM(CP_FASTBOOT);
45 TRACE_DEFINE_ENUM(CP_SYNC);
46 TRACE_DEFINE_ENUM(CP_RECOVERY);
47 TRACE_DEFINE_ENUM(CP_DISCARD);
48 TRACE_DEFINE_ENUM(CP_TRIMMED);
49 TRACE_DEFINE_ENUM(CP_PAUSE);
50 TRACE_DEFINE_ENUM(CP_RESIZE);
51 
52 #define show_block_type(type)						\
53 	__print_symbolic(type,						\
54 		{ NODE,		"NODE" },				\
55 		{ DATA,		"DATA" },				\
56 		{ META,		"META" },				\
57 		{ META_FLUSH,	"META_FLUSH" },				\
58 		{ IPU,		"IN-PLACE" },				\
59 		{ OPU,		"OUT-OF-PLACE" })
60 
61 #define show_block_temp(temp)						\
62 	__print_symbolic(temp,						\
63 		{ HOT,		"HOT" },				\
64 		{ WARM,		"WARM" },				\
65 		{ COLD,		"COLD" })
66 
67 #define F2FS_OP_FLAGS (REQ_RAHEAD | REQ_SYNC | REQ_META | REQ_PRIO |	\
68 			REQ_PREFLUSH | REQ_FUA)
69 #define F2FS_BIO_FLAG_MASK(t) (__force u32)((t) & F2FS_OP_FLAGS)
70 
71 #define show_bio_type(op,op_flags)	show_bio_op(op),		\
72 						show_bio_op_flags(op_flags)
73 
74 #define show_bio_op(op)		blk_op_str(op)
75 
76 #define show_bio_op_flags(flags)					\
77 	__print_flags(F2FS_BIO_FLAG_MASK(flags), "|",			\
78 		{ (__force u32)REQ_RAHEAD,	"R" },			\
79 		{ (__force u32)REQ_SYNC,	"S" },			\
80 		{ (__force u32)REQ_META,	"M" },			\
81 		{ (__force u32)REQ_PRIO,	"P" },			\
82 		{ (__force u32)REQ_PREFLUSH,	"PF" },			\
83 		{ (__force u32)REQ_FUA,		"FUA" })
84 
85 #define show_data_type(type)						\
86 	__print_symbolic(type,						\
87 		{ CURSEG_HOT_DATA, 	"Hot DATA" },			\
88 		{ CURSEG_WARM_DATA, 	"Warm DATA" },			\
89 		{ CURSEG_COLD_DATA, 	"Cold DATA" },			\
90 		{ CURSEG_HOT_NODE, 	"Hot NODE" },			\
91 		{ CURSEG_WARM_NODE, 	"Warm NODE" },			\
92 		{ CURSEG_COLD_NODE, 	"Cold NODE" },			\
93 		{ NO_CHECK_TYPE, 	"No TYPE" })
94 
95 #define show_file_type(type)						\
96 	__print_symbolic(type,						\
97 		{ 0,		"FILE" },				\
98 		{ 1,		"DIR" })
99 
100 #define show_gc_type(type)						\
101 	__print_symbolic(type,						\
102 		{ FG_GC,	"Foreground GC" },			\
103 		{ BG_GC,	"Background GC" })
104 
105 #define show_alloc_mode(type)						\
106 	__print_symbolic(type,						\
107 		{ LFS,		"LFS-mode" },				\
108 		{ SSR,		"SSR-mode" },				\
109 		{ AT_SSR,	"AT_SSR-mode" })
110 
111 #define show_victim_policy(type)					\
112 	__print_symbolic(type,						\
113 		{ GC_GREEDY,	"Greedy" },				\
114 		{ GC_CB,	"Cost-Benefit" },			\
115 		{ GC_AT,	"Age-threshold" })
116 
117 #define show_cpreason(type)						\
118 	__print_flags(type, "|",					\
119 		{ CP_UMOUNT,	"Umount" },				\
120 		{ CP_FASTBOOT,	"Fastboot" },				\
121 		{ CP_SYNC,	"Sync" },				\
122 		{ CP_RECOVERY,	"Recovery" },				\
123 		{ CP_DISCARD,	"Discard" },				\
124 		{ CP_PAUSE,	"Pause" },				\
125 		{ CP_TRIMMED,	"Trimmed" },				\
126 		{ CP_RESIZE,	"Resize" })
127 
128 #define show_fsync_cpreason(type)					\
129 	__print_symbolic(type,						\
130 		{ CP_NO_NEEDED,		"no needed" },			\
131 		{ CP_NON_REGULAR,	"non regular" },		\
132 		{ CP_COMPRESSED,	"compressed" },			\
133 		{ CP_HARDLINK,		"hardlink" },			\
134 		{ CP_SB_NEED_CP,	"sb needs cp" },		\
135 		{ CP_WRONG_PINO,	"wrong pino" },			\
136 		{ CP_NO_SPC_ROLL,	"no space roll forward" },	\
137 		{ CP_NODE_NEED_CP,	"node needs cp" },		\
138 		{ CP_FASTBOOT_MODE,	"fastboot mode" },		\
139 		{ CP_SPEC_LOG_NUM,	"log type is 2" },		\
140 		{ CP_RECOVER_DIR,	"dir needs recovery" })
141 
142 #define show_shutdown_mode(type)					\
143 	__print_symbolic(type,						\
144 		{ F2FS_GOING_DOWN_FULLSYNC,	"full sync" },		\
145 		{ F2FS_GOING_DOWN_METASYNC,	"meta sync" },		\
146 		{ F2FS_GOING_DOWN_NOSYNC,	"no sync" },		\
147 		{ F2FS_GOING_DOWN_METAFLUSH,	"meta flush" },		\
148 		{ F2FS_GOING_DOWN_NEED_FSCK,	"need fsck" })
149 
150 #define show_compress_algorithm(type)					\
151 	__print_symbolic(type,						\
152 		{ COMPRESS_LZO,		"LZO" },			\
153 		{ COMPRESS_LZ4,		"LZ4" },			\
154 		{ COMPRESS_ZSTD,	"ZSTD" },			\
155 		{ COMPRESS_LZORLE,	"LZO-RLE" })
156 
157 struct f2fs_sb_info;
158 struct f2fs_io_info;
159 struct extent_info;
160 struct victim_sel_policy;
161 struct f2fs_map_blocks;
162 
163 DECLARE_EVENT_CLASS(f2fs__inode,
164 
165 	TP_PROTO(struct inode *inode),
166 
167 	TP_ARGS(inode),
168 
169 	TP_STRUCT__entry(
170 		__field(dev_t,	dev)
171 		__field(ino_t,	ino)
172 		__field(ino_t,	pino)
173 		__field(umode_t, mode)
174 		__field(loff_t,	size)
175 		__field(unsigned int, nlink)
176 		__field(blkcnt_t, blocks)
177 		__field(__u8,	advise)
178 	),
179 
180 	TP_fast_assign(
181 		__entry->dev	= inode->i_sb->s_dev;
182 		__entry->ino	= inode->i_ino;
183 		__entry->pino	= F2FS_I(inode)->i_pino;
184 		__entry->mode	= inode->i_mode;
185 		__entry->nlink	= inode->i_nlink;
186 		__entry->size	= inode->i_size;
187 		__entry->blocks	= inode->i_blocks;
188 		__entry->advise	= F2FS_I(inode)->i_advise;
189 	),
190 
191 	TP_printk("dev = (%d,%d), ino = %lu, pino = %lu, i_mode = 0x%hx, "
192 		"i_size = %lld, i_nlink = %u, i_blocks = %llu, i_advise = 0x%x",
193 		show_dev_ino(__entry),
194 		(unsigned long)__entry->pino,
195 		__entry->mode,
196 		__entry->size,
197 		(unsigned int)__entry->nlink,
198 		(unsigned long long)__entry->blocks,
199 		(unsigned char)__entry->advise)
200 );
201 
202 DECLARE_EVENT_CLASS(f2fs__inode_exit,
203 
204 	TP_PROTO(struct inode *inode, int ret),
205 
206 	TP_ARGS(inode, ret),
207 
208 	TP_STRUCT__entry(
209 		__field(dev_t,	dev)
210 		__field(ino_t,	ino)
211 		__field(int,	ret)
212 	),
213 
214 	TP_fast_assign(
215 		__entry->dev	= inode->i_sb->s_dev;
216 		__entry->ino	= inode->i_ino;
217 		__entry->ret	= ret;
218 	),
219 
220 	TP_printk("dev = (%d,%d), ino = %lu, ret = %d",
221 		show_dev_ino(__entry),
222 		__entry->ret)
223 );
224 
225 DEFINE_EVENT(f2fs__inode, f2fs_sync_file_enter,
226 
227 	TP_PROTO(struct inode *inode),
228 
229 	TP_ARGS(inode)
230 );
231 
232 TRACE_EVENT(f2fs_sync_file_exit,
233 
234 	TP_PROTO(struct inode *inode, int cp_reason, int datasync, int ret),
235 
236 	TP_ARGS(inode, cp_reason, datasync, ret),
237 
238 	TP_STRUCT__entry(
239 		__field(dev_t,	dev)
240 		__field(ino_t,	ino)
241 		__field(int,	cp_reason)
242 		__field(int,	datasync)
243 		__field(int,	ret)
244 	),
245 
246 	TP_fast_assign(
247 		__entry->dev		= inode->i_sb->s_dev;
248 		__entry->ino		= inode->i_ino;
249 		__entry->cp_reason	= cp_reason;
250 		__entry->datasync	= datasync;
251 		__entry->ret		= ret;
252 	),
253 
254 	TP_printk("dev = (%d,%d), ino = %lu, cp_reason: %s, "
255 		"datasync = %d, ret = %d",
256 		show_dev_ino(__entry),
257 		show_fsync_cpreason(__entry->cp_reason),
258 		__entry->datasync,
259 		__entry->ret)
260 );
261 
262 TRACE_EVENT(f2fs_sync_fs,
263 
264 	TP_PROTO(struct super_block *sb, int wait),
265 
266 	TP_ARGS(sb, wait),
267 
268 	TP_STRUCT__entry(
269 		__field(dev_t,	dev)
270 		__field(int,	dirty)
271 		__field(int,	wait)
272 	),
273 
274 	TP_fast_assign(
275 		__entry->dev	= sb->s_dev;
276 		__entry->dirty	= is_sbi_flag_set(F2FS_SB(sb), SBI_IS_DIRTY);
277 		__entry->wait	= wait;
278 	),
279 
280 	TP_printk("dev = (%d,%d), superblock is %s, wait = %d",
281 		show_dev(__entry->dev),
282 		__entry->dirty ? "dirty" : "not dirty",
283 		__entry->wait)
284 );
285 
286 DEFINE_EVENT(f2fs__inode, f2fs_iget,
287 
288 	TP_PROTO(struct inode *inode),
289 
290 	TP_ARGS(inode)
291 );
292 
293 DEFINE_EVENT(f2fs__inode_exit, f2fs_iget_exit,
294 
295 	TP_PROTO(struct inode *inode, int ret),
296 
297 	TP_ARGS(inode, ret)
298 );
299 
300 DEFINE_EVENT(f2fs__inode, f2fs_evict_inode,
301 
302 	TP_PROTO(struct inode *inode),
303 
304 	TP_ARGS(inode)
305 );
306 
307 DEFINE_EVENT(f2fs__inode_exit, f2fs_new_inode,
308 
309 	TP_PROTO(struct inode *inode, int ret),
310 
311 	TP_ARGS(inode, ret)
312 );
313 
314 TRACE_EVENT(f2fs_unlink_enter,
315 
316 	TP_PROTO(struct inode *dir, struct dentry *dentry),
317 
318 	TP_ARGS(dir, dentry),
319 
320 	TP_STRUCT__entry(
321 		__field(dev_t,	dev)
322 		__field(ino_t,	ino)
323 		__field(loff_t,	size)
324 		__field(blkcnt_t, blocks)
325 		__string(name,  dentry->d_name.name)
326 	),
327 
328 	TP_fast_assign(
329 		__entry->dev	= dir->i_sb->s_dev;
330 		__entry->ino	= dir->i_ino;
331 		__entry->size	= dir->i_size;
332 		__entry->blocks	= dir->i_blocks;
333 		__assign_str(name, dentry->d_name.name);
334 	),
335 
336 	TP_printk("dev = (%d,%d), dir ino = %lu, i_size = %lld, "
337 		"i_blocks = %llu, name = %s",
338 		show_dev_ino(__entry),
339 		__entry->size,
340 		(unsigned long long)__entry->blocks,
341 		__get_str(name))
342 );
343 
344 DEFINE_EVENT(f2fs__inode_exit, f2fs_unlink_exit,
345 
346 	TP_PROTO(struct inode *inode, int ret),
347 
348 	TP_ARGS(inode, ret)
349 );
350 
351 DEFINE_EVENT(f2fs__inode_exit, f2fs_drop_inode,
352 
353 	TP_PROTO(struct inode *inode, int ret),
354 
355 	TP_ARGS(inode, ret)
356 );
357 
358 DEFINE_EVENT(f2fs__inode, f2fs_truncate,
359 
360 	TP_PROTO(struct inode *inode),
361 
362 	TP_ARGS(inode)
363 );
364 
365 TRACE_EVENT(f2fs_truncate_data_blocks_range,
366 
367 	TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs, int free),
368 
369 	TP_ARGS(inode, nid,  ofs, free),
370 
371 	TP_STRUCT__entry(
372 		__field(dev_t,	dev)
373 		__field(ino_t,	ino)
374 		__field(nid_t,	nid)
375 		__field(unsigned int,	ofs)
376 		__field(int,	free)
377 	),
378 
379 	TP_fast_assign(
380 		__entry->dev	= inode->i_sb->s_dev;
381 		__entry->ino	= inode->i_ino;
382 		__entry->nid	= nid;
383 		__entry->ofs	= ofs;
384 		__entry->free	= free;
385 	),
386 
387 	TP_printk("dev = (%d,%d), ino = %lu, nid = %u, offset = %u, freed = %d",
388 		show_dev_ino(__entry),
389 		(unsigned int)__entry->nid,
390 		__entry->ofs,
391 		__entry->free)
392 );
393 
394 DECLARE_EVENT_CLASS(f2fs__truncate_op,
395 
396 	TP_PROTO(struct inode *inode, u64 from),
397 
398 	TP_ARGS(inode, from),
399 
400 	TP_STRUCT__entry(
401 		__field(dev_t,	dev)
402 		__field(ino_t,	ino)
403 		__field(loff_t,	size)
404 		__field(blkcnt_t, blocks)
405 		__field(u64,	from)
406 	),
407 
408 	TP_fast_assign(
409 		__entry->dev	= inode->i_sb->s_dev;
410 		__entry->ino	= inode->i_ino;
411 		__entry->size	= inode->i_size;
412 		__entry->blocks	= inode->i_blocks;
413 		__entry->from	= from;
414 	),
415 
416 	TP_printk("dev = (%d,%d), ino = %lu, i_size = %lld, i_blocks = %llu, "
417 		"start file offset = %llu",
418 		show_dev_ino(__entry),
419 		__entry->size,
420 		(unsigned long long)__entry->blocks,
421 		(unsigned long long)__entry->from)
422 );
423 
424 DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_blocks_enter,
425 
426 	TP_PROTO(struct inode *inode, u64 from),
427 
428 	TP_ARGS(inode, from)
429 );
430 
431 DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_blocks_exit,
432 
433 	TP_PROTO(struct inode *inode, int ret),
434 
435 	TP_ARGS(inode, ret)
436 );
437 
438 DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_inode_blocks_enter,
439 
440 	TP_PROTO(struct inode *inode, u64 from),
441 
442 	TP_ARGS(inode, from)
443 );
444 
445 DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_inode_blocks_exit,
446 
447 	TP_PROTO(struct inode *inode, int ret),
448 
449 	TP_ARGS(inode, ret)
450 );
451 
452 DECLARE_EVENT_CLASS(f2fs__truncate_node,
453 
454 	TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
455 
456 	TP_ARGS(inode, nid, blk_addr),
457 
458 	TP_STRUCT__entry(
459 		__field(dev_t,	dev)
460 		__field(ino_t,	ino)
461 		__field(nid_t,	nid)
462 		__field(block_t,	blk_addr)
463 	),
464 
465 	TP_fast_assign(
466 		__entry->dev		= inode->i_sb->s_dev;
467 		__entry->ino		= inode->i_ino;
468 		__entry->nid		= nid;
469 		__entry->blk_addr	= blk_addr;
470 	),
471 
472 	TP_printk("dev = (%d,%d), ino = %lu, nid = %u, block_address = 0x%llx",
473 		show_dev_ino(__entry),
474 		(unsigned int)__entry->nid,
475 		(unsigned long long)__entry->blk_addr)
476 );
477 
478 DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_nodes_enter,
479 
480 	TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
481 
482 	TP_ARGS(inode, nid, blk_addr)
483 );
484 
485 DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_nodes_exit,
486 
487 	TP_PROTO(struct inode *inode, int ret),
488 
489 	TP_ARGS(inode, ret)
490 );
491 
492 DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_node,
493 
494 	TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
495 
496 	TP_ARGS(inode, nid, blk_addr)
497 );
498 
499 TRACE_EVENT(f2fs_truncate_partial_nodes,
500 
501 	TP_PROTO(struct inode *inode, nid_t *nid, int depth, int err),
502 
503 	TP_ARGS(inode, nid, depth, err),
504 
505 	TP_STRUCT__entry(
506 		__field(dev_t,	dev)
507 		__field(ino_t,	ino)
508 		__field(nid_t,	nid[3])
509 		__field(int,	depth)
510 		__field(int,	err)
511 	),
512 
513 	TP_fast_assign(
514 		__entry->dev	= inode->i_sb->s_dev;
515 		__entry->ino	= inode->i_ino;
516 		__entry->nid[0]	= nid[0];
517 		__entry->nid[1]	= nid[1];
518 		__entry->nid[2]	= nid[2];
519 		__entry->depth	= depth;
520 		__entry->err	= err;
521 	),
522 
523 	TP_printk("dev = (%d,%d), ino = %lu, "
524 		"nid[0] = %u, nid[1] = %u, nid[2] = %u, depth = %d, err = %d",
525 		show_dev_ino(__entry),
526 		(unsigned int)__entry->nid[0],
527 		(unsigned int)__entry->nid[1],
528 		(unsigned int)__entry->nid[2],
529 		__entry->depth,
530 		__entry->err)
531 );
532 
533 TRACE_EVENT(f2fs_file_write_iter,
534 
535 	TP_PROTO(struct inode *inode, loff_t offset, size_t length,
536 		 ssize_t ret),
537 
538 	TP_ARGS(inode, offset, length, ret),
539 
540 	TP_STRUCT__entry(
541 		__field(dev_t,	dev)
542 		__field(ino_t,	ino)
543 		__field(loff_t, offset)
544 		__field(size_t, length)
545 		__field(ssize_t, ret)
546 	),
547 
548 	TP_fast_assign(
549 		__entry->dev	= inode->i_sb->s_dev;
550 		__entry->ino	= inode->i_ino;
551 		__entry->offset	= offset;
552 		__entry->length	= length;
553 		__entry->ret	= ret;
554 	),
555 
556 	TP_printk("dev = (%d,%d), ino = %lu, "
557 		"offset = %lld, length = %zu, written(err) = %zd",
558 		show_dev_ino(__entry),
559 		__entry->offset,
560 		__entry->length,
561 		__entry->ret)
562 );
563 
564 TRACE_EVENT(f2fs_map_blocks,
565 	TP_PROTO(struct inode *inode, struct f2fs_map_blocks *map,
566 				int create, int flag, int ret),
567 
568 	TP_ARGS(inode, map, create, flag, ret),
569 
570 	TP_STRUCT__entry(
571 		__field(dev_t,	dev)
572 		__field(ino_t,	ino)
573 		__field(block_t,	m_lblk)
574 		__field(block_t,	m_pblk)
575 		__field(unsigned int,	m_len)
576 		__field(unsigned int,	m_flags)
577 		__field(int,	m_seg_type)
578 		__field(bool,	m_may_create)
579 		__field(bool,	m_multidev_dio)
580 		__field(int,	create)
581 		__field(int,	flag)
582 		__field(int,	ret)
583 	),
584 
585 	TP_fast_assign(
586 		__entry->dev		= map->m_bdev->bd_dev;
587 		__entry->ino		= inode->i_ino;
588 		__entry->m_lblk		= map->m_lblk;
589 		__entry->m_pblk		= map->m_pblk;
590 		__entry->m_len		= map->m_len;
591 		__entry->m_flags	= map->m_flags;
592 		__entry->m_seg_type	= map->m_seg_type;
593 		__entry->m_may_create	= map->m_may_create;
594 		__entry->m_multidev_dio	= map->m_multidev_dio;
595 		__entry->create		= create;
596 		__entry->flag		= flag;
597 		__entry->ret		= ret;
598 	),
599 
600 	TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, "
601 		"start blkaddr = 0x%llx, len = 0x%llx, flags = %u, "
602 		"seg_type = %d, may_create = %d, multidevice = %d, "
603 		"create = %d, flag = %d, err = %d",
604 		show_dev_ino(__entry),
605 		(unsigned long long)__entry->m_lblk,
606 		(unsigned long long)__entry->m_pblk,
607 		(unsigned long long)__entry->m_len,
608 		__entry->m_flags,
609 		__entry->m_seg_type,
610 		__entry->m_may_create,
611 		__entry->m_multidev_dio,
612 		__entry->create,
613 		__entry->flag,
614 		__entry->ret)
615 );
616 
617 TRACE_EVENT(f2fs_background_gc,
618 
619 	TP_PROTO(struct super_block *sb, unsigned int wait_ms,
620 			unsigned int prefree, unsigned int free),
621 
622 	TP_ARGS(sb, wait_ms, prefree, free),
623 
624 	TP_STRUCT__entry(
625 		__field(dev_t,	dev)
626 		__field(unsigned int,	wait_ms)
627 		__field(unsigned int,	prefree)
628 		__field(unsigned int,	free)
629 	),
630 
631 	TP_fast_assign(
632 		__entry->dev		= sb->s_dev;
633 		__entry->wait_ms	= wait_ms;
634 		__entry->prefree	= prefree;
635 		__entry->free		= free;
636 	),
637 
638 	TP_printk("dev = (%d,%d), wait_ms = %u, prefree = %u, free = %u",
639 		show_dev(__entry->dev),
640 		__entry->wait_ms,
641 		__entry->prefree,
642 		__entry->free)
643 );
644 
645 TRACE_EVENT(f2fs_gc_begin,
646 
647 	TP_PROTO(struct super_block *sb, int gc_type, bool no_bg_gc,
648 			unsigned int nr_free_secs,
649 			long long dirty_nodes, long long dirty_dents,
650 			long long dirty_imeta, unsigned int free_sec,
651 			unsigned int free_seg, int reserved_seg,
652 			unsigned int prefree_seg),
653 
654 	TP_ARGS(sb, gc_type, no_bg_gc, nr_free_secs, dirty_nodes,
655 		dirty_dents, dirty_imeta,
656 		free_sec, free_seg, reserved_seg, prefree_seg),
657 
658 	TP_STRUCT__entry(
659 		__field(dev_t,		dev)
660 		__field(int,		gc_type)
661 		__field(bool,		no_bg_gc)
662 		__field(unsigned int,	nr_free_secs)
663 		__field(long long,	dirty_nodes)
664 		__field(long long,	dirty_dents)
665 		__field(long long,	dirty_imeta)
666 		__field(unsigned int,	free_sec)
667 		__field(unsigned int,	free_seg)
668 		__field(int,		reserved_seg)
669 		__field(unsigned int,	prefree_seg)
670 	),
671 
672 	TP_fast_assign(
673 		__entry->dev		= sb->s_dev;
674 		__entry->gc_type	= gc_type;
675 		__entry->no_bg_gc	= no_bg_gc;
676 		__entry->nr_free_secs	= nr_free_secs;
677 		__entry->dirty_nodes	= dirty_nodes;
678 		__entry->dirty_dents	= dirty_dents;
679 		__entry->dirty_imeta	= dirty_imeta;
680 		__entry->free_sec	= free_sec;
681 		__entry->free_seg	= free_seg;
682 		__entry->reserved_seg	= reserved_seg;
683 		__entry->prefree_seg	= prefree_seg;
684 	),
685 
686 	TP_printk("dev = (%d,%d), gc_type = %s, no_background_GC = %d, nr_free_secs = %u, "
687 		"nodes = %lld, dents = %lld, imeta = %lld, free_sec:%u, free_seg:%u, "
688 		"rsv_seg:%d, prefree_seg:%u",
689 		show_dev(__entry->dev),
690 		show_gc_type(__entry->gc_type),
691 		(__entry->gc_type == BG_GC) ? __entry->no_bg_gc : -1,
692 		__entry->nr_free_secs,
693 		__entry->dirty_nodes,
694 		__entry->dirty_dents,
695 		__entry->dirty_imeta,
696 		__entry->free_sec,
697 		__entry->free_seg,
698 		__entry->reserved_seg,
699 		__entry->prefree_seg)
700 );
701 
702 TRACE_EVENT(f2fs_gc_end,
703 
704 	TP_PROTO(struct super_block *sb, int ret, int seg_freed,
705 			int sec_freed, long long dirty_nodes,
706 			long long dirty_dents, long long dirty_imeta,
707 			unsigned int free_sec, unsigned int free_seg,
708 			int reserved_seg, unsigned int prefree_seg),
709 
710 	TP_ARGS(sb, ret, seg_freed, sec_freed, dirty_nodes, dirty_dents,
711 		dirty_imeta, free_sec, free_seg, reserved_seg, prefree_seg),
712 
713 	TP_STRUCT__entry(
714 		__field(dev_t,		dev)
715 		__field(int,		ret)
716 		__field(int,		seg_freed)
717 		__field(int,		sec_freed)
718 		__field(long long,	dirty_nodes)
719 		__field(long long,	dirty_dents)
720 		__field(long long,	dirty_imeta)
721 		__field(unsigned int,	free_sec)
722 		__field(unsigned int,	free_seg)
723 		__field(int,		reserved_seg)
724 		__field(unsigned int,	prefree_seg)
725 	),
726 
727 	TP_fast_assign(
728 		__entry->dev		= sb->s_dev;
729 		__entry->ret		= ret;
730 		__entry->seg_freed	= seg_freed;
731 		__entry->sec_freed	= sec_freed;
732 		__entry->dirty_nodes	= dirty_nodes;
733 		__entry->dirty_dents	= dirty_dents;
734 		__entry->dirty_imeta	= dirty_imeta;
735 		__entry->free_sec	= free_sec;
736 		__entry->free_seg	= free_seg;
737 		__entry->reserved_seg	= reserved_seg;
738 		__entry->prefree_seg	= prefree_seg;
739 	),
740 
741 	TP_printk("dev = (%d,%d), ret = %d, seg_freed = %d, sec_freed = %d, "
742 		"nodes = %lld, dents = %lld, imeta = %lld, free_sec:%u, "
743 		"free_seg:%u, rsv_seg:%d, prefree_seg:%u",
744 		show_dev(__entry->dev),
745 		__entry->ret,
746 		__entry->seg_freed,
747 		__entry->sec_freed,
748 		__entry->dirty_nodes,
749 		__entry->dirty_dents,
750 		__entry->dirty_imeta,
751 		__entry->free_sec,
752 		__entry->free_seg,
753 		__entry->reserved_seg,
754 		__entry->prefree_seg)
755 );
756 
757 TRACE_EVENT(f2fs_get_victim,
758 
759 	TP_PROTO(struct super_block *sb, int type, int gc_type,
760 			struct victim_sel_policy *p, unsigned int pre_victim,
761 			unsigned int prefree, unsigned int free),
762 
763 	TP_ARGS(sb, type, gc_type, p, pre_victim, prefree, free),
764 
765 	TP_STRUCT__entry(
766 		__field(dev_t,	dev)
767 		__field(int,	type)
768 		__field(int,	gc_type)
769 		__field(int,	alloc_mode)
770 		__field(int,	gc_mode)
771 		__field(unsigned int,	victim)
772 		__field(unsigned int,	cost)
773 		__field(unsigned int,	ofs_unit)
774 		__field(unsigned int,	pre_victim)
775 		__field(unsigned int,	prefree)
776 		__field(unsigned int,	free)
777 	),
778 
779 	TP_fast_assign(
780 		__entry->dev		= sb->s_dev;
781 		__entry->type		= type;
782 		__entry->gc_type	= gc_type;
783 		__entry->alloc_mode	= p->alloc_mode;
784 		__entry->gc_mode	= p->gc_mode;
785 		__entry->victim		= p->min_segno;
786 		__entry->cost		= p->min_cost;
787 		__entry->ofs_unit	= p->ofs_unit;
788 		__entry->pre_victim	= pre_victim;
789 		__entry->prefree	= prefree;
790 		__entry->free		= free;
791 	),
792 
793 	TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), "
794 		"victim = %u, cost = %u, ofs_unit = %u, "
795 		"pre_victim_secno = %d, prefree = %u, free = %u",
796 		show_dev(__entry->dev),
797 		show_data_type(__entry->type),
798 		show_gc_type(__entry->gc_type),
799 		show_alloc_mode(__entry->alloc_mode),
800 		show_victim_policy(__entry->gc_mode),
801 		__entry->victim,
802 		__entry->cost,
803 		__entry->ofs_unit,
804 		(int)__entry->pre_victim,
805 		__entry->prefree,
806 		__entry->free)
807 );
808 
809 TRACE_EVENT(f2fs_lookup_start,
810 
811 	TP_PROTO(struct inode *dir, struct dentry *dentry, unsigned int flags),
812 
813 	TP_ARGS(dir, dentry, flags),
814 
815 	TP_STRUCT__entry(
816 		__field(dev_t,	dev)
817 		__field(ino_t,	ino)
818 		__string(name,	dentry->d_name.name)
819 		__field(unsigned int, flags)
820 	),
821 
822 	TP_fast_assign(
823 		__entry->dev	= dir->i_sb->s_dev;
824 		__entry->ino	= dir->i_ino;
825 		__assign_str(name, dentry->d_name.name);
826 		__entry->flags	= flags;
827 	),
828 
829 	TP_printk("dev = (%d,%d), pino = %lu, name:%s, flags:%u",
830 		show_dev_ino(__entry),
831 		__get_str(name),
832 		__entry->flags)
833 );
834 
835 TRACE_EVENT(f2fs_lookup_end,
836 
837 	TP_PROTO(struct inode *dir, struct dentry *dentry, nid_t ino,
838 		int err),
839 
840 	TP_ARGS(dir, dentry, ino, err),
841 
842 	TP_STRUCT__entry(
843 		__field(dev_t,	dev)
844 		__field(ino_t,	ino)
845 		__string(name,	dentry->d_name.name)
846 		__field(nid_t,	cino)
847 		__field(int,	err)
848 	),
849 
850 	TP_fast_assign(
851 		__entry->dev	= dir->i_sb->s_dev;
852 		__entry->ino	= dir->i_ino;
853 		__assign_str(name, dentry->d_name.name);
854 		__entry->cino	= ino;
855 		__entry->err	= err;
856 	),
857 
858 	TP_printk("dev = (%d,%d), pino = %lu, name:%s, ino:%u, err:%d",
859 		show_dev_ino(__entry),
860 		__get_str(name),
861 		__entry->cino,
862 		__entry->err)
863 );
864 
865 TRACE_EVENT(f2fs_readdir,
866 
867 	TP_PROTO(struct inode *dir, loff_t start_pos, loff_t end_pos, int err),
868 
869 	TP_ARGS(dir, start_pos, end_pos, err),
870 
871 	TP_STRUCT__entry(
872 		__field(dev_t,	dev)
873 		__field(ino_t,	ino)
874 		__field(loff_t,	start)
875 		__field(loff_t,	end)
876 		__field(int,	err)
877 	),
878 
879 	TP_fast_assign(
880 		__entry->dev	= dir->i_sb->s_dev;
881 		__entry->ino	= dir->i_ino;
882 		__entry->start	= start_pos;
883 		__entry->end	= end_pos;
884 		__entry->err	= err;
885 	),
886 
887 	TP_printk("dev = (%d,%d), ino = %lu, start_pos:%llu, end_pos:%llu, err:%d",
888 		show_dev_ino(__entry),
889 		__entry->start,
890 		__entry->end,
891 		__entry->err)
892 );
893 
894 TRACE_EVENT(f2fs_fallocate,
895 
896 	TP_PROTO(struct inode *inode, int mode,
897 				loff_t offset, loff_t len, int ret),
898 
899 	TP_ARGS(inode, mode, offset, len, ret),
900 
901 	TP_STRUCT__entry(
902 		__field(dev_t,	dev)
903 		__field(ino_t,	ino)
904 		__field(int,	mode)
905 		__field(loff_t,	offset)
906 		__field(loff_t,	len)
907 		__field(loff_t, size)
908 		__field(blkcnt_t, blocks)
909 		__field(int,	ret)
910 	),
911 
912 	TP_fast_assign(
913 		__entry->dev	= inode->i_sb->s_dev;
914 		__entry->ino	= inode->i_ino;
915 		__entry->mode	= mode;
916 		__entry->offset	= offset;
917 		__entry->len	= len;
918 		__entry->size	= inode->i_size;
919 		__entry->blocks = inode->i_blocks;
920 		__entry->ret	= ret;
921 	),
922 
923 	TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, "
924 		"len = %lld,  i_size = %lld, i_blocks = %llu, ret = %d",
925 		show_dev_ino(__entry),
926 		__entry->mode,
927 		(unsigned long long)__entry->offset,
928 		(unsigned long long)__entry->len,
929 		(unsigned long long)__entry->size,
930 		(unsigned long long)__entry->blocks,
931 		__entry->ret)
932 );
933 
934 TRACE_EVENT(f2fs_direct_IO_enter,
935 
936 	TP_PROTO(struct inode *inode, struct kiocb *iocb, long len, int rw),
937 
938 	TP_ARGS(inode, iocb, len, rw),
939 
940 	TP_STRUCT__entry(
941 		__field(dev_t,	dev)
942 		__field(ino_t,	ino)
943 		__field(loff_t,	ki_pos)
944 		__field(int,	ki_flags)
945 		__field(u16,	ki_ioprio)
946 		__field(unsigned long,	len)
947 		__field(int,	rw)
948 	),
949 
950 	TP_fast_assign(
951 		__entry->dev		= inode->i_sb->s_dev;
952 		__entry->ino		= inode->i_ino;
953 		__entry->ki_pos		= iocb->ki_pos;
954 		__entry->ki_flags	= iocb->ki_flags;
955 		__entry->ki_ioprio	= iocb->ki_ioprio;
956 		__entry->len		= len;
957 		__entry->rw		= rw;
958 	),
959 
960 	TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu ki_flags = %x ki_ioprio = %x rw = %d",
961 		show_dev_ino(__entry),
962 		__entry->ki_pos,
963 		__entry->len,
964 		__entry->ki_flags,
965 		__entry->ki_ioprio,
966 		__entry->rw)
967 );
968 
969 TRACE_EVENT(f2fs_direct_IO_exit,
970 
971 	TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
972 		 int rw, int ret),
973 
974 	TP_ARGS(inode, offset, len, rw, ret),
975 
976 	TP_STRUCT__entry(
977 		__field(dev_t,	dev)
978 		__field(ino_t,	ino)
979 		__field(loff_t,	pos)
980 		__field(unsigned long,	len)
981 		__field(int,	rw)
982 		__field(int,	ret)
983 	),
984 
985 	TP_fast_assign(
986 		__entry->dev	= inode->i_sb->s_dev;
987 		__entry->ino	= inode->i_ino;
988 		__entry->pos	= offset;
989 		__entry->len	= len;
990 		__entry->rw	= rw;
991 		__entry->ret	= ret;
992 	),
993 
994 	TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu "
995 		"rw = %d ret = %d",
996 		show_dev_ino(__entry),
997 		__entry->pos,
998 		__entry->len,
999 		__entry->rw,
1000 		__entry->ret)
1001 );
1002 
1003 TRACE_EVENT(f2fs_reserve_new_blocks,
1004 
1005 	TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs_in_node,
1006 							blkcnt_t count),
1007 
1008 	TP_ARGS(inode, nid, ofs_in_node, count),
1009 
1010 	TP_STRUCT__entry(
1011 		__field(dev_t,	dev)
1012 		__field(nid_t, nid)
1013 		__field(unsigned int, ofs_in_node)
1014 		__field(blkcnt_t, count)
1015 	),
1016 
1017 	TP_fast_assign(
1018 		__entry->dev	= inode->i_sb->s_dev;
1019 		__entry->nid	= nid;
1020 		__entry->ofs_in_node = ofs_in_node;
1021 		__entry->count = count;
1022 	),
1023 
1024 	TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u, count = %llu",
1025 		show_dev(__entry->dev),
1026 		(unsigned int)__entry->nid,
1027 		__entry->ofs_in_node,
1028 		(unsigned long long)__entry->count)
1029 );
1030 
1031 DECLARE_EVENT_CLASS(f2fs__submit_page_bio,
1032 
1033 	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
1034 
1035 	TP_ARGS(page, fio),
1036 
1037 	TP_STRUCT__entry(
1038 		__field(dev_t, dev)
1039 		__field(ino_t, ino)
1040 		__field(pgoff_t, index)
1041 		__field(block_t, old_blkaddr)
1042 		__field(block_t, new_blkaddr)
1043 		__field(enum req_op, op)
1044 		__field(blk_opf_t, op_flags)
1045 		__field(int, temp)
1046 		__field(int, type)
1047 	),
1048 
1049 	TP_fast_assign(
1050 		__entry->dev		= page_file_mapping(page)->host->i_sb->s_dev;
1051 		__entry->ino		= page_file_mapping(page)->host->i_ino;
1052 		__entry->index		= page->index;
1053 		__entry->old_blkaddr	= fio->old_blkaddr;
1054 		__entry->new_blkaddr	= fio->new_blkaddr;
1055 		__entry->op		= fio->op;
1056 		__entry->op_flags	= fio->op_flags;
1057 		__entry->temp		= fio->temp;
1058 		__entry->type		= fio->type;
1059 	),
1060 
1061 	TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, "
1062 		"oldaddr = 0x%llx, newaddr = 0x%llx, rw = %s(%s), type = %s_%s",
1063 		show_dev_ino(__entry),
1064 		(unsigned long)__entry->index,
1065 		(unsigned long long)__entry->old_blkaddr,
1066 		(unsigned long long)__entry->new_blkaddr,
1067 		show_bio_type(__entry->op, __entry->op_flags),
1068 		show_block_temp(__entry->temp),
1069 		show_block_type(__entry->type))
1070 );
1071 
1072 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_bio,
1073 
1074 	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
1075 
1076 	TP_ARGS(page, fio),
1077 
1078 	TP_CONDITION(page->mapping)
1079 );
1080 
1081 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_write,
1082 
1083 	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
1084 
1085 	TP_ARGS(page, fio),
1086 
1087 	TP_CONDITION(page->mapping)
1088 );
1089 
1090 DECLARE_EVENT_CLASS(f2fs__bio,
1091 
1092 	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1093 
1094 	TP_ARGS(sb, type, bio),
1095 
1096 	TP_STRUCT__entry(
1097 		__field(dev_t,	dev)
1098 		__field(dev_t,	target)
1099 		__field(enum req_op,	op)
1100 		__field(blk_opf_t,	op_flags)
1101 		__field(int,	type)
1102 		__field(sector_t,	sector)
1103 		__field(unsigned int,	size)
1104 	),
1105 
1106 	TP_fast_assign(
1107 		__entry->dev		= sb->s_dev;
1108 		__entry->target		= bio_dev(bio);
1109 		__entry->op		= bio_op(bio);
1110 		__entry->op_flags	= bio->bi_opf;
1111 		__entry->type		= type;
1112 		__entry->sector		= bio->bi_iter.bi_sector;
1113 		__entry->size		= bio->bi_iter.bi_size;
1114 	),
1115 
1116 	TP_printk("dev = (%d,%d)/(%d,%d), rw = %s(%s), %s, sector = %lld, size = %u",
1117 		show_dev(__entry->target),
1118 		show_dev(__entry->dev),
1119 		show_bio_type(__entry->op, __entry->op_flags),
1120 		show_block_type(__entry->type),
1121 		(unsigned long long)__entry->sector,
1122 		__entry->size)
1123 );
1124 
1125 DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_prepare_write_bio,
1126 
1127 	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1128 
1129 	TP_ARGS(sb, type, bio),
1130 
1131 	TP_CONDITION(bio)
1132 );
1133 
1134 DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_prepare_read_bio,
1135 
1136 	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1137 
1138 	TP_ARGS(sb, type, bio),
1139 
1140 	TP_CONDITION(bio)
1141 );
1142 
1143 DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_read_bio,
1144 
1145 	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1146 
1147 	TP_ARGS(sb, type, bio),
1148 
1149 	TP_CONDITION(bio)
1150 );
1151 
1152 DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_write_bio,
1153 
1154 	TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1155 
1156 	TP_ARGS(sb, type, bio),
1157 
1158 	TP_CONDITION(bio)
1159 );
1160 
1161 TRACE_EVENT(f2fs_write_begin,
1162 
1163 	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len),
1164 
1165 	TP_ARGS(inode, pos, len),
1166 
1167 	TP_STRUCT__entry(
1168 		__field(dev_t,	dev)
1169 		__field(ino_t,	ino)
1170 		__field(loff_t,	pos)
1171 		__field(unsigned int, len)
1172 	),
1173 
1174 	TP_fast_assign(
1175 		__entry->dev	= inode->i_sb->s_dev;
1176 		__entry->ino	= inode->i_ino;
1177 		__entry->pos	= pos;
1178 		__entry->len	= len;
1179 	),
1180 
1181 	TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u",
1182 		show_dev_ino(__entry),
1183 		(unsigned long long)__entry->pos,
1184 		__entry->len)
1185 );
1186 
1187 TRACE_EVENT(f2fs_write_end,
1188 
1189 	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
1190 				unsigned int copied),
1191 
1192 	TP_ARGS(inode, pos, len, copied),
1193 
1194 	TP_STRUCT__entry(
1195 		__field(dev_t,	dev)
1196 		__field(ino_t,	ino)
1197 		__field(loff_t,	pos)
1198 		__field(unsigned int, len)
1199 		__field(unsigned int, copied)
1200 	),
1201 
1202 	TP_fast_assign(
1203 		__entry->dev	= inode->i_sb->s_dev;
1204 		__entry->ino	= inode->i_ino;
1205 		__entry->pos	= pos;
1206 		__entry->len	= len;
1207 		__entry->copied	= copied;
1208 	),
1209 
1210 	TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u",
1211 		show_dev_ino(__entry),
1212 		(unsigned long long)__entry->pos,
1213 		__entry->len,
1214 		__entry->copied)
1215 );
1216 
1217 DECLARE_EVENT_CLASS(f2fs__page,
1218 
1219 	TP_PROTO(struct page *page, int type),
1220 
1221 	TP_ARGS(page, type),
1222 
1223 	TP_STRUCT__entry(
1224 		__field(dev_t,	dev)
1225 		__field(ino_t,	ino)
1226 		__field(int, type)
1227 		__field(int, dir)
1228 		__field(pgoff_t, index)
1229 		__field(int, dirty)
1230 		__field(int, uptodate)
1231 	),
1232 
1233 	TP_fast_assign(
1234 		__entry->dev	= page_file_mapping(page)->host->i_sb->s_dev;
1235 		__entry->ino	= page_file_mapping(page)->host->i_ino;
1236 		__entry->type	= type;
1237 		__entry->dir	=
1238 			S_ISDIR(page_file_mapping(page)->host->i_mode);
1239 		__entry->index	= page->index;
1240 		__entry->dirty	= PageDirty(page);
1241 		__entry->uptodate = PageUptodate(page);
1242 	),
1243 
1244 	TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, "
1245 		"dirty = %d, uptodate = %d",
1246 		show_dev_ino(__entry),
1247 		show_block_type(__entry->type),
1248 		show_file_type(__entry->dir),
1249 		(unsigned long)__entry->index,
1250 		__entry->dirty,
1251 		__entry->uptodate)
1252 );
1253 
1254 DEFINE_EVENT(f2fs__page, f2fs_writepage,
1255 
1256 	TP_PROTO(struct page *page, int type),
1257 
1258 	TP_ARGS(page, type)
1259 );
1260 
1261 DEFINE_EVENT(f2fs__page, f2fs_do_write_data_page,
1262 
1263 	TP_PROTO(struct page *page, int type),
1264 
1265 	TP_ARGS(page, type)
1266 );
1267 
1268 DEFINE_EVENT(f2fs__page, f2fs_readpage,
1269 
1270 	TP_PROTO(struct page *page, int type),
1271 
1272 	TP_ARGS(page, type)
1273 );
1274 
1275 DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty,
1276 
1277 	TP_PROTO(struct page *page, int type),
1278 
1279 	TP_ARGS(page, type)
1280 );
1281 
1282 DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite,
1283 
1284 	TP_PROTO(struct page *page, int type),
1285 
1286 	TP_ARGS(page, type)
1287 );
1288 
1289 TRACE_EVENT(f2fs_filemap_fault,
1290 
1291 	TP_PROTO(struct inode *inode, pgoff_t index, unsigned long ret),
1292 
1293 	TP_ARGS(inode, index, ret),
1294 
1295 	TP_STRUCT__entry(
1296 		__field(dev_t,	dev)
1297 		__field(ino_t,	ino)
1298 		__field(pgoff_t, index)
1299 		__field(unsigned long, ret)
1300 	),
1301 
1302 	TP_fast_assign(
1303 		__entry->dev	= inode->i_sb->s_dev;
1304 		__entry->ino	= inode->i_ino;
1305 		__entry->index	= index;
1306 		__entry->ret	= ret;
1307 	),
1308 
1309 	TP_printk("dev = (%d,%d), ino = %lu, index = %lu, ret = %lx",
1310 		show_dev_ino(__entry),
1311 		(unsigned long)__entry->index,
1312 		__entry->ret)
1313 );
1314 
1315 TRACE_EVENT(f2fs_writepages,
1316 
1317 	TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type),
1318 
1319 	TP_ARGS(inode, wbc, type),
1320 
1321 	TP_STRUCT__entry(
1322 		__field(dev_t,	dev)
1323 		__field(ino_t,	ino)
1324 		__field(int,	type)
1325 		__field(int,	dir)
1326 		__field(long,	nr_to_write)
1327 		__field(long,	pages_skipped)
1328 		__field(loff_t,	range_start)
1329 		__field(loff_t,	range_end)
1330 		__field(pgoff_t, writeback_index)
1331 		__field(int,	sync_mode)
1332 		__field(char,	for_kupdate)
1333 		__field(char,	for_background)
1334 		__field(char,	tagged_writepages)
1335 		__field(char,	for_reclaim)
1336 		__field(char,	range_cyclic)
1337 		__field(char,	for_sync)
1338 	),
1339 
1340 	TP_fast_assign(
1341 		__entry->dev		= inode->i_sb->s_dev;
1342 		__entry->ino		= inode->i_ino;
1343 		__entry->type		= type;
1344 		__entry->dir		= S_ISDIR(inode->i_mode);
1345 		__entry->nr_to_write	= wbc->nr_to_write;
1346 		__entry->pages_skipped	= wbc->pages_skipped;
1347 		__entry->range_start	= wbc->range_start;
1348 		__entry->range_end	= wbc->range_end;
1349 		__entry->writeback_index = inode->i_mapping->writeback_index;
1350 		__entry->sync_mode	= wbc->sync_mode;
1351 		__entry->for_kupdate	= wbc->for_kupdate;
1352 		__entry->for_background	= wbc->for_background;
1353 		__entry->tagged_writepages	= wbc->tagged_writepages;
1354 		__entry->for_reclaim	= wbc->for_reclaim;
1355 		__entry->range_cyclic	= wbc->range_cyclic;
1356 		__entry->for_sync	= wbc->for_sync;
1357 	),
1358 
1359 	TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
1360 		"skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
1361 		"kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
1362 		show_dev_ino(__entry),
1363 		show_block_type(__entry->type),
1364 		show_file_type(__entry->dir),
1365 		__entry->nr_to_write,
1366 		__entry->pages_skipped,
1367 		__entry->range_start,
1368 		__entry->range_end,
1369 		(unsigned long)__entry->writeback_index,
1370 		__entry->sync_mode,
1371 		__entry->for_kupdate,
1372 		__entry->for_background,
1373 		__entry->tagged_writepages,
1374 		__entry->for_reclaim,
1375 		__entry->range_cyclic,
1376 		__entry->for_sync)
1377 );
1378 
1379 TRACE_EVENT(f2fs_readpages,
1380 
1381 	TP_PROTO(struct inode *inode, pgoff_t start, unsigned int nrpage),
1382 
1383 	TP_ARGS(inode, start, nrpage),
1384 
1385 	TP_STRUCT__entry(
1386 		__field(dev_t,	dev)
1387 		__field(ino_t,	ino)
1388 		__field(pgoff_t,	start)
1389 		__field(unsigned int,	nrpage)
1390 	),
1391 
1392 	TP_fast_assign(
1393 		__entry->dev	= inode->i_sb->s_dev;
1394 		__entry->ino	= inode->i_ino;
1395 		__entry->start	= start;
1396 		__entry->nrpage	= nrpage;
1397 	),
1398 
1399 	TP_printk("dev = (%d,%d), ino = %lu, start = %lu nrpage = %u",
1400 		show_dev_ino(__entry),
1401 		(unsigned long)__entry->start,
1402 		__entry->nrpage)
1403 );
1404 
1405 TRACE_EVENT(f2fs_write_checkpoint,
1406 
1407 	TP_PROTO(struct super_block *sb, int reason, char *msg),
1408 
1409 	TP_ARGS(sb, reason, msg),
1410 
1411 	TP_STRUCT__entry(
1412 		__field(dev_t,	dev)
1413 		__field(int,	reason)
1414 		__string(dest_msg, msg)
1415 	),
1416 
1417 	TP_fast_assign(
1418 		__entry->dev		= sb->s_dev;
1419 		__entry->reason		= reason;
1420 		__assign_str(dest_msg, msg);
1421 	),
1422 
1423 	TP_printk("dev = (%d,%d), checkpoint for %s, state = %s",
1424 		show_dev(__entry->dev),
1425 		show_cpreason(__entry->reason),
1426 		__get_str(dest_msg))
1427 );
1428 
1429 DECLARE_EVENT_CLASS(f2fs_discard,
1430 
1431 	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1432 
1433 	TP_ARGS(dev, blkstart, blklen),
1434 
1435 	TP_STRUCT__entry(
1436 		__field(dev_t,	dev)
1437 		__field(block_t, blkstart)
1438 		__field(block_t, blklen)
1439 	),
1440 
1441 	TP_fast_assign(
1442 		__entry->dev	= dev->bd_dev;
1443 		__entry->blkstart = blkstart;
1444 		__entry->blklen = blklen;
1445 	),
1446 
1447 	TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx",
1448 		show_dev(__entry->dev),
1449 		(unsigned long long)__entry->blkstart,
1450 		(unsigned long long)__entry->blklen)
1451 );
1452 
1453 DEFINE_EVENT(f2fs_discard, f2fs_queue_discard,
1454 
1455 	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1456 
1457 	TP_ARGS(dev, blkstart, blklen)
1458 );
1459 
1460 DEFINE_EVENT(f2fs_discard, f2fs_issue_discard,
1461 
1462 	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1463 
1464 	TP_ARGS(dev, blkstart, blklen)
1465 );
1466 
1467 DEFINE_EVENT(f2fs_discard, f2fs_remove_discard,
1468 
1469 	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1470 
1471 	TP_ARGS(dev, blkstart, blklen)
1472 );
1473 
1474 TRACE_EVENT(f2fs_issue_reset_zone,
1475 
1476 	TP_PROTO(struct block_device *dev, block_t blkstart),
1477 
1478 	TP_ARGS(dev, blkstart),
1479 
1480 	TP_STRUCT__entry(
1481 		__field(dev_t,	dev)
1482 		__field(block_t, blkstart)
1483 	),
1484 
1485 	TP_fast_assign(
1486 		__entry->dev	= dev->bd_dev;
1487 		__entry->blkstart = blkstart;
1488 	),
1489 
1490 	TP_printk("dev = (%d,%d), reset zone at block = 0x%llx",
1491 		show_dev(__entry->dev),
1492 		(unsigned long long)__entry->blkstart)
1493 );
1494 
1495 TRACE_EVENT(f2fs_issue_flush,
1496 
1497 	TP_PROTO(struct block_device *dev, unsigned int nobarrier,
1498 				unsigned int flush_merge, int ret),
1499 
1500 	TP_ARGS(dev, nobarrier, flush_merge, ret),
1501 
1502 	TP_STRUCT__entry(
1503 		__field(dev_t,	dev)
1504 		__field(unsigned int, nobarrier)
1505 		__field(unsigned int, flush_merge)
1506 		__field(int,  ret)
1507 	),
1508 
1509 	TP_fast_assign(
1510 		__entry->dev	= dev->bd_dev;
1511 		__entry->nobarrier = nobarrier;
1512 		__entry->flush_merge = flush_merge;
1513 		__entry->ret = ret;
1514 	),
1515 
1516 	TP_printk("dev = (%d,%d), %s %s, ret = %d",
1517 		show_dev(__entry->dev),
1518 		__entry->nobarrier ? "skip (nobarrier)" : "issue",
1519 		__entry->flush_merge ? " with flush_merge" : "",
1520 		__entry->ret)
1521 );
1522 
1523 TRACE_EVENT(f2fs_lookup_extent_tree_start,
1524 
1525 	TP_PROTO(struct inode *inode, unsigned int pgofs),
1526 
1527 	TP_ARGS(inode, pgofs),
1528 
1529 	TP_STRUCT__entry(
1530 		__field(dev_t,	dev)
1531 		__field(ino_t,	ino)
1532 		__field(unsigned int, pgofs)
1533 	),
1534 
1535 	TP_fast_assign(
1536 		__entry->dev = inode->i_sb->s_dev;
1537 		__entry->ino = inode->i_ino;
1538 		__entry->pgofs = pgofs;
1539 	),
1540 
1541 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u",
1542 		show_dev_ino(__entry),
1543 		__entry->pgofs)
1544 );
1545 
1546 TRACE_EVENT_CONDITION(f2fs_lookup_extent_tree_end,
1547 
1548 	TP_PROTO(struct inode *inode, unsigned int pgofs,
1549 						struct extent_info *ei),
1550 
1551 	TP_ARGS(inode, pgofs, ei),
1552 
1553 	TP_CONDITION(ei),
1554 
1555 	TP_STRUCT__entry(
1556 		__field(dev_t,	dev)
1557 		__field(ino_t,	ino)
1558 		__field(unsigned int, pgofs)
1559 		__field(unsigned int, fofs)
1560 		__field(u32, blk)
1561 		__field(unsigned int, len)
1562 	),
1563 
1564 	TP_fast_assign(
1565 		__entry->dev = inode->i_sb->s_dev;
1566 		__entry->ino = inode->i_ino;
1567 		__entry->pgofs = pgofs;
1568 		__entry->fofs = ei->fofs;
1569 		__entry->blk = ei->blk;
1570 		__entry->len = ei->len;
1571 	),
1572 
1573 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1574 		"ext_info(fofs: %u, blk: %u, len: %u)",
1575 		show_dev_ino(__entry),
1576 		__entry->pgofs,
1577 		__entry->fofs,
1578 		__entry->blk,
1579 		__entry->len)
1580 );
1581 
1582 TRACE_EVENT(f2fs_update_extent_tree_range,
1583 
1584 	TP_PROTO(struct inode *inode, unsigned int pgofs, block_t blkaddr,
1585 						unsigned int len,
1586 						unsigned int c_len),
1587 
1588 	TP_ARGS(inode, pgofs, blkaddr, len, c_len),
1589 
1590 	TP_STRUCT__entry(
1591 		__field(dev_t,	dev)
1592 		__field(ino_t,	ino)
1593 		__field(unsigned int, pgofs)
1594 		__field(u32, blk)
1595 		__field(unsigned int, len)
1596 		__field(unsigned int, c_len)
1597 	),
1598 
1599 	TP_fast_assign(
1600 		__entry->dev = inode->i_sb->s_dev;
1601 		__entry->ino = inode->i_ino;
1602 		__entry->pgofs = pgofs;
1603 		__entry->blk = blkaddr;
1604 		__entry->len = len;
1605 		__entry->c_len = c_len;
1606 	),
1607 
1608 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1609 					"blkaddr = %u, len = %u, "
1610 					"c_len = %u",
1611 		show_dev_ino(__entry),
1612 		__entry->pgofs,
1613 		__entry->blk,
1614 		__entry->len,
1615 		__entry->c_len)
1616 );
1617 
1618 TRACE_EVENT(f2fs_shrink_extent_tree,
1619 
1620 	TP_PROTO(struct f2fs_sb_info *sbi, unsigned int node_cnt,
1621 						unsigned int tree_cnt),
1622 
1623 	TP_ARGS(sbi, node_cnt, tree_cnt),
1624 
1625 	TP_STRUCT__entry(
1626 		__field(dev_t,	dev)
1627 		__field(unsigned int, node_cnt)
1628 		__field(unsigned int, tree_cnt)
1629 	),
1630 
1631 	TP_fast_assign(
1632 		__entry->dev = sbi->sb->s_dev;
1633 		__entry->node_cnt = node_cnt;
1634 		__entry->tree_cnt = tree_cnt;
1635 	),
1636 
1637 	TP_printk("dev = (%d,%d), shrunk: node_cnt = %u, tree_cnt = %u",
1638 		show_dev(__entry->dev),
1639 		__entry->node_cnt,
1640 		__entry->tree_cnt)
1641 );
1642 
1643 TRACE_EVENT(f2fs_destroy_extent_tree,
1644 
1645 	TP_PROTO(struct inode *inode, unsigned int node_cnt),
1646 
1647 	TP_ARGS(inode, node_cnt),
1648 
1649 	TP_STRUCT__entry(
1650 		__field(dev_t,	dev)
1651 		__field(ino_t,	ino)
1652 		__field(unsigned int, node_cnt)
1653 	),
1654 
1655 	TP_fast_assign(
1656 		__entry->dev = inode->i_sb->s_dev;
1657 		__entry->ino = inode->i_ino;
1658 		__entry->node_cnt = node_cnt;
1659 	),
1660 
1661 	TP_printk("dev = (%d,%d), ino = %lu, destroyed: node_cnt = %u",
1662 		show_dev_ino(__entry),
1663 		__entry->node_cnt)
1664 );
1665 
1666 DECLARE_EVENT_CLASS(f2fs_sync_dirty_inodes,
1667 
1668 	TP_PROTO(struct super_block *sb, int type, s64 count),
1669 
1670 	TP_ARGS(sb, type, count),
1671 
1672 	TP_STRUCT__entry(
1673 		__field(dev_t, dev)
1674 		__field(int, type)
1675 		__field(s64, count)
1676 	),
1677 
1678 	TP_fast_assign(
1679 		__entry->dev	= sb->s_dev;
1680 		__entry->type	= type;
1681 		__entry->count	= count;
1682 	),
1683 
1684 	TP_printk("dev = (%d,%d), %s, dirty count = %lld",
1685 		show_dev(__entry->dev),
1686 		show_file_type(__entry->type),
1687 		__entry->count)
1688 );
1689 
1690 DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_enter,
1691 
1692 	TP_PROTO(struct super_block *sb, int type, s64 count),
1693 
1694 	TP_ARGS(sb, type, count)
1695 );
1696 
1697 DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_exit,
1698 
1699 	TP_PROTO(struct super_block *sb, int type, s64 count),
1700 
1701 	TP_ARGS(sb, type, count)
1702 );
1703 
1704 TRACE_EVENT(f2fs_shutdown,
1705 
1706 	TP_PROTO(struct f2fs_sb_info *sbi, unsigned int mode, int ret),
1707 
1708 	TP_ARGS(sbi, mode, ret),
1709 
1710 	TP_STRUCT__entry(
1711 		__field(dev_t,	dev)
1712 		__field(unsigned int, mode)
1713 		__field(int, ret)
1714 	),
1715 
1716 	TP_fast_assign(
1717 		__entry->dev = sbi->sb->s_dev;
1718 		__entry->mode = mode;
1719 		__entry->ret = ret;
1720 	),
1721 
1722 	TP_printk("dev = (%d,%d), mode: %s, ret:%d",
1723 		show_dev(__entry->dev),
1724 		show_shutdown_mode(__entry->mode),
1725 		__entry->ret)
1726 );
1727 
1728 DECLARE_EVENT_CLASS(f2fs_zip_start,
1729 
1730 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1731 			unsigned int cluster_size, unsigned char algtype),
1732 
1733 	TP_ARGS(inode, cluster_idx, cluster_size, algtype),
1734 
1735 	TP_STRUCT__entry(
1736 		__field(dev_t,	dev)
1737 		__field(ino_t,	ino)
1738 		__field(pgoff_t, idx)
1739 		__field(unsigned int, size)
1740 		__field(unsigned int, algtype)
1741 	),
1742 
1743 	TP_fast_assign(
1744 		__entry->dev = inode->i_sb->s_dev;
1745 		__entry->ino = inode->i_ino;
1746 		__entry->idx = cluster_idx;
1747 		__entry->size = cluster_size;
1748 		__entry->algtype = algtype;
1749 	),
1750 
1751 	TP_printk("dev = (%d,%d), ino = %lu, cluster_idx:%lu, "
1752 		"cluster_size = %u, algorithm = %s",
1753 		show_dev_ino(__entry),
1754 		__entry->idx,
1755 		__entry->size,
1756 		show_compress_algorithm(__entry->algtype))
1757 );
1758 
1759 DECLARE_EVENT_CLASS(f2fs_zip_end,
1760 
1761 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1762 			unsigned int compressed_size, int ret),
1763 
1764 	TP_ARGS(inode, cluster_idx, compressed_size, ret),
1765 
1766 	TP_STRUCT__entry(
1767 		__field(dev_t,	dev)
1768 		__field(ino_t,	ino)
1769 		__field(pgoff_t, idx)
1770 		__field(unsigned int, size)
1771 		__field(unsigned int, ret)
1772 	),
1773 
1774 	TP_fast_assign(
1775 		__entry->dev = inode->i_sb->s_dev;
1776 		__entry->ino = inode->i_ino;
1777 		__entry->idx = cluster_idx;
1778 		__entry->size = compressed_size;
1779 		__entry->ret = ret;
1780 	),
1781 
1782 	TP_printk("dev = (%d,%d), ino = %lu, cluster_idx:%lu, "
1783 		"compressed_size = %u, ret = %d",
1784 		show_dev_ino(__entry),
1785 		__entry->idx,
1786 		__entry->size,
1787 		__entry->ret)
1788 );
1789 
1790 DEFINE_EVENT(f2fs_zip_start, f2fs_compress_pages_start,
1791 
1792 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1793 		unsigned int cluster_size, unsigned char algtype),
1794 
1795 	TP_ARGS(inode, cluster_idx, cluster_size, algtype)
1796 );
1797 
1798 DEFINE_EVENT(f2fs_zip_start, f2fs_decompress_pages_start,
1799 
1800 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1801 		unsigned int cluster_size, unsigned char algtype),
1802 
1803 	TP_ARGS(inode, cluster_idx, cluster_size, algtype)
1804 );
1805 
1806 DEFINE_EVENT(f2fs_zip_end, f2fs_compress_pages_end,
1807 
1808 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1809 			unsigned int compressed_size, int ret),
1810 
1811 	TP_ARGS(inode, cluster_idx, compressed_size, ret)
1812 );
1813 
1814 DEFINE_EVENT(f2fs_zip_end, f2fs_decompress_pages_end,
1815 
1816 	TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1817 			unsigned int compressed_size, int ret),
1818 
1819 	TP_ARGS(inode, cluster_idx, compressed_size, ret)
1820 );
1821 
1822 #ifdef CONFIG_F2FS_IOSTAT
1823 TRACE_EVENT(f2fs_iostat,
1824 
1825 	TP_PROTO(struct f2fs_sb_info *sbi, unsigned long long *iostat),
1826 
1827 	TP_ARGS(sbi, iostat),
1828 
1829 	TP_STRUCT__entry(
1830 		__field(dev_t,	dev)
1831 		__field(unsigned long long,	app_dio)
1832 		__field(unsigned long long,	app_bio)
1833 		__field(unsigned long long,	app_wio)
1834 		__field(unsigned long long,	app_mio)
1835 		__field(unsigned long long,	app_bcdio)
1836 		__field(unsigned long long,	app_mcdio)
1837 		__field(unsigned long long,	fs_dio)
1838 		__field(unsigned long long,	fs_cdio)
1839 		__field(unsigned long long,	fs_nio)
1840 		__field(unsigned long long,	fs_mio)
1841 		__field(unsigned long long,	fs_gc_dio)
1842 		__field(unsigned long long,	fs_gc_nio)
1843 		__field(unsigned long long,	fs_cp_dio)
1844 		__field(unsigned long long,	fs_cp_nio)
1845 		__field(unsigned long long,	fs_cp_mio)
1846 		__field(unsigned long long,	app_drio)
1847 		__field(unsigned long long,	app_brio)
1848 		__field(unsigned long long,	app_rio)
1849 		__field(unsigned long long,	app_mrio)
1850 		__field(unsigned long long,	app_bcrio)
1851 		__field(unsigned long long,	app_mcrio)
1852 		__field(unsigned long long,	fs_drio)
1853 		__field(unsigned long long,	fs_gdrio)
1854 		__field(unsigned long long,	fs_cdrio)
1855 		__field(unsigned long long,	fs_nrio)
1856 		__field(unsigned long long,	fs_mrio)
1857 		__field(unsigned long long,	fs_discard)
1858 	),
1859 
1860 	TP_fast_assign(
1861 		__entry->dev		= sbi->sb->s_dev;
1862 		__entry->app_dio	= iostat[APP_DIRECT_IO];
1863 		__entry->app_bio	= iostat[APP_BUFFERED_IO];
1864 		__entry->app_wio	= iostat[APP_WRITE_IO];
1865 		__entry->app_mio	= iostat[APP_MAPPED_IO];
1866 		__entry->app_bcdio	= iostat[APP_BUFFERED_CDATA_IO];
1867 		__entry->app_mcdio	= iostat[APP_MAPPED_CDATA_IO];
1868 		__entry->fs_dio		= iostat[FS_DATA_IO];
1869 		__entry->fs_cdio	= iostat[FS_CDATA_IO];
1870 		__entry->fs_nio		= iostat[FS_NODE_IO];
1871 		__entry->fs_mio		= iostat[FS_META_IO];
1872 		__entry->fs_gc_dio	= iostat[FS_GC_DATA_IO];
1873 		__entry->fs_gc_nio	= iostat[FS_GC_NODE_IO];
1874 		__entry->fs_cp_dio	= iostat[FS_CP_DATA_IO];
1875 		__entry->fs_cp_nio	= iostat[FS_CP_NODE_IO];
1876 		__entry->fs_cp_mio	= iostat[FS_CP_META_IO];
1877 		__entry->app_drio	= iostat[APP_DIRECT_READ_IO];
1878 		__entry->app_brio	= iostat[APP_BUFFERED_READ_IO];
1879 		__entry->app_rio	= iostat[APP_READ_IO];
1880 		__entry->app_mrio	= iostat[APP_MAPPED_READ_IO];
1881 		__entry->app_bcrio	= iostat[APP_BUFFERED_CDATA_READ_IO];
1882 		__entry->app_mcrio	= iostat[APP_MAPPED_CDATA_READ_IO];
1883 		__entry->fs_drio	= iostat[FS_DATA_READ_IO];
1884 		__entry->fs_gdrio	= iostat[FS_GDATA_READ_IO];
1885 		__entry->fs_cdrio	= iostat[FS_CDATA_READ_IO];
1886 		__entry->fs_nrio	= iostat[FS_NODE_READ_IO];
1887 		__entry->fs_mrio	= iostat[FS_META_READ_IO];
1888 		__entry->fs_discard	= iostat[FS_DISCARD];
1889 	),
1890 
1891 	TP_printk("dev = (%d,%d), "
1892 		"app [write=%llu (direct=%llu, buffered=%llu), mapped=%llu, "
1893 		"compr(buffered=%llu, mapped=%llu)], "
1894 		"fs [data=%llu, cdata=%llu, node=%llu, meta=%llu, discard=%llu], "
1895 		"gc [data=%llu, node=%llu], "
1896 		"cp [data=%llu, node=%llu, meta=%llu], "
1897 		"app [read=%llu (direct=%llu, buffered=%llu), mapped=%llu], "
1898 		"compr(buffered=%llu, mapped=%llu)], "
1899 		"fs [data=%llu, (gc_data=%llu, cdata=%llu), "
1900 		"node=%llu, meta=%llu]",
1901 		show_dev(__entry->dev), __entry->app_wio, __entry->app_dio,
1902 		__entry->app_bio, __entry->app_mio, __entry->app_bcdio,
1903 		__entry->app_mcdio, __entry->fs_dio, __entry->fs_cdio,
1904 		__entry->fs_nio, __entry->fs_mio, __entry->fs_discard,
1905 		__entry->fs_gc_dio, __entry->fs_gc_nio, __entry->fs_cp_dio,
1906 		__entry->fs_cp_nio, __entry->fs_cp_mio,
1907 		__entry->app_rio, __entry->app_drio, __entry->app_brio,
1908 		__entry->app_mrio, __entry->app_bcrio, __entry->app_mcrio,
1909 		__entry->fs_drio, __entry->fs_gdrio,
1910 		__entry->fs_cdrio, __entry->fs_nrio, __entry->fs_mrio)
1911 );
1912 
1913 #ifndef __F2FS_IOSTAT_LATENCY_TYPE
1914 #define __F2FS_IOSTAT_LATENCY_TYPE
1915 struct f2fs_iostat_latency {
1916 	unsigned int peak_lat;
1917 	unsigned int avg_lat;
1918 	unsigned int cnt;
1919 };
1920 #endif /* __F2FS_IOSTAT_LATENCY_TYPE */
1921 
1922 TRACE_EVENT(f2fs_iostat_latency,
1923 
1924 	TP_PROTO(struct f2fs_sb_info *sbi, struct f2fs_iostat_latency (*iostat_lat)[NR_PAGE_TYPE]),
1925 
1926 	TP_ARGS(sbi, iostat_lat),
1927 
1928 	TP_STRUCT__entry(
1929 		__field(dev_t,	dev)
1930 		__field(unsigned int,	d_rd_peak)
1931 		__field(unsigned int,	d_rd_avg)
1932 		__field(unsigned int,	d_rd_cnt)
1933 		__field(unsigned int,	n_rd_peak)
1934 		__field(unsigned int,	n_rd_avg)
1935 		__field(unsigned int,	n_rd_cnt)
1936 		__field(unsigned int,	m_rd_peak)
1937 		__field(unsigned int,	m_rd_avg)
1938 		__field(unsigned int,	m_rd_cnt)
1939 		__field(unsigned int,	d_wr_s_peak)
1940 		__field(unsigned int,	d_wr_s_avg)
1941 		__field(unsigned int,	d_wr_s_cnt)
1942 		__field(unsigned int,	n_wr_s_peak)
1943 		__field(unsigned int,	n_wr_s_avg)
1944 		__field(unsigned int,	n_wr_s_cnt)
1945 		__field(unsigned int,	m_wr_s_peak)
1946 		__field(unsigned int,	m_wr_s_avg)
1947 		__field(unsigned int,	m_wr_s_cnt)
1948 		__field(unsigned int,	d_wr_as_peak)
1949 		__field(unsigned int,	d_wr_as_avg)
1950 		__field(unsigned int,	d_wr_as_cnt)
1951 		__field(unsigned int,	n_wr_as_peak)
1952 		__field(unsigned int,	n_wr_as_avg)
1953 		__field(unsigned int,	n_wr_as_cnt)
1954 		__field(unsigned int,	m_wr_as_peak)
1955 		__field(unsigned int,	m_wr_as_avg)
1956 		__field(unsigned int,	m_wr_as_cnt)
1957 	),
1958 
1959 	TP_fast_assign(
1960 		__entry->dev		= sbi->sb->s_dev;
1961 		__entry->d_rd_peak	= iostat_lat[0][DATA].peak_lat;
1962 		__entry->d_rd_avg	= iostat_lat[0][DATA].avg_lat;
1963 		__entry->d_rd_cnt	= iostat_lat[0][DATA].cnt;
1964 		__entry->n_rd_peak	= iostat_lat[0][NODE].peak_lat;
1965 		__entry->n_rd_avg	= iostat_lat[0][NODE].avg_lat;
1966 		__entry->n_rd_cnt	= iostat_lat[0][NODE].cnt;
1967 		__entry->m_rd_peak	= iostat_lat[0][META].peak_lat;
1968 		__entry->m_rd_avg	= iostat_lat[0][META].avg_lat;
1969 		__entry->m_rd_cnt	= iostat_lat[0][META].cnt;
1970 		__entry->d_wr_s_peak	= iostat_lat[1][DATA].peak_lat;
1971 		__entry->d_wr_s_avg	= iostat_lat[1][DATA].avg_lat;
1972 		__entry->d_wr_s_cnt	= iostat_lat[1][DATA].cnt;
1973 		__entry->n_wr_s_peak	= iostat_lat[1][NODE].peak_lat;
1974 		__entry->n_wr_s_avg	= iostat_lat[1][NODE].avg_lat;
1975 		__entry->n_wr_s_cnt	= iostat_lat[1][NODE].cnt;
1976 		__entry->m_wr_s_peak	= iostat_lat[1][META].peak_lat;
1977 		__entry->m_wr_s_avg	= iostat_lat[1][META].avg_lat;
1978 		__entry->m_wr_s_cnt	= iostat_lat[1][META].cnt;
1979 		__entry->d_wr_as_peak	= iostat_lat[2][DATA].peak_lat;
1980 		__entry->d_wr_as_avg	= iostat_lat[2][DATA].avg_lat;
1981 		__entry->d_wr_as_cnt	= iostat_lat[2][DATA].cnt;
1982 		__entry->n_wr_as_peak	= iostat_lat[2][NODE].peak_lat;
1983 		__entry->n_wr_as_avg	= iostat_lat[2][NODE].avg_lat;
1984 		__entry->n_wr_as_cnt	= iostat_lat[2][NODE].cnt;
1985 		__entry->m_wr_as_peak	= iostat_lat[2][META].peak_lat;
1986 		__entry->m_wr_as_avg	= iostat_lat[2][META].avg_lat;
1987 		__entry->m_wr_as_cnt	= iostat_lat[2][META].cnt;
1988 	),
1989 
1990 	TP_printk("dev = (%d,%d), "
1991 		"iotype [peak lat.(ms)/avg lat.(ms)/count], "
1992 		"rd_data [%u/%u/%u], rd_node [%u/%u/%u], rd_meta [%u/%u/%u], "
1993 		"wr_sync_data [%u/%u/%u], wr_sync_node [%u/%u/%u], "
1994 		"wr_sync_meta [%u/%u/%u], wr_async_data [%u/%u/%u], "
1995 		"wr_async_node [%u/%u/%u], wr_async_meta [%u/%u/%u]",
1996 		show_dev(__entry->dev),
1997 		__entry->d_rd_peak, __entry->d_rd_avg, __entry->d_rd_cnt,
1998 		__entry->n_rd_peak, __entry->n_rd_avg, __entry->n_rd_cnt,
1999 		__entry->m_rd_peak, __entry->m_rd_avg, __entry->m_rd_cnt,
2000 		__entry->d_wr_s_peak, __entry->d_wr_s_avg, __entry->d_wr_s_cnt,
2001 		__entry->n_wr_s_peak, __entry->n_wr_s_avg, __entry->n_wr_s_cnt,
2002 		__entry->m_wr_s_peak, __entry->m_wr_s_avg, __entry->m_wr_s_cnt,
2003 		__entry->d_wr_as_peak, __entry->d_wr_as_avg, __entry->d_wr_as_cnt,
2004 		__entry->n_wr_as_peak, __entry->n_wr_as_avg, __entry->n_wr_as_cnt,
2005 		__entry->m_wr_as_peak, __entry->m_wr_as_avg, __entry->m_wr_as_cnt)
2006 );
2007 #endif
2008 
2009 TRACE_EVENT(f2fs_bmap,
2010 
2011 	TP_PROTO(struct inode *inode, sector_t lblock, sector_t pblock),
2012 
2013 	TP_ARGS(inode, lblock, pblock),
2014 
2015 	TP_STRUCT__entry(
2016 		__field(dev_t, dev)
2017 		__field(ino_t, ino)
2018 		__field(sector_t, lblock)
2019 		__field(sector_t, pblock)
2020 	),
2021 
2022 	TP_fast_assign(
2023 		__entry->dev		= inode->i_sb->s_dev;
2024 		__entry->ino		= inode->i_ino;
2025 		__entry->lblock		= lblock;
2026 		__entry->pblock		= pblock;
2027 	),
2028 
2029 	TP_printk("dev = (%d,%d), ino = %lu, lblock:%lld, pblock:%lld",
2030 		show_dev_ino(__entry),
2031 		(unsigned long long)__entry->lblock,
2032 		(unsigned long long)__entry->pblock)
2033 );
2034 
2035 TRACE_EVENT(f2fs_fiemap,
2036 
2037 	TP_PROTO(struct inode *inode, sector_t lblock, sector_t pblock,
2038 		unsigned long long len, unsigned int flags, int ret),
2039 
2040 	TP_ARGS(inode, lblock, pblock, len, flags, ret),
2041 
2042 	TP_STRUCT__entry(
2043 		__field(dev_t, dev)
2044 		__field(ino_t, ino)
2045 		__field(sector_t, lblock)
2046 		__field(sector_t, pblock)
2047 		__field(unsigned long long, len)
2048 		__field(unsigned int, flags)
2049 		__field(int, ret)
2050 	),
2051 
2052 	TP_fast_assign(
2053 		__entry->dev		= inode->i_sb->s_dev;
2054 		__entry->ino		= inode->i_ino;
2055 		__entry->lblock		= lblock;
2056 		__entry->pblock		= pblock;
2057 		__entry->len		= len;
2058 		__entry->flags		= flags;
2059 		__entry->ret		= ret;
2060 	),
2061 
2062 	TP_printk("dev = (%d,%d), ino = %lu, lblock:%lld, pblock:%lld, "
2063 		"len:%llu, flags:%u, ret:%d",
2064 		show_dev_ino(__entry),
2065 		(unsigned long long)__entry->lblock,
2066 		(unsigned long long)__entry->pblock,
2067 		__entry->len,
2068 		__entry->flags,
2069 		__entry->ret)
2070 );
2071 
2072 DECLARE_EVENT_CLASS(f2fs__rw_start,
2073 
2074 	TP_PROTO(struct inode *inode, loff_t offset, int bytes,
2075 			pid_t pid, char *pathname, char *command),
2076 
2077 	TP_ARGS(inode, offset, bytes, pid, pathname, command),
2078 
2079 	TP_STRUCT__entry(
2080 		__string(pathbuf, pathname)
2081 		__field(loff_t, offset)
2082 		__field(int, bytes)
2083 		__field(loff_t, i_size)
2084 		__string(cmdline, command)
2085 		__field(pid_t, pid)
2086 		__field(ino_t, ino)
2087 	),
2088 
2089 	TP_fast_assign(
2090 		/*
2091 		 * Replace the spaces in filenames and cmdlines
2092 		 * because this screws up the tooling that parses
2093 		 * the traces.
2094 		 */
2095 		__assign_str(pathbuf, pathname);
2096 		(void)strreplace(__get_str(pathbuf), ' ', '_');
2097 		__entry->offset = offset;
2098 		__entry->bytes = bytes;
2099 		__entry->i_size = i_size_read(inode);
2100 		__assign_str(cmdline, command);
2101 		(void)strreplace(__get_str(cmdline), ' ', '_');
2102 		__entry->pid = pid;
2103 		__entry->ino = inode->i_ino;
2104 	),
2105 
2106 	TP_printk("entry_name %s, offset %llu, bytes %d, cmdline %s,"
2107 		" pid %d, i_size %llu, ino %lu",
2108 		__get_str(pathbuf), __entry->offset, __entry->bytes,
2109 		__get_str(cmdline), __entry->pid, __entry->i_size,
2110 		(unsigned long) __entry->ino)
2111 );
2112 
2113 DECLARE_EVENT_CLASS(f2fs__rw_end,
2114 
2115 	TP_PROTO(struct inode *inode, loff_t offset, int bytes),
2116 
2117 	TP_ARGS(inode, offset, bytes),
2118 
2119 	TP_STRUCT__entry(
2120 		__field(ino_t,	ino)
2121 		__field(loff_t,	offset)
2122 		__field(int,	bytes)
2123 	),
2124 
2125 	TP_fast_assign(
2126 		__entry->ino		= inode->i_ino;
2127 		__entry->offset		= offset;
2128 		__entry->bytes		= bytes;
2129 	),
2130 
2131 	TP_printk("ino %lu, offset %llu, bytes %d",
2132 		(unsigned long) __entry->ino,
2133 		__entry->offset, __entry->bytes)
2134 );
2135 
2136 DEFINE_EVENT(f2fs__rw_start, f2fs_dataread_start,
2137 
2138 	TP_PROTO(struct inode *inode, loff_t offset, int bytes,
2139 		pid_t pid, char *pathname, char *command),
2140 
2141 	TP_ARGS(inode, offset, bytes, pid, pathname, command)
2142 );
2143 
2144 DEFINE_EVENT(f2fs__rw_end, f2fs_dataread_end,
2145 
2146 	TP_PROTO(struct inode *inode, loff_t offset, int bytes),
2147 
2148 	TP_ARGS(inode, offset, bytes)
2149 );
2150 
2151 DEFINE_EVENT(f2fs__rw_start, f2fs_datawrite_start,
2152 
2153 	TP_PROTO(struct inode *inode, loff_t offset, int bytes,
2154 		pid_t pid, char *pathname, char *command),
2155 
2156 	TP_ARGS(inode, offset, bytes, pid, pathname, command)
2157 );
2158 
2159 DEFINE_EVENT(f2fs__rw_end, f2fs_datawrite_end,
2160 
2161 	TP_PROTO(struct inode *inode, loff_t offset, int bytes),
2162 
2163 	TP_ARGS(inode, offset, bytes)
2164 );
2165 
2166 #endif /* _TRACE_F2FS_H */
2167 
2168  /* This part must be outside protection */
2169 #include <trace/define_trace.h>
2170