xref: /openbmc/linux/include/trace/events/f2fs.h (revision ca55b2fe)
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM f2fs
3 
4 #if !defined(_TRACE_F2FS_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_F2FS_H
6 
7 #include <linux/tracepoint.h>
8 
9 #define show_dev(entry)		MAJOR(entry->dev), MINOR(entry->dev)
10 #define show_dev_ino(entry)	show_dev(entry), (unsigned long)entry->ino
11 
12 TRACE_DEFINE_ENUM(NODE);
13 TRACE_DEFINE_ENUM(DATA);
14 TRACE_DEFINE_ENUM(META);
15 TRACE_DEFINE_ENUM(META_FLUSH);
16 TRACE_DEFINE_ENUM(INMEM);
17 TRACE_DEFINE_ENUM(INMEM_DROP);
18 TRACE_DEFINE_ENUM(IPU);
19 TRACE_DEFINE_ENUM(OPU);
20 TRACE_DEFINE_ENUM(CURSEG_HOT_DATA);
21 TRACE_DEFINE_ENUM(CURSEG_WARM_DATA);
22 TRACE_DEFINE_ENUM(CURSEG_COLD_DATA);
23 TRACE_DEFINE_ENUM(CURSEG_HOT_NODE);
24 TRACE_DEFINE_ENUM(CURSEG_WARM_NODE);
25 TRACE_DEFINE_ENUM(CURSEG_COLD_NODE);
26 TRACE_DEFINE_ENUM(NO_CHECK_TYPE);
27 TRACE_DEFINE_ENUM(GC_GREEDY);
28 TRACE_DEFINE_ENUM(GC_CB);
29 TRACE_DEFINE_ENUM(FG_GC);
30 TRACE_DEFINE_ENUM(BG_GC);
31 TRACE_DEFINE_ENUM(LFS);
32 TRACE_DEFINE_ENUM(SSR);
33 TRACE_DEFINE_ENUM(__REQ_RAHEAD);
34 TRACE_DEFINE_ENUM(__REQ_WRITE);
35 TRACE_DEFINE_ENUM(__REQ_SYNC);
36 TRACE_DEFINE_ENUM(__REQ_NOIDLE);
37 TRACE_DEFINE_ENUM(__REQ_FLUSH);
38 TRACE_DEFINE_ENUM(__REQ_FUA);
39 TRACE_DEFINE_ENUM(__REQ_PRIO);
40 TRACE_DEFINE_ENUM(__REQ_META);
41 TRACE_DEFINE_ENUM(CP_UMOUNT);
42 TRACE_DEFINE_ENUM(CP_FASTBOOT);
43 TRACE_DEFINE_ENUM(CP_SYNC);
44 TRACE_DEFINE_ENUM(CP_RECOVERY);
45 TRACE_DEFINE_ENUM(CP_DISCARD);
46 
47 #define show_block_type(type)						\
48 	__print_symbolic(type,						\
49 		{ NODE,		"NODE" },				\
50 		{ DATA,		"DATA" },				\
51 		{ META,		"META" },				\
52 		{ META_FLUSH,	"META_FLUSH" },				\
53 		{ INMEM,	"INMEM" },				\
54 		{ INMEM_DROP,	"INMEM_DROP" },				\
55 		{ IPU,		"IN-PLACE" },				\
56 		{ OPU,		"OUT-OF-PLACE" })
57 
58 #define F2FS_BIO_MASK(t)	(t & (READA | WRITE_FLUSH_FUA))
59 #define F2FS_BIO_EXTRA_MASK(t)	(t & (REQ_META | REQ_PRIO))
60 
61 #define show_bio_type(type)	show_bio_base(type), show_bio_extra(type)
62 
63 #define show_bio_base(type)						\
64 	__print_symbolic(F2FS_BIO_MASK(type),				\
65 		{ READ, 		"READ" },			\
66 		{ READA, 		"READAHEAD" },			\
67 		{ READ_SYNC, 		"READ_SYNC" },			\
68 		{ WRITE, 		"WRITE" },			\
69 		{ WRITE_SYNC, 		"WRITE_SYNC" },			\
70 		{ WRITE_FLUSH,		"WRITE_FLUSH" },		\
71 		{ WRITE_FUA, 		"WRITE_FUA" },			\
72 		{ WRITE_FLUSH_FUA,	"WRITE_FLUSH_FUA" })
73 
74 #define show_bio_extra(type)						\
75 	__print_symbolic(F2FS_BIO_EXTRA_MASK(type),			\
76 		{ REQ_META, 		"(M)" },			\
77 		{ REQ_PRIO, 		"(P)" },			\
78 		{ REQ_META | REQ_PRIO,	"(MP)" },			\
79 		{ 0, " \b" })
80 
81 #define show_data_type(type)						\
82 	__print_symbolic(type,						\
83 		{ CURSEG_HOT_DATA, 	"Hot DATA" },			\
84 		{ CURSEG_WARM_DATA, 	"Warm DATA" },			\
85 		{ CURSEG_COLD_DATA, 	"Cold DATA" },			\
86 		{ CURSEG_HOT_NODE, 	"Hot NODE" },			\
87 		{ CURSEG_WARM_NODE, 	"Warm NODE" },			\
88 		{ CURSEG_COLD_NODE, 	"Cold NODE" },			\
89 		{ NO_CHECK_TYPE, 	"No TYPE" })
90 
91 #define show_file_type(type)						\
92 	__print_symbolic(type,						\
93 		{ 0,		"FILE" },				\
94 		{ 1,		"DIR" })
95 
96 #define show_gc_type(type)						\
97 	__print_symbolic(type,						\
98 		{ FG_GC,	"Foreground GC" },			\
99 		{ BG_GC,	"Background GC" })
100 
101 #define show_alloc_mode(type)						\
102 	__print_symbolic(type,						\
103 		{ LFS,	"LFS-mode" },					\
104 		{ SSR,	"SSR-mode" })
105 
106 #define show_victim_policy(type)					\
107 	__print_symbolic(type,						\
108 		{ GC_GREEDY,	"Greedy" },				\
109 		{ GC_CB,	"Cost-Benefit" })
110 
111 #define show_cpreason(type)						\
112 	__print_symbolic(type,						\
113 		{ CP_UMOUNT,	"Umount" },				\
114 		{ CP_FASTBOOT,	"Fastboot" },				\
115 		{ CP_SYNC,	"Sync" },				\
116 		{ CP_RECOVERY,	"Recovery" },				\
117 		{ CP_DISCARD,	"Discard" })
118 
119 struct victim_sel_policy;
120 struct f2fs_map_blocks;
121 
122 DECLARE_EVENT_CLASS(f2fs__inode,
123 
124 	TP_PROTO(struct inode *inode),
125 
126 	TP_ARGS(inode),
127 
128 	TP_STRUCT__entry(
129 		__field(dev_t,	dev)
130 		__field(ino_t,	ino)
131 		__field(ino_t,	pino)
132 		__field(umode_t, mode)
133 		__field(loff_t,	size)
134 		__field(unsigned int, nlink)
135 		__field(blkcnt_t, blocks)
136 		__field(__u8,	advise)
137 	),
138 
139 	TP_fast_assign(
140 		__entry->dev	= inode->i_sb->s_dev;
141 		__entry->ino	= inode->i_ino;
142 		__entry->pino	= F2FS_I(inode)->i_pino;
143 		__entry->mode	= inode->i_mode;
144 		__entry->nlink	= inode->i_nlink;
145 		__entry->size	= inode->i_size;
146 		__entry->blocks	= inode->i_blocks;
147 		__entry->advise	= F2FS_I(inode)->i_advise;
148 	),
149 
150 	TP_printk("dev = (%d,%d), ino = %lu, pino = %lu, i_mode = 0x%hx, "
151 		"i_size = %lld, i_nlink = %u, i_blocks = %llu, i_advise = 0x%x",
152 		show_dev_ino(__entry),
153 		(unsigned long)__entry->pino,
154 		__entry->mode,
155 		__entry->size,
156 		(unsigned int)__entry->nlink,
157 		(unsigned long long)__entry->blocks,
158 		(unsigned char)__entry->advise)
159 );
160 
161 DECLARE_EVENT_CLASS(f2fs__inode_exit,
162 
163 	TP_PROTO(struct inode *inode, int ret),
164 
165 	TP_ARGS(inode, ret),
166 
167 	TP_STRUCT__entry(
168 		__field(dev_t,	dev)
169 		__field(ino_t,	ino)
170 		__field(int,	ret)
171 	),
172 
173 	TP_fast_assign(
174 		__entry->dev	= inode->i_sb->s_dev;
175 		__entry->ino	= inode->i_ino;
176 		__entry->ret	= ret;
177 	),
178 
179 	TP_printk("dev = (%d,%d), ino = %lu, ret = %d",
180 		show_dev_ino(__entry),
181 		__entry->ret)
182 );
183 
184 DEFINE_EVENT(f2fs__inode, f2fs_sync_file_enter,
185 
186 	TP_PROTO(struct inode *inode),
187 
188 	TP_ARGS(inode)
189 );
190 
191 TRACE_EVENT(f2fs_sync_file_exit,
192 
193 	TP_PROTO(struct inode *inode, int need_cp, int datasync, int ret),
194 
195 	TP_ARGS(inode, need_cp, datasync, ret),
196 
197 	TP_STRUCT__entry(
198 		__field(dev_t,	dev)
199 		__field(ino_t,	ino)
200 		__field(int,	need_cp)
201 		__field(int,	datasync)
202 		__field(int,	ret)
203 	),
204 
205 	TP_fast_assign(
206 		__entry->dev		= inode->i_sb->s_dev;
207 		__entry->ino		= inode->i_ino;
208 		__entry->need_cp	= need_cp;
209 		__entry->datasync	= datasync;
210 		__entry->ret		= ret;
211 	),
212 
213 	TP_printk("dev = (%d,%d), ino = %lu, checkpoint is %s, "
214 		"datasync = %d, ret = %d",
215 		show_dev_ino(__entry),
216 		__entry->need_cp ? "needed" : "not needed",
217 		__entry->datasync,
218 		__entry->ret)
219 );
220 
221 TRACE_EVENT(f2fs_sync_fs,
222 
223 	TP_PROTO(struct super_block *sb, int wait),
224 
225 	TP_ARGS(sb, wait),
226 
227 	TP_STRUCT__entry(
228 		__field(dev_t,	dev)
229 		__field(int,	dirty)
230 		__field(int,	wait)
231 	),
232 
233 	TP_fast_assign(
234 		__entry->dev	= sb->s_dev;
235 		__entry->dirty	= is_sbi_flag_set(F2FS_SB(sb), SBI_IS_DIRTY);
236 		__entry->wait	= wait;
237 	),
238 
239 	TP_printk("dev = (%d,%d), superblock is %s, wait = %d",
240 		show_dev(__entry),
241 		__entry->dirty ? "dirty" : "not dirty",
242 		__entry->wait)
243 );
244 
245 DEFINE_EVENT(f2fs__inode, f2fs_iget,
246 
247 	TP_PROTO(struct inode *inode),
248 
249 	TP_ARGS(inode)
250 );
251 
252 DEFINE_EVENT(f2fs__inode_exit, f2fs_iget_exit,
253 
254 	TP_PROTO(struct inode *inode, int ret),
255 
256 	TP_ARGS(inode, ret)
257 );
258 
259 DEFINE_EVENT(f2fs__inode, f2fs_evict_inode,
260 
261 	TP_PROTO(struct inode *inode),
262 
263 	TP_ARGS(inode)
264 );
265 
266 DEFINE_EVENT(f2fs__inode_exit, f2fs_new_inode,
267 
268 	TP_PROTO(struct inode *inode, int ret),
269 
270 	TP_ARGS(inode, ret)
271 );
272 
273 TRACE_EVENT(f2fs_unlink_enter,
274 
275 	TP_PROTO(struct inode *dir, struct dentry *dentry),
276 
277 	TP_ARGS(dir, dentry),
278 
279 	TP_STRUCT__entry(
280 		__field(dev_t,	dev)
281 		__field(ino_t,	ino)
282 		__field(loff_t,	size)
283 		__field(blkcnt_t, blocks)
284 		__field(const char *,	name)
285 	),
286 
287 	TP_fast_assign(
288 		__entry->dev	= dir->i_sb->s_dev;
289 		__entry->ino	= dir->i_ino;
290 		__entry->size	= dir->i_size;
291 		__entry->blocks	= dir->i_blocks;
292 		__entry->name	= dentry->d_name.name;
293 	),
294 
295 	TP_printk("dev = (%d,%d), dir ino = %lu, i_size = %lld, "
296 		"i_blocks = %llu, name = %s",
297 		show_dev_ino(__entry),
298 		__entry->size,
299 		(unsigned long long)__entry->blocks,
300 		__entry->name)
301 );
302 
303 DEFINE_EVENT(f2fs__inode_exit, f2fs_unlink_exit,
304 
305 	TP_PROTO(struct inode *inode, int ret),
306 
307 	TP_ARGS(inode, ret)
308 );
309 
310 DEFINE_EVENT(f2fs__inode, f2fs_truncate,
311 
312 	TP_PROTO(struct inode *inode),
313 
314 	TP_ARGS(inode)
315 );
316 
317 TRACE_EVENT(f2fs_truncate_data_blocks_range,
318 
319 	TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs, int free),
320 
321 	TP_ARGS(inode, nid,  ofs, free),
322 
323 	TP_STRUCT__entry(
324 		__field(dev_t,	dev)
325 		__field(ino_t,	ino)
326 		__field(nid_t,	nid)
327 		__field(unsigned int,	ofs)
328 		__field(int,	free)
329 	),
330 
331 	TP_fast_assign(
332 		__entry->dev	= inode->i_sb->s_dev;
333 		__entry->ino	= inode->i_ino;
334 		__entry->nid	= nid;
335 		__entry->ofs	= ofs;
336 		__entry->free	= free;
337 	),
338 
339 	TP_printk("dev = (%d,%d), ino = %lu, nid = %u, offset = %u, freed = %d",
340 		show_dev_ino(__entry),
341 		(unsigned int)__entry->nid,
342 		__entry->ofs,
343 		__entry->free)
344 );
345 
346 DECLARE_EVENT_CLASS(f2fs__truncate_op,
347 
348 	TP_PROTO(struct inode *inode, u64 from),
349 
350 	TP_ARGS(inode, from),
351 
352 	TP_STRUCT__entry(
353 		__field(dev_t,	dev)
354 		__field(ino_t,	ino)
355 		__field(loff_t,	size)
356 		__field(blkcnt_t, blocks)
357 		__field(u64,	from)
358 	),
359 
360 	TP_fast_assign(
361 		__entry->dev	= inode->i_sb->s_dev;
362 		__entry->ino	= inode->i_ino;
363 		__entry->size	= inode->i_size;
364 		__entry->blocks	= inode->i_blocks;
365 		__entry->from	= from;
366 	),
367 
368 	TP_printk("dev = (%d,%d), ino = %lu, i_size = %lld, i_blocks = %llu, "
369 		"start file offset = %llu",
370 		show_dev_ino(__entry),
371 		__entry->size,
372 		(unsigned long long)__entry->blocks,
373 		(unsigned long long)__entry->from)
374 );
375 
376 DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_blocks_enter,
377 
378 	TP_PROTO(struct inode *inode, u64 from),
379 
380 	TP_ARGS(inode, from)
381 );
382 
383 DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_blocks_exit,
384 
385 	TP_PROTO(struct inode *inode, int ret),
386 
387 	TP_ARGS(inode, ret)
388 );
389 
390 DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_inode_blocks_enter,
391 
392 	TP_PROTO(struct inode *inode, u64 from),
393 
394 	TP_ARGS(inode, from)
395 );
396 
397 DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_inode_blocks_exit,
398 
399 	TP_PROTO(struct inode *inode, int ret),
400 
401 	TP_ARGS(inode, ret)
402 );
403 
404 DECLARE_EVENT_CLASS(f2fs__truncate_node,
405 
406 	TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
407 
408 	TP_ARGS(inode, nid, blk_addr),
409 
410 	TP_STRUCT__entry(
411 		__field(dev_t,	dev)
412 		__field(ino_t,	ino)
413 		__field(nid_t,	nid)
414 		__field(block_t,	blk_addr)
415 	),
416 
417 	TP_fast_assign(
418 		__entry->dev		= inode->i_sb->s_dev;
419 		__entry->ino		= inode->i_ino;
420 		__entry->nid		= nid;
421 		__entry->blk_addr	= blk_addr;
422 	),
423 
424 	TP_printk("dev = (%d,%d), ino = %lu, nid = %u, block_address = 0x%llx",
425 		show_dev_ino(__entry),
426 		(unsigned int)__entry->nid,
427 		(unsigned long long)__entry->blk_addr)
428 );
429 
430 DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_nodes_enter,
431 
432 	TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
433 
434 	TP_ARGS(inode, nid, blk_addr)
435 );
436 
437 DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_nodes_exit,
438 
439 	TP_PROTO(struct inode *inode, int ret),
440 
441 	TP_ARGS(inode, ret)
442 );
443 
444 DEFINE_EVENT(f2fs__truncate_node, 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 
451 TRACE_EVENT(f2fs_truncate_partial_nodes,
452 
453 	TP_PROTO(struct inode *inode, nid_t nid[], int depth, int err),
454 
455 	TP_ARGS(inode, nid, depth, err),
456 
457 	TP_STRUCT__entry(
458 		__field(dev_t,	dev)
459 		__field(ino_t,	ino)
460 		__field(nid_t,	nid[3])
461 		__field(int,	depth)
462 		__field(int,	err)
463 	),
464 
465 	TP_fast_assign(
466 		__entry->dev	= inode->i_sb->s_dev;
467 		__entry->ino	= inode->i_ino;
468 		__entry->nid[0]	= nid[0];
469 		__entry->nid[1]	= nid[1];
470 		__entry->nid[2]	= nid[2];
471 		__entry->depth	= depth;
472 		__entry->err	= err;
473 	),
474 
475 	TP_printk("dev = (%d,%d), ino = %lu, "
476 		"nid[0] = %u, nid[1] = %u, nid[2] = %u, depth = %d, err = %d",
477 		show_dev_ino(__entry),
478 		(unsigned int)__entry->nid[0],
479 		(unsigned int)__entry->nid[1],
480 		(unsigned int)__entry->nid[2],
481 		__entry->depth,
482 		__entry->err)
483 );
484 
485 TRACE_EVENT(f2fs_map_blocks,
486 	TP_PROTO(struct inode *inode, struct f2fs_map_blocks *map, int ret),
487 
488 	TP_ARGS(inode, map, ret),
489 
490 	TP_STRUCT__entry(
491 		__field(dev_t,	dev)
492 		__field(ino_t,	ino)
493 		__field(block_t,	m_lblk)
494 		__field(block_t,	m_pblk)
495 		__field(unsigned int,	m_len)
496 		__field(int,	ret)
497 	),
498 
499 	TP_fast_assign(
500 		__entry->dev		= inode->i_sb->s_dev;
501 		__entry->ino		= inode->i_ino;
502 		__entry->m_lblk		= map->m_lblk;
503 		__entry->m_pblk		= map->m_pblk;
504 		__entry->m_len		= map->m_len;
505 		__entry->ret		= ret;
506 	),
507 
508 	TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, "
509 		"start blkaddr = 0x%llx, len = 0x%llx, err = %d",
510 		show_dev_ino(__entry),
511 		(unsigned long long)__entry->m_lblk,
512 		(unsigned long long)__entry->m_pblk,
513 		(unsigned long long)__entry->m_len,
514 		__entry->ret)
515 );
516 
517 TRACE_EVENT(f2fs_get_victim,
518 
519 	TP_PROTO(struct super_block *sb, int type, int gc_type,
520 			struct victim_sel_policy *p, unsigned int pre_victim,
521 			unsigned int prefree, unsigned int free),
522 
523 	TP_ARGS(sb, type, gc_type, p, pre_victim, prefree, free),
524 
525 	TP_STRUCT__entry(
526 		__field(dev_t,	dev)
527 		__field(int,	type)
528 		__field(int,	gc_type)
529 		__field(int,	alloc_mode)
530 		__field(int,	gc_mode)
531 		__field(unsigned int,	victim)
532 		__field(unsigned int,	ofs_unit)
533 		__field(unsigned int,	pre_victim)
534 		__field(unsigned int,	prefree)
535 		__field(unsigned int,	free)
536 	),
537 
538 	TP_fast_assign(
539 		__entry->dev		= sb->s_dev;
540 		__entry->type		= type;
541 		__entry->gc_type	= gc_type;
542 		__entry->alloc_mode	= p->alloc_mode;
543 		__entry->gc_mode	= p->gc_mode;
544 		__entry->victim		= p->min_segno;
545 		__entry->ofs_unit	= p->ofs_unit;
546 		__entry->pre_victim	= pre_victim;
547 		__entry->prefree	= prefree;
548 		__entry->free		= free;
549 	),
550 
551 	TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), victim = %u "
552 		"ofs_unit = %u, pre_victim_secno = %d, prefree = %u, free = %u",
553 		show_dev(__entry),
554 		show_data_type(__entry->type),
555 		show_gc_type(__entry->gc_type),
556 		show_alloc_mode(__entry->alloc_mode),
557 		show_victim_policy(__entry->gc_mode),
558 		__entry->victim,
559 		__entry->ofs_unit,
560 		(int)__entry->pre_victim,
561 		__entry->prefree,
562 		__entry->free)
563 );
564 
565 TRACE_EVENT(f2fs_fallocate,
566 
567 	TP_PROTO(struct inode *inode, int mode,
568 				loff_t offset, loff_t len, int ret),
569 
570 	TP_ARGS(inode, mode, offset, len, ret),
571 
572 	TP_STRUCT__entry(
573 		__field(dev_t,	dev)
574 		__field(ino_t,	ino)
575 		__field(int,	mode)
576 		__field(loff_t,	offset)
577 		__field(loff_t,	len)
578 		__field(loff_t, size)
579 		__field(blkcnt_t, blocks)
580 		__field(int,	ret)
581 	),
582 
583 	TP_fast_assign(
584 		__entry->dev	= inode->i_sb->s_dev;
585 		__entry->ino	= inode->i_ino;
586 		__entry->mode	= mode;
587 		__entry->offset	= offset;
588 		__entry->len	= len;
589 		__entry->size	= inode->i_size;
590 		__entry->blocks = inode->i_blocks;
591 		__entry->ret	= ret;
592 	),
593 
594 	TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, "
595 		"len = %lld,  i_size = %lld, i_blocks = %llu, ret = %d",
596 		show_dev_ino(__entry),
597 		__entry->mode,
598 		(unsigned long long)__entry->offset,
599 		(unsigned long long)__entry->len,
600 		(unsigned long long)__entry->size,
601 		(unsigned long long)__entry->blocks,
602 		__entry->ret)
603 );
604 
605 TRACE_EVENT(f2fs_direct_IO_enter,
606 
607 	TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw),
608 
609 	TP_ARGS(inode, offset, len, rw),
610 
611 	TP_STRUCT__entry(
612 		__field(dev_t,	dev)
613 		__field(ino_t,	ino)
614 		__field(loff_t,	pos)
615 		__field(unsigned long,	len)
616 		__field(int,	rw)
617 	),
618 
619 	TP_fast_assign(
620 		__entry->dev	= inode->i_sb->s_dev;
621 		__entry->ino	= inode->i_ino;
622 		__entry->pos	= offset;
623 		__entry->len	= len;
624 		__entry->rw	= rw;
625 	),
626 
627 	TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu rw = %d",
628 		show_dev_ino(__entry),
629 		__entry->pos,
630 		__entry->len,
631 		__entry->rw)
632 );
633 
634 TRACE_EVENT(f2fs_direct_IO_exit,
635 
636 	TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
637 		 int rw, int ret),
638 
639 	TP_ARGS(inode, offset, len, rw, ret),
640 
641 	TP_STRUCT__entry(
642 		__field(dev_t,	dev)
643 		__field(ino_t,	ino)
644 		__field(loff_t,	pos)
645 		__field(unsigned long,	len)
646 		__field(int,	rw)
647 		__field(int,	ret)
648 	),
649 
650 	TP_fast_assign(
651 		__entry->dev	= inode->i_sb->s_dev;
652 		__entry->ino	= inode->i_ino;
653 		__entry->pos	= offset;
654 		__entry->len	= len;
655 		__entry->rw	= rw;
656 		__entry->ret	= ret;
657 	),
658 
659 	TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu "
660 		"rw = %d ret = %d",
661 		show_dev_ino(__entry),
662 		__entry->pos,
663 		__entry->len,
664 		__entry->rw,
665 		__entry->ret)
666 );
667 
668 TRACE_EVENT(f2fs_reserve_new_block,
669 
670 	TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs_in_node),
671 
672 	TP_ARGS(inode, nid, ofs_in_node),
673 
674 	TP_STRUCT__entry(
675 		__field(dev_t,	dev)
676 		__field(nid_t, nid)
677 		__field(unsigned int, ofs_in_node)
678 	),
679 
680 	TP_fast_assign(
681 		__entry->dev	= inode->i_sb->s_dev;
682 		__entry->nid	= nid;
683 		__entry->ofs_in_node = ofs_in_node;
684 	),
685 
686 	TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u",
687 		show_dev(__entry),
688 		(unsigned int)__entry->nid,
689 		__entry->ofs_in_node)
690 );
691 
692 DECLARE_EVENT_CLASS(f2fs__submit_page_bio,
693 
694 	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
695 
696 	TP_ARGS(page, fio),
697 
698 	TP_STRUCT__entry(
699 		__field(dev_t, dev)
700 		__field(ino_t, ino)
701 		__field(pgoff_t, index)
702 		__field(block_t, blkaddr)
703 		__field(int, rw)
704 		__field(int, type)
705 	),
706 
707 	TP_fast_assign(
708 		__entry->dev		= page->mapping->host->i_sb->s_dev;
709 		__entry->ino		= page->mapping->host->i_ino;
710 		__entry->index		= page->index;
711 		__entry->blkaddr	= fio->blk_addr;
712 		__entry->rw		= fio->rw;
713 		__entry->type		= fio->type;
714 	),
715 
716 	TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, "
717 		"blkaddr = 0x%llx, rw = %s%s, type = %s",
718 		show_dev_ino(__entry),
719 		(unsigned long)__entry->index,
720 		(unsigned long long)__entry->blkaddr,
721 		show_bio_type(__entry->rw),
722 		show_block_type(__entry->type))
723 );
724 
725 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_bio,
726 
727 	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
728 
729 	TP_ARGS(page, fio),
730 
731 	TP_CONDITION(page->mapping)
732 );
733 
734 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_mbio,
735 
736 	TP_PROTO(struct page *page, struct f2fs_io_info *fio),
737 
738 	TP_ARGS(page, fio),
739 
740 	TP_CONDITION(page->mapping)
741 );
742 
743 DECLARE_EVENT_CLASS(f2fs__submit_bio,
744 
745 	TP_PROTO(struct super_block *sb, struct f2fs_io_info *fio,
746 						struct bio *bio),
747 
748 	TP_ARGS(sb, fio, bio),
749 
750 	TP_STRUCT__entry(
751 		__field(dev_t,	dev)
752 		__field(int,	rw)
753 		__field(int,	type)
754 		__field(sector_t,	sector)
755 		__field(unsigned int,	size)
756 	),
757 
758 	TP_fast_assign(
759 		__entry->dev		= sb->s_dev;
760 		__entry->rw		= fio->rw;
761 		__entry->type		= fio->type;
762 		__entry->sector		= bio->bi_iter.bi_sector;
763 		__entry->size		= bio->bi_iter.bi_size;
764 	),
765 
766 	TP_printk("dev = (%d,%d), %s%s, %s, sector = %lld, size = %u",
767 		show_dev(__entry),
768 		show_bio_type(__entry->rw),
769 		show_block_type(__entry->type),
770 		(unsigned long long)__entry->sector,
771 		__entry->size)
772 );
773 
774 DEFINE_EVENT_CONDITION(f2fs__submit_bio, f2fs_submit_write_bio,
775 
776 	TP_PROTO(struct super_block *sb, struct f2fs_io_info *fio,
777 							struct bio *bio),
778 
779 	TP_ARGS(sb, fio, bio),
780 
781 	TP_CONDITION(bio)
782 );
783 
784 DEFINE_EVENT_CONDITION(f2fs__submit_bio, f2fs_submit_read_bio,
785 
786 	TP_PROTO(struct super_block *sb, struct f2fs_io_info *fio,
787 							struct bio *bio),
788 
789 	TP_ARGS(sb, fio, bio),
790 
791 	TP_CONDITION(bio)
792 );
793 
794 TRACE_EVENT(f2fs_write_begin,
795 
796 	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
797 				unsigned int flags),
798 
799 	TP_ARGS(inode, pos, len, flags),
800 
801 	TP_STRUCT__entry(
802 		__field(dev_t,	dev)
803 		__field(ino_t,	ino)
804 		__field(loff_t,	pos)
805 		__field(unsigned int, len)
806 		__field(unsigned int, flags)
807 	),
808 
809 	TP_fast_assign(
810 		__entry->dev	= inode->i_sb->s_dev;
811 		__entry->ino	= inode->i_ino;
812 		__entry->pos	= pos;
813 		__entry->len	= len;
814 		__entry->flags	= flags;
815 	),
816 
817 	TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u",
818 		show_dev_ino(__entry),
819 		(unsigned long long)__entry->pos,
820 		__entry->len,
821 		__entry->flags)
822 );
823 
824 TRACE_EVENT(f2fs_write_end,
825 
826 	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
827 				unsigned int copied),
828 
829 	TP_ARGS(inode, pos, len, copied),
830 
831 	TP_STRUCT__entry(
832 		__field(dev_t,	dev)
833 		__field(ino_t,	ino)
834 		__field(loff_t,	pos)
835 		__field(unsigned int, len)
836 		__field(unsigned int, copied)
837 	),
838 
839 	TP_fast_assign(
840 		__entry->dev	= inode->i_sb->s_dev;
841 		__entry->ino	= inode->i_ino;
842 		__entry->pos	= pos;
843 		__entry->len	= len;
844 		__entry->copied	= copied;
845 	),
846 
847 	TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u",
848 		show_dev_ino(__entry),
849 		(unsigned long long)__entry->pos,
850 		__entry->len,
851 		__entry->copied)
852 );
853 
854 DECLARE_EVENT_CLASS(f2fs__page,
855 
856 	TP_PROTO(struct page *page, int type),
857 
858 	TP_ARGS(page, type),
859 
860 	TP_STRUCT__entry(
861 		__field(dev_t,	dev)
862 		__field(ino_t,	ino)
863 		__field(int, type)
864 		__field(int, dir)
865 		__field(pgoff_t, index)
866 		__field(int, dirty)
867 		__field(int, uptodate)
868 	),
869 
870 	TP_fast_assign(
871 		__entry->dev	= page->mapping->host->i_sb->s_dev;
872 		__entry->ino	= page->mapping->host->i_ino;
873 		__entry->type	= type;
874 		__entry->dir	= S_ISDIR(page->mapping->host->i_mode);
875 		__entry->index	= page->index;
876 		__entry->dirty	= PageDirty(page);
877 		__entry->uptodate = PageUptodate(page);
878 	),
879 
880 	TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, "
881 		"dirty = %d, uptodate = %d",
882 		show_dev_ino(__entry),
883 		show_block_type(__entry->type),
884 		show_file_type(__entry->dir),
885 		(unsigned long)__entry->index,
886 		__entry->dirty,
887 		__entry->uptodate)
888 );
889 
890 DEFINE_EVENT(f2fs__page, f2fs_writepage,
891 
892 	TP_PROTO(struct page *page, int type),
893 
894 	TP_ARGS(page, type)
895 );
896 
897 DEFINE_EVENT(f2fs__page, f2fs_do_write_data_page,
898 
899 	TP_PROTO(struct page *page, int type),
900 
901 	TP_ARGS(page, type)
902 );
903 
904 DEFINE_EVENT(f2fs__page, f2fs_readpage,
905 
906 	TP_PROTO(struct page *page, int type),
907 
908 	TP_ARGS(page, type)
909 );
910 
911 DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty,
912 
913 	TP_PROTO(struct page *page, int type),
914 
915 	TP_ARGS(page, type)
916 );
917 
918 DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite,
919 
920 	TP_PROTO(struct page *page, int type),
921 
922 	TP_ARGS(page, type)
923 );
924 
925 DEFINE_EVENT(f2fs__page, f2fs_register_inmem_page,
926 
927 	TP_PROTO(struct page *page, int type),
928 
929 	TP_ARGS(page, type)
930 );
931 
932 DEFINE_EVENT(f2fs__page, f2fs_commit_inmem_page,
933 
934 	TP_PROTO(struct page *page, int type),
935 
936 	TP_ARGS(page, type)
937 );
938 
939 TRACE_EVENT(f2fs_writepages,
940 
941 	TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type),
942 
943 	TP_ARGS(inode, wbc, type),
944 
945 	TP_STRUCT__entry(
946 		__field(dev_t,	dev)
947 		__field(ino_t,	ino)
948 		__field(int,	type)
949 		__field(int,	dir)
950 		__field(long,	nr_to_write)
951 		__field(long,	pages_skipped)
952 		__field(loff_t,	range_start)
953 		__field(loff_t,	range_end)
954 		__field(pgoff_t, writeback_index)
955 		__field(int,	sync_mode)
956 		__field(char,	for_kupdate)
957 		__field(char,	for_background)
958 		__field(char,	tagged_writepages)
959 		__field(char,	for_reclaim)
960 		__field(char,	range_cyclic)
961 		__field(char,	for_sync)
962 	),
963 
964 	TP_fast_assign(
965 		__entry->dev		= inode->i_sb->s_dev;
966 		__entry->ino		= inode->i_ino;
967 		__entry->type		= type;
968 		__entry->dir		= S_ISDIR(inode->i_mode);
969 		__entry->nr_to_write	= wbc->nr_to_write;
970 		__entry->pages_skipped	= wbc->pages_skipped;
971 		__entry->range_start	= wbc->range_start;
972 		__entry->range_end	= wbc->range_end;
973 		__entry->writeback_index = inode->i_mapping->writeback_index;
974 		__entry->sync_mode	= wbc->sync_mode;
975 		__entry->for_kupdate	= wbc->for_kupdate;
976 		__entry->for_background	= wbc->for_background;
977 		__entry->tagged_writepages	= wbc->tagged_writepages;
978 		__entry->for_reclaim	= wbc->for_reclaim;
979 		__entry->range_cyclic	= wbc->range_cyclic;
980 		__entry->for_sync	= wbc->for_sync;
981 	),
982 
983 	TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
984 		"skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
985 		"kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
986 		show_dev_ino(__entry),
987 		show_block_type(__entry->type),
988 		show_file_type(__entry->dir),
989 		__entry->nr_to_write,
990 		__entry->pages_skipped,
991 		__entry->range_start,
992 		__entry->range_end,
993 		(unsigned long)__entry->writeback_index,
994 		__entry->sync_mode,
995 		__entry->for_kupdate,
996 		__entry->for_background,
997 		__entry->tagged_writepages,
998 		__entry->for_reclaim,
999 		__entry->range_cyclic,
1000 		__entry->for_sync)
1001 );
1002 
1003 TRACE_EVENT(f2fs_write_checkpoint,
1004 
1005 	TP_PROTO(struct super_block *sb, int reason, char *msg),
1006 
1007 	TP_ARGS(sb, reason, msg),
1008 
1009 	TP_STRUCT__entry(
1010 		__field(dev_t,	dev)
1011 		__field(int,	reason)
1012 		__field(char *,	msg)
1013 	),
1014 
1015 	TP_fast_assign(
1016 		__entry->dev		= sb->s_dev;
1017 		__entry->reason		= reason;
1018 		__entry->msg		= msg;
1019 	),
1020 
1021 	TP_printk("dev = (%d,%d), checkpoint for %s, state = %s",
1022 		show_dev(__entry),
1023 		show_cpreason(__entry->reason),
1024 		__entry->msg)
1025 );
1026 
1027 TRACE_EVENT(f2fs_issue_discard,
1028 
1029 	TP_PROTO(struct super_block *sb, block_t blkstart, block_t blklen),
1030 
1031 	TP_ARGS(sb, blkstart, blklen),
1032 
1033 	TP_STRUCT__entry(
1034 		__field(dev_t,	dev)
1035 		__field(block_t, blkstart)
1036 		__field(block_t, blklen)
1037 	),
1038 
1039 	TP_fast_assign(
1040 		__entry->dev	= sb->s_dev;
1041 		__entry->blkstart = blkstart;
1042 		__entry->blklen = blklen;
1043 	),
1044 
1045 	TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx",
1046 		show_dev(__entry),
1047 		(unsigned long long)__entry->blkstart,
1048 		(unsigned long long)__entry->blklen)
1049 );
1050 
1051 TRACE_EVENT(f2fs_issue_flush,
1052 
1053 	TP_PROTO(struct super_block *sb, unsigned int nobarrier,
1054 					unsigned int flush_merge),
1055 
1056 	TP_ARGS(sb, nobarrier, flush_merge),
1057 
1058 	TP_STRUCT__entry(
1059 		__field(dev_t,	dev)
1060 		__field(unsigned int, nobarrier)
1061 		__field(unsigned int, flush_merge)
1062 	),
1063 
1064 	TP_fast_assign(
1065 		__entry->dev	= sb->s_dev;
1066 		__entry->nobarrier = nobarrier;
1067 		__entry->flush_merge = flush_merge;
1068 	),
1069 
1070 	TP_printk("dev = (%d,%d), %s %s",
1071 		show_dev(__entry),
1072 		__entry->nobarrier ? "skip (nobarrier)" : "issue",
1073 		__entry->flush_merge ? " with flush_merge" : "")
1074 );
1075 
1076 TRACE_EVENT(f2fs_lookup_extent_tree_start,
1077 
1078 	TP_PROTO(struct inode *inode, unsigned int pgofs),
1079 
1080 	TP_ARGS(inode, pgofs),
1081 
1082 	TP_STRUCT__entry(
1083 		__field(dev_t,	dev)
1084 		__field(ino_t,	ino)
1085 		__field(unsigned int, pgofs)
1086 	),
1087 
1088 	TP_fast_assign(
1089 		__entry->dev = inode->i_sb->s_dev;
1090 		__entry->ino = inode->i_ino;
1091 		__entry->pgofs = pgofs;
1092 	),
1093 
1094 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u",
1095 		show_dev_ino(__entry),
1096 		__entry->pgofs)
1097 );
1098 
1099 TRACE_EVENT_CONDITION(f2fs_lookup_extent_tree_end,
1100 
1101 	TP_PROTO(struct inode *inode, unsigned int pgofs,
1102 						struct extent_info *ei),
1103 
1104 	TP_ARGS(inode, pgofs, ei),
1105 
1106 	TP_CONDITION(ei),
1107 
1108 	TP_STRUCT__entry(
1109 		__field(dev_t,	dev)
1110 		__field(ino_t,	ino)
1111 		__field(unsigned int, pgofs)
1112 		__field(unsigned int, fofs)
1113 		__field(u32, blk)
1114 		__field(unsigned int, len)
1115 	),
1116 
1117 	TP_fast_assign(
1118 		__entry->dev = inode->i_sb->s_dev;
1119 		__entry->ino = inode->i_ino;
1120 		__entry->pgofs = pgofs;
1121 		__entry->fofs = ei->fofs;
1122 		__entry->blk = ei->blk;
1123 		__entry->len = ei->len;
1124 	),
1125 
1126 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1127 		"ext_info(fofs: %u, blk: %u, len: %u)",
1128 		show_dev_ino(__entry),
1129 		__entry->pgofs,
1130 		__entry->fofs,
1131 		__entry->blk,
1132 		__entry->len)
1133 );
1134 
1135 TRACE_EVENT(f2fs_update_extent_tree,
1136 
1137 	TP_PROTO(struct inode *inode, unsigned int pgofs, block_t blkaddr),
1138 
1139 	TP_ARGS(inode, pgofs, blkaddr),
1140 
1141 	TP_STRUCT__entry(
1142 		__field(dev_t,	dev)
1143 		__field(ino_t,	ino)
1144 		__field(unsigned int, pgofs)
1145 		__field(u32, blk)
1146 	),
1147 
1148 	TP_fast_assign(
1149 		__entry->dev = inode->i_sb->s_dev;
1150 		__entry->ino = inode->i_ino;
1151 		__entry->pgofs = pgofs;
1152 		__entry->blk = blkaddr;
1153 	),
1154 
1155 	TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, blkaddr = %u",
1156 		show_dev_ino(__entry),
1157 		__entry->pgofs,
1158 		__entry->blk)
1159 );
1160 
1161 TRACE_EVENT(f2fs_shrink_extent_tree,
1162 
1163 	TP_PROTO(struct f2fs_sb_info *sbi, unsigned int node_cnt,
1164 						unsigned int tree_cnt),
1165 
1166 	TP_ARGS(sbi, node_cnt, tree_cnt),
1167 
1168 	TP_STRUCT__entry(
1169 		__field(dev_t,	dev)
1170 		__field(unsigned int, node_cnt)
1171 		__field(unsigned int, tree_cnt)
1172 	),
1173 
1174 	TP_fast_assign(
1175 		__entry->dev = sbi->sb->s_dev;
1176 		__entry->node_cnt = node_cnt;
1177 		__entry->tree_cnt = tree_cnt;
1178 	),
1179 
1180 	TP_printk("dev = (%d,%d), shrunk: node_cnt = %u, tree_cnt = %u",
1181 		show_dev(__entry),
1182 		__entry->node_cnt,
1183 		__entry->tree_cnt)
1184 );
1185 
1186 TRACE_EVENT(f2fs_destroy_extent_tree,
1187 
1188 	TP_PROTO(struct inode *inode, unsigned int node_cnt),
1189 
1190 	TP_ARGS(inode, node_cnt),
1191 
1192 	TP_STRUCT__entry(
1193 		__field(dev_t,	dev)
1194 		__field(ino_t,	ino)
1195 		__field(unsigned int, node_cnt)
1196 	),
1197 
1198 	TP_fast_assign(
1199 		__entry->dev = inode->i_sb->s_dev;
1200 		__entry->ino = inode->i_ino;
1201 		__entry->node_cnt = node_cnt;
1202 	),
1203 
1204 	TP_printk("dev = (%d,%d), ino = %lu, destroyed: node_cnt = %u",
1205 		show_dev_ino(__entry),
1206 		__entry->node_cnt)
1207 );
1208 
1209 #endif /* _TRACE_F2FS_H */
1210 
1211  /* This part must be outside protection */
1212 #include <trace/define_trace.h>
1213