blob: 66eaace9c07ee13375dc15e60ab817f6296b43ad [file] [log] [blame]
Namjae Jeona2a4a7e2013-04-20 01:28:40 +09001#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
Namjae Jeon6ec178d2013-04-23 17:51:43 +090011
12#define show_block_type(type) \
13 __print_symbolic(type, \
14 { NODE, "NODE" }, \
15 { DATA, "DATA" }, \
16 { META, "META" }, \
17 { META_FLUSH, "META_FLUSH" })
18
Jaegeuk Kima709f4a2013-11-24 14:42:23 +090019#define F2FS_BIO_MASK(t) (t & (READA | WRITE_FLUSH_FUA))
20#define F2FS_BIO_EXTRA_MASK(t) (t & (REQ_META | REQ_PRIO))
21
22#define show_bio_type(type) show_bio_base(type), show_bio_extra(type)
23
24#define show_bio_base(type) \
25 __print_symbolic(F2FS_BIO_MASK(type), \
Chao Yud4d288b2013-11-24 12:36:42 +090026 { READ, "READ" }, \
27 { READA, "READAHEAD" }, \
28 { READ_SYNC, "READ_SYNC" }, \
29 { WRITE, "WRITE" }, \
30 { WRITE_SYNC, "WRITE_SYNC" }, \
31 { WRITE_FLUSH, "WRITE_FLUSH" }, \
32 { WRITE_FUA, "WRITE_FUA" }, \
33 { WRITE_FLUSH_FUA, "WRITE_FLUSH_FUA" })
Namjae Jeona2a4a7e2013-04-20 01:28:40 +090034
Jaegeuk Kima709f4a2013-11-24 14:42:23 +090035#define show_bio_extra(type) \
36 __print_symbolic(F2FS_BIO_EXTRA_MASK(type), \
37 { REQ_META, "(M)" }, \
38 { REQ_PRIO, "(P)" }, \
39 { REQ_META | REQ_PRIO, "(MP)" }, \
40 { 0, " \b" })
41
Namjae Jeon8e46b3e2013-04-23 16:42:53 +090042#define show_data_type(type) \
43 __print_symbolic(type, \
44 { CURSEG_HOT_DATA, "Hot DATA" }, \
45 { CURSEG_WARM_DATA, "Warm DATA" }, \
46 { CURSEG_COLD_DATA, "Cold DATA" }, \
47 { CURSEG_HOT_NODE, "Hot NODE" }, \
48 { CURSEG_WARM_NODE, "Warm NODE" }, \
49 { CURSEG_COLD_NODE, "Cold NODE" }, \
50 { NO_CHECK_TYPE, "No TYPE" })
51
Jaegeuk Kim26c6b882013-10-24 17:53:29 +090052#define show_file_type(type) \
53 __print_symbolic(type, \
54 { 0, "FILE" }, \
55 { 1, "DIR" })
56
Namjae Jeon8e46b3e2013-04-23 16:42:53 +090057#define show_gc_type(type) \
58 __print_symbolic(type, \
59 { FG_GC, "Foreground GC" }, \
60 { BG_GC, "Background GC" })
61
62#define show_alloc_mode(type) \
63 __print_symbolic(type, \
64 { LFS, "LFS-mode" }, \
65 { SSR, "SSR-mode" })
66
67#define show_victim_policy(type) \
68 __print_symbolic(type, \
69 { GC_GREEDY, "Greedy" }, \
70 { GC_CB, "Cost-Benefit" })
71
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -070072#define show_cpreason(type) \
73 __print_symbolic(type, \
74 { CP_UMOUNT, "Umount" }, \
75 { CP_SYNC, "Sync" })
76
Namjae Jeon8e46b3e2013-04-23 16:42:53 +090077struct victim_sel_policy;
78
Namjae Jeona2a4a7e2013-04-20 01:28:40 +090079DECLARE_EVENT_CLASS(f2fs__inode,
80
81 TP_PROTO(struct inode *inode),
82
83 TP_ARGS(inode),
84
85 TP_STRUCT__entry(
86 __field(dev_t, dev)
87 __field(ino_t, ino)
88 __field(ino_t, pino)
89 __field(umode_t, mode)
90 __field(loff_t, size)
91 __field(unsigned int, nlink)
92 __field(blkcnt_t, blocks)
93 __field(__u8, advise)
94 ),
95
96 TP_fast_assign(
97 __entry->dev = inode->i_sb->s_dev;
98 __entry->ino = inode->i_ino;
99 __entry->pino = F2FS_I(inode)->i_pino;
100 __entry->mode = inode->i_mode;
101 __entry->nlink = inode->i_nlink;
102 __entry->size = inode->i_size;
103 __entry->blocks = inode->i_blocks;
104 __entry->advise = F2FS_I(inode)->i_advise;
105 ),
106
107 TP_printk("dev = (%d,%d), ino = %lu, pino = %lu, i_mode = 0x%hx, "
108 "i_size = %lld, i_nlink = %u, i_blocks = %llu, i_advise = 0x%x",
109 show_dev_ino(__entry),
110 (unsigned long)__entry->pino,
111 __entry->mode,
112 __entry->size,
113 (unsigned int)__entry->nlink,
114 (unsigned long long)__entry->blocks,
115 (unsigned char)__entry->advise)
116);
117
118DECLARE_EVENT_CLASS(f2fs__inode_exit,
119
120 TP_PROTO(struct inode *inode, int ret),
121
122 TP_ARGS(inode, ret),
123
124 TP_STRUCT__entry(
125 __field(dev_t, dev)
126 __field(ino_t, ino)
127 __field(int, ret)
128 ),
129
130 TP_fast_assign(
131 __entry->dev = inode->i_sb->s_dev;
132 __entry->ino = inode->i_ino;
133 __entry->ret = ret;
134 ),
135
136 TP_printk("dev = (%d,%d), ino = %lu, ret = %d",
137 show_dev_ino(__entry),
138 __entry->ret)
139);
140
141DEFINE_EVENT(f2fs__inode, f2fs_sync_file_enter,
142
143 TP_PROTO(struct inode *inode),
144
145 TP_ARGS(inode)
146);
147
148TRACE_EVENT(f2fs_sync_file_exit,
149
150 TP_PROTO(struct inode *inode, bool need_cp, int datasync, int ret),
151
152 TP_ARGS(inode, need_cp, datasync, ret),
153
154 TP_STRUCT__entry(
155 __field(dev_t, dev)
156 __field(ino_t, ino)
157 __field(bool, need_cp)
158 __field(int, datasync)
159 __field(int, ret)
160 ),
161
162 TP_fast_assign(
163 __entry->dev = inode->i_sb->s_dev;
164 __entry->ino = inode->i_ino;
165 __entry->need_cp = need_cp;
166 __entry->datasync = datasync;
167 __entry->ret = ret;
168 ),
169
170 TP_printk("dev = (%d,%d), ino = %lu, checkpoint is %s, "
171 "datasync = %d, ret = %d",
172 show_dev_ino(__entry),
173 __entry->need_cp ? "needed" : "not needed",
174 __entry->datasync,
175 __entry->ret)
176);
177
178TRACE_EVENT(f2fs_sync_fs,
179
180 TP_PROTO(struct super_block *sb, int wait),
181
182 TP_ARGS(sb, wait),
183
184 TP_STRUCT__entry(
185 __field(dev_t, dev)
186 __field(int, dirty)
187 __field(int, wait)
188 ),
189
190 TP_fast_assign(
191 __entry->dev = sb->s_dev;
192 __entry->dirty = F2FS_SB(sb)->s_dirty;
193 __entry->wait = wait;
194 ),
195
196 TP_printk("dev = (%d,%d), superblock is %s, wait = %d",
197 show_dev(__entry),
198 __entry->dirty ? "dirty" : "not dirty",
199 __entry->wait)
200);
201
202DEFINE_EVENT(f2fs__inode, f2fs_iget,
203
204 TP_PROTO(struct inode *inode),
205
206 TP_ARGS(inode)
207);
208
209DEFINE_EVENT(f2fs__inode_exit, f2fs_iget_exit,
210
211 TP_PROTO(struct inode *inode, int ret),
212
213 TP_ARGS(inode, ret)
214);
215
216DEFINE_EVENT(f2fs__inode, f2fs_evict_inode,
217
218 TP_PROTO(struct inode *inode),
219
220 TP_ARGS(inode)
221);
222
Jaegeuk Kimd70b4f52013-04-25 13:24:33 +0900223DEFINE_EVENT(f2fs__inode_exit, f2fs_new_inode,
224
225 TP_PROTO(struct inode *inode, int ret),
226
227 TP_ARGS(inode, ret)
228);
229
Namjae Jeona2a4a7e2013-04-20 01:28:40 +0900230TRACE_EVENT(f2fs_unlink_enter,
231
232 TP_PROTO(struct inode *dir, struct dentry *dentry),
233
234 TP_ARGS(dir, dentry),
235
236 TP_STRUCT__entry(
237 __field(dev_t, dev)
238 __field(ino_t, ino)
239 __field(loff_t, size)
240 __field(blkcnt_t, blocks)
241 __field(const char *, name)
242 ),
243
244 TP_fast_assign(
245 __entry->dev = dir->i_sb->s_dev;
246 __entry->ino = dir->i_ino;
247 __entry->size = dir->i_size;
248 __entry->blocks = dir->i_blocks;
249 __entry->name = dentry->d_name.name;
250 ),
251
252 TP_printk("dev = (%d,%d), dir ino = %lu, i_size = %lld, "
253 "i_blocks = %llu, name = %s",
254 show_dev_ino(__entry),
255 __entry->size,
256 (unsigned long long)__entry->blocks,
257 __entry->name)
258);
259
260DEFINE_EVENT(f2fs__inode_exit, f2fs_unlink_exit,
261
262 TP_PROTO(struct inode *inode, int ret),
263
264 TP_ARGS(inode, ret)
265);
Namjae Jeon51dd6242013-04-20 01:28:52 +0900266
267DEFINE_EVENT(f2fs__inode, f2fs_truncate,
268
269 TP_PROTO(struct inode *inode),
270
271 TP_ARGS(inode)
272);
273
274TRACE_EVENT(f2fs_truncate_data_blocks_range,
275
276 TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs, int free),
277
278 TP_ARGS(inode, nid, ofs, free),
279
280 TP_STRUCT__entry(
281 __field(dev_t, dev)
282 __field(ino_t, ino)
283 __field(nid_t, nid)
284 __field(unsigned int, ofs)
285 __field(int, free)
286 ),
287
288 TP_fast_assign(
289 __entry->dev = inode->i_sb->s_dev;
290 __entry->ino = inode->i_ino;
291 __entry->nid = nid;
292 __entry->ofs = ofs;
293 __entry->free = free;
294 ),
295
296 TP_printk("dev = (%d,%d), ino = %lu, nid = %u, offset = %u, freed = %d",
297 show_dev_ino(__entry),
298 (unsigned int)__entry->nid,
299 __entry->ofs,
300 __entry->free)
301);
302
303DECLARE_EVENT_CLASS(f2fs__truncate_op,
304
305 TP_PROTO(struct inode *inode, u64 from),
306
307 TP_ARGS(inode, from),
308
309 TP_STRUCT__entry(
310 __field(dev_t, dev)
311 __field(ino_t, ino)
312 __field(loff_t, size)
313 __field(blkcnt_t, blocks)
314 __field(u64, from)
315 ),
316
317 TP_fast_assign(
318 __entry->dev = inode->i_sb->s_dev;
319 __entry->ino = inode->i_ino;
320 __entry->size = inode->i_size;
321 __entry->blocks = inode->i_blocks;
322 __entry->from = from;
323 ),
324
325 TP_printk("dev = (%d,%d), ino = %lu, i_size = %lld, i_blocks = %llu, "
326 "start file offset = %llu",
327 show_dev_ino(__entry),
328 __entry->size,
329 (unsigned long long)__entry->blocks,
330 (unsigned long long)__entry->from)
331);
332
333DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_blocks_enter,
334
335 TP_PROTO(struct inode *inode, u64 from),
336
337 TP_ARGS(inode, from)
338);
339
340DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_blocks_exit,
341
342 TP_PROTO(struct inode *inode, int ret),
343
344 TP_ARGS(inode, ret)
345);
346
347DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_inode_blocks_enter,
348
349 TP_PROTO(struct inode *inode, u64 from),
350
351 TP_ARGS(inode, from)
352);
353
354DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_inode_blocks_exit,
355
356 TP_PROTO(struct inode *inode, int ret),
357
358 TP_ARGS(inode, ret)
359);
360
361DECLARE_EVENT_CLASS(f2fs__truncate_node,
362
363 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
364
365 TP_ARGS(inode, nid, blk_addr),
366
367 TP_STRUCT__entry(
368 __field(dev_t, dev)
369 __field(ino_t, ino)
370 __field(nid_t, nid)
371 __field(block_t, blk_addr)
372 ),
373
374 TP_fast_assign(
375 __entry->dev = inode->i_sb->s_dev;
376 __entry->ino = inode->i_ino;
377 __entry->nid = nid;
378 __entry->blk_addr = blk_addr;
379 ),
380
381 TP_printk("dev = (%d,%d), ino = %lu, nid = %u, block_address = 0x%llx",
382 show_dev_ino(__entry),
383 (unsigned int)__entry->nid,
384 (unsigned long long)__entry->blk_addr)
385);
386
387DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_nodes_enter,
388
389 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
390
391 TP_ARGS(inode, nid, blk_addr)
392);
393
394DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_nodes_exit,
395
396 TP_PROTO(struct inode *inode, int ret),
397
398 TP_ARGS(inode, ret)
399);
400
401DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_node,
402
403 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
404
405 TP_ARGS(inode, nid, blk_addr)
406);
407
408TRACE_EVENT(f2fs_truncate_partial_nodes,
409
410 TP_PROTO(struct inode *inode, nid_t nid[], int depth, int err),
411
412 TP_ARGS(inode, nid, depth, err),
413
414 TP_STRUCT__entry(
415 __field(dev_t, dev)
416 __field(ino_t, ino)
417 __field(nid_t, nid[3])
418 __field(int, depth)
419 __field(int, err)
420 ),
421
422 TP_fast_assign(
423 __entry->dev = inode->i_sb->s_dev;
424 __entry->ino = inode->i_ino;
425 __entry->nid[0] = nid[0];
426 __entry->nid[1] = nid[1];
427 __entry->nid[2] = nid[2];
428 __entry->depth = depth;
429 __entry->err = err;
430 ),
431
432 TP_printk("dev = (%d,%d), ino = %lu, "
433 "nid[0] = %u, nid[1] = %u, nid[2] = %u, depth = %d, err = %d",
434 show_dev_ino(__entry),
435 (unsigned int)__entry->nid[0],
436 (unsigned int)__entry->nid[1],
437 (unsigned int)__entry->nid[2],
438 __entry->depth,
439 __entry->err)
440);
441
Jaegeuk Kim93dfe2a2013-11-30 12:51:14 +0900442TRACE_EVENT_CONDITION(f2fs_submit_page_bio,
Namjae Jeon848753a2013-04-23 16:38:02 +0900443
444 TP_PROTO(struct page *page, sector_t blkaddr, int type),
445
446 TP_ARGS(page, blkaddr, type),
447
448 TP_CONDITION(page->mapping),
449
450 TP_STRUCT__entry(
451 __field(dev_t, dev)
452 __field(ino_t, ino)
453 __field(pgoff_t, index)
454 __field(sector_t, blkaddr)
455 __field(int, type)
456 ),
457
458 TP_fast_assign(
459 __entry->dev = page->mapping->host->i_sb->s_dev;
460 __entry->ino = page->mapping->host->i_ino;
461 __entry->index = page->index;
462 __entry->blkaddr = blkaddr;
463 __entry->type = type;
464 ),
465
466 TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, "
Jaegeuk Kima709f4a2013-11-24 14:42:23 +0900467 "blkaddr = 0x%llx, bio_type = %s%s",
Namjae Jeon848753a2013-04-23 16:38:02 +0900468 show_dev_ino(__entry),
469 (unsigned long)__entry->index,
470 (unsigned long long)__entry->blkaddr,
471 show_bio_type(__entry->type))
472);
473
474TRACE_EVENT(f2fs_get_data_block,
475 TP_PROTO(struct inode *inode, sector_t iblock,
476 struct buffer_head *bh, int ret),
477
478 TP_ARGS(inode, iblock, bh, ret),
479
480 TP_STRUCT__entry(
481 __field(dev_t, dev)
482 __field(ino_t, ino)
483 __field(sector_t, iblock)
484 __field(sector_t, bh_start)
485 __field(size_t, bh_size)
486 __field(int, ret)
487 ),
488
489 TP_fast_assign(
490 __entry->dev = inode->i_sb->s_dev;
491 __entry->ino = inode->i_ino;
492 __entry->iblock = iblock;
493 __entry->bh_start = bh->b_blocknr;
494 __entry->bh_size = bh->b_size;
495 __entry->ret = ret;
496 ),
497
498 TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, "
499 "start blkaddr = 0x%llx, len = 0x%llx bytes, err = %d",
500 show_dev_ino(__entry),
501 (unsigned long long)__entry->iblock,
502 (unsigned long long)__entry->bh_start,
503 (unsigned long long)__entry->bh_size,
504 __entry->ret)
505);
506
Namjae Jeon8e46b3e2013-04-23 16:42:53 +0900507TRACE_EVENT(f2fs_get_victim,
508
509 TP_PROTO(struct super_block *sb, int type, int gc_type,
510 struct victim_sel_policy *p, unsigned int pre_victim,
511 unsigned int prefree, unsigned int free),
512
513 TP_ARGS(sb, type, gc_type, p, pre_victim, prefree, free),
514
515 TP_STRUCT__entry(
516 __field(dev_t, dev)
517 __field(int, type)
518 __field(int, gc_type)
519 __field(int, alloc_mode)
520 __field(int, gc_mode)
521 __field(unsigned int, victim)
522 __field(unsigned int, ofs_unit)
523 __field(unsigned int, pre_victim)
524 __field(unsigned int, prefree)
525 __field(unsigned int, free)
526 ),
527
528 TP_fast_assign(
529 __entry->dev = sb->s_dev;
530 __entry->type = type;
531 __entry->gc_type = gc_type;
532 __entry->alloc_mode = p->alloc_mode;
533 __entry->gc_mode = p->gc_mode;
534 __entry->victim = p->min_segno;
535 __entry->ofs_unit = p->ofs_unit;
536 __entry->pre_victim = pre_victim;
537 __entry->prefree = prefree;
538 __entry->free = free;
539 ),
540
541 TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), victim = %u "
542 "ofs_unit = %u, pre_victim_secno = %d, prefree = %u, free = %u",
543 show_dev(__entry),
544 show_data_type(__entry->type),
545 show_gc_type(__entry->gc_type),
546 show_alloc_mode(__entry->alloc_mode),
547 show_victim_policy(__entry->gc_mode),
548 __entry->victim,
549 __entry->ofs_unit,
550 (int)__entry->pre_victim,
551 __entry->prefree,
552 __entry->free)
553);
554
Namjae Jeonc01e2852013-04-23 17:00:52 +0900555TRACE_EVENT(f2fs_fallocate,
556
557 TP_PROTO(struct inode *inode, int mode,
558 loff_t offset, loff_t len, int ret),
559
560 TP_ARGS(inode, mode, offset, len, ret),
561
562 TP_STRUCT__entry(
563 __field(dev_t, dev)
564 __field(ino_t, ino)
565 __field(int, mode)
566 __field(loff_t, offset)
567 __field(loff_t, len)
568 __field(loff_t, size)
569 __field(blkcnt_t, blocks)
570 __field(int, ret)
571 ),
572
573 TP_fast_assign(
574 __entry->dev = inode->i_sb->s_dev;
575 __entry->ino = inode->i_ino;
576 __entry->mode = mode;
577 __entry->offset = offset;
578 __entry->len = len;
579 __entry->size = inode->i_size;
580 __entry->blocks = inode->i_blocks;
581 __entry->ret = ret;
582 ),
583
584 TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, "
585 "len = %lld, i_size = %lld, i_blocks = %llu, ret = %d",
586 show_dev_ino(__entry),
587 __entry->mode,
588 (unsigned long long)__entry->offset,
589 (unsigned long long)__entry->len,
590 (unsigned long long)__entry->size,
591 (unsigned long long)__entry->blocks,
592 __entry->ret)
593);
594
Chao Yu70407fa2014-07-31 21:11:22 +0800595TRACE_EVENT(f2fs_direct_IO_enter,
596
597 TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw),
598
599 TP_ARGS(inode, offset, len, rw),
600
601 TP_STRUCT__entry(
602 __field(dev_t, dev)
603 __field(ino_t, ino)
604 __field(loff_t, pos)
605 __field(unsigned long, len)
606 __field(int, rw)
607 ),
608
609 TP_fast_assign(
610 __entry->dev = inode->i_sb->s_dev;
611 __entry->ino = inode->i_ino;
612 __entry->pos = offset;
613 __entry->len = len;
614 __entry->rw = rw;
615 ),
616
617 TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu rw = %d",
618 show_dev_ino(__entry),
619 __entry->pos,
620 __entry->len,
621 __entry->rw)
622);
623
624TRACE_EVENT(f2fs_direct_IO_exit,
625
626 TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
627 int rw, int ret),
628
629 TP_ARGS(inode, offset, len, rw, ret),
630
631 TP_STRUCT__entry(
632 __field(dev_t, dev)
633 __field(ino_t, ino)
634 __field(loff_t, pos)
635 __field(unsigned long, len)
636 __field(int, rw)
637 __field(int, ret)
638 ),
639
640 TP_fast_assign(
641 __entry->dev = inode->i_sb->s_dev;
642 __entry->ino = inode->i_ino;
643 __entry->pos = offset;
644 __entry->len = len;
645 __entry->rw = rw;
646 __entry->ret = ret;
647 ),
648
649 TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu "
650 "rw = %d ret = %d",
651 show_dev_ino(__entry),
652 __entry->pos,
653 __entry->len,
654 __entry->rw,
655 __entry->ret)
656);
657
Namjae Jeonc01e2852013-04-23 17:00:52 +0900658TRACE_EVENT(f2fs_reserve_new_block,
659
660 TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs_in_node),
661
662 TP_ARGS(inode, nid, ofs_in_node),
663
664 TP_STRUCT__entry(
665 __field(dev_t, dev)
666 __field(nid_t, nid)
667 __field(unsigned int, ofs_in_node)
668 ),
669
670 TP_fast_assign(
671 __entry->dev = inode->i_sb->s_dev;
672 __entry->nid = nid;
673 __entry->ofs_in_node = ofs_in_node;
674 ),
675
676 TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u",
677 show_dev(__entry),
678 (unsigned int)__entry->nid,
679 __entry->ofs_in_node)
680);
681
Chao Yud4d288b2013-11-24 12:36:42 +0900682DECLARE_EVENT_CLASS(f2fs__submit_bio,
Namjae Jeon6ec178d2013-04-23 17:51:43 +0900683
Chao Yud4d288b2013-11-24 12:36:42 +0900684 TP_PROTO(struct super_block *sb, int rw, int type, struct bio *bio),
Namjae Jeon6ec178d2013-04-23 17:51:43 +0900685
Chao Yud4d288b2013-11-24 12:36:42 +0900686 TP_ARGS(sb, rw, type, bio),
Namjae Jeon6ec178d2013-04-23 17:51:43 +0900687
688 TP_STRUCT__entry(
689 __field(dev_t, dev)
Chao Yud4d288b2013-11-24 12:36:42 +0900690 __field(int, rw)
691 __field(int, type)
Namjae Jeon6ec178d2013-04-23 17:51:43 +0900692 __field(sector_t, sector)
693 __field(unsigned int, size)
694 ),
695
696 TP_fast_assign(
697 __entry->dev = sb->s_dev;
Chao Yud4d288b2013-11-24 12:36:42 +0900698 __entry->rw = rw;
699 __entry->type = type;
Kent Overstreet4f024f32013-10-11 15:44:27 -0700700 __entry->sector = bio->bi_iter.bi_sector;
701 __entry->size = bio->bi_iter.bi_size;
Namjae Jeon6ec178d2013-04-23 17:51:43 +0900702 ),
703
Jaegeuk Kima709f4a2013-11-24 14:42:23 +0900704 TP_printk("dev = (%d,%d), %s%s, %s, sector = %lld, size = %u",
Namjae Jeon6ec178d2013-04-23 17:51:43 +0900705 show_dev(__entry),
Chao Yud4d288b2013-11-24 12:36:42 +0900706 show_bio_type(__entry->rw),
707 show_block_type(__entry->type),
Namjae Jeon6ec178d2013-04-23 17:51:43 +0900708 (unsigned long long)__entry->sector,
709 __entry->size)
710);
711
Jaegeuk Kim93dfe2a2013-11-30 12:51:14 +0900712DEFINE_EVENT_CONDITION(f2fs__submit_bio, f2fs_submit_write_bio,
Chao Yud4d288b2013-11-24 12:36:42 +0900713
714 TP_PROTO(struct super_block *sb, int rw, int type, struct bio *bio),
715
Jaegeuk Kim93dfe2a2013-11-30 12:51:14 +0900716 TP_ARGS(sb, rw, type, bio),
717
718 TP_CONDITION(bio)
Chao Yud4d288b2013-11-24 12:36:42 +0900719);
720
Jaegeuk Kim93dfe2a2013-11-30 12:51:14 +0900721DEFINE_EVENT_CONDITION(f2fs__submit_bio, f2fs_submit_read_bio,
Chao Yud4d288b2013-11-24 12:36:42 +0900722
723 TP_PROTO(struct super_block *sb, int rw, int type, struct bio *bio),
724
Jaegeuk Kim93dfe2a2013-11-30 12:51:14 +0900725 TP_ARGS(sb, rw, type, bio),
726
727 TP_CONDITION(bio)
Chao Yud4d288b2013-11-24 12:36:42 +0900728);
729
Chao Yu62aed042014-05-06 16:46:04 +0800730TRACE_EVENT(f2fs_write_begin,
731
732 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
733 unsigned int flags),
734
735 TP_ARGS(inode, pos, len, flags),
736
737 TP_STRUCT__entry(
738 __field(dev_t, dev)
739 __field(ino_t, ino)
740 __field(loff_t, pos)
741 __field(unsigned int, len)
742 __field(unsigned int, flags)
743 ),
744
745 TP_fast_assign(
746 __entry->dev = inode->i_sb->s_dev;
747 __entry->ino = inode->i_ino;
748 __entry->pos = pos;
749 __entry->len = len;
750 __entry->flags = flags;
751 ),
752
753 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u",
754 show_dev_ino(__entry),
755 (unsigned long long)__entry->pos,
756 __entry->len,
757 __entry->flags)
758);
759
Chao Yudfb2bf32014-05-06 16:47:23 +0800760TRACE_EVENT(f2fs_write_end,
761
762 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
763 unsigned int copied),
764
765 TP_ARGS(inode, pos, len, copied),
766
767 TP_STRUCT__entry(
768 __field(dev_t, dev)
769 __field(ino_t, ino)
770 __field(loff_t, pos)
771 __field(unsigned int, len)
772 __field(unsigned int, copied)
773 ),
774
775 TP_fast_assign(
776 __entry->dev = inode->i_sb->s_dev;
777 __entry->ino = inode->i_ino;
778 __entry->pos = pos;
779 __entry->len = len;
780 __entry->copied = copied;
781 ),
782
783 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u",
784 show_dev_ino(__entry),
785 (unsigned long long)__entry->pos,
786 __entry->len,
787 __entry->copied)
788);
789
Jaegeuk Kim26c6b882013-10-24 17:53:29 +0900790DECLARE_EVENT_CLASS(f2fs__page,
791
792 TP_PROTO(struct page *page, int type),
793
794 TP_ARGS(page, type),
795
796 TP_STRUCT__entry(
797 __field(dev_t, dev)
798 __field(ino_t, ino)
799 __field(int, type)
800 __field(int, dir)
801 __field(pgoff_t, index)
802 __field(int, dirty)
Chao Yuc20e89c2014-05-06 16:53:08 +0800803 __field(int, uptodate)
Jaegeuk Kim26c6b882013-10-24 17:53:29 +0900804 ),
805
806 TP_fast_assign(
807 __entry->dev = page->mapping->host->i_sb->s_dev;
808 __entry->ino = page->mapping->host->i_ino;
809 __entry->type = type;
810 __entry->dir = S_ISDIR(page->mapping->host->i_mode);
811 __entry->index = page->index;
812 __entry->dirty = PageDirty(page);
Chao Yuc20e89c2014-05-06 16:53:08 +0800813 __entry->uptodate = PageUptodate(page);
Jaegeuk Kim26c6b882013-10-24 17:53:29 +0900814 ),
815
Chao Yuc20e89c2014-05-06 16:53:08 +0800816 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, "
817 "dirty = %d, uptodate = %d",
Jaegeuk Kim26c6b882013-10-24 17:53:29 +0900818 show_dev_ino(__entry),
819 show_block_type(__entry->type),
820 show_file_type(__entry->dir),
821 (unsigned long)__entry->index,
Chao Yuc20e89c2014-05-06 16:53:08 +0800822 __entry->dirty,
823 __entry->uptodate)
Jaegeuk Kim26c6b882013-10-24 17:53:29 +0900824);
825
Chao Yuecda0de2014-05-06 16:48:26 +0800826DEFINE_EVENT(f2fs__page, f2fs_writepage,
827
828 TP_PROTO(struct page *page, int type),
829
830 TP_ARGS(page, type)
831);
832
Chao Yuc20e89c2014-05-06 16:53:08 +0800833DEFINE_EVENT(f2fs__page, f2fs_readpage,
834
835 TP_PROTO(struct page *page, int type),
836
837 TP_ARGS(page, type)
838);
839
Jaegeuk Kim26c6b882013-10-24 17:53:29 +0900840DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty,
841
842 TP_PROTO(struct page *page, int type),
843
844 TP_ARGS(page, type)
845);
846
Jaegeuk Kime943a102013-10-25 14:26:31 +0900847DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite,
848
849 TP_PROTO(struct page *page, int type),
850
851 TP_ARGS(page, type)
852);
853
Chao Yue5748432014-05-06 16:51:24 +0800854TRACE_EVENT(f2fs_writepages,
855
856 TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type),
857
858 TP_ARGS(inode, wbc, 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(long, nr_to_write)
866 __field(long, pages_skipped)
867 __field(loff_t, range_start)
868 __field(loff_t, range_end)
869 __field(pgoff_t, writeback_index)
870 __field(int, sync_mode)
871 __field(char, for_kupdate)
872 __field(char, for_background)
873 __field(char, tagged_writepages)
874 __field(char, for_reclaim)
875 __field(char, range_cyclic)
876 __field(char, for_sync)
877 ),
878
879 TP_fast_assign(
880 __entry->dev = inode->i_sb->s_dev;
881 __entry->ino = inode->i_ino;
882 __entry->type = type;
883 __entry->dir = S_ISDIR(inode->i_mode);
884 __entry->nr_to_write = wbc->nr_to_write;
885 __entry->pages_skipped = wbc->pages_skipped;
886 __entry->range_start = wbc->range_start;
887 __entry->range_end = wbc->range_end;
888 __entry->writeback_index = inode->i_mapping->writeback_index;
889 __entry->sync_mode = wbc->sync_mode;
890 __entry->for_kupdate = wbc->for_kupdate;
891 __entry->for_background = wbc->for_background;
892 __entry->tagged_writepages = wbc->tagged_writepages;
893 __entry->for_reclaim = wbc->for_reclaim;
894 __entry->range_cyclic = wbc->range_cyclic;
895 __entry->for_sync = wbc->for_sync;
896 ),
897
898 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
899 "skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
900 "kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
901 show_dev_ino(__entry),
902 show_block_type(__entry->type),
903 show_file_type(__entry->dir),
904 __entry->nr_to_write,
905 __entry->pages_skipped,
906 __entry->range_start,
907 __entry->range_end,
908 (unsigned long)__entry->writeback_index,
909 __entry->sync_mode,
910 __entry->for_kupdate,
911 __entry->for_background,
912 __entry->tagged_writepages,
913 __entry->for_reclaim,
914 __entry->range_cyclic,
915 __entry->for_sync)
916);
917
Jaegeuk Kim93dfe2a2013-11-30 12:51:14 +0900918TRACE_EVENT(f2fs_submit_page_mbio,
Namjae Jeon6ec178d2013-04-23 17:51:43 +0900919
Chao Yu87b88722013-11-20 16:40:10 +0800920 TP_PROTO(struct page *page, int rw, int type, block_t blk_addr),
Namjae Jeon6ec178d2013-04-23 17:51:43 +0900921
Chao Yu87b88722013-11-20 16:40:10 +0800922 TP_ARGS(page, rw, type, blk_addr),
Namjae Jeon6ec178d2013-04-23 17:51:43 +0900923
924 TP_STRUCT__entry(
925 __field(dev_t, dev)
926 __field(ino_t, ino)
Chao Yu87b88722013-11-20 16:40:10 +0800927 __field(int, rw)
Namjae Jeon6ec178d2013-04-23 17:51:43 +0900928 __field(int, type)
929 __field(pgoff_t, index)
930 __field(block_t, block)
931 ),
932
933 TP_fast_assign(
934 __entry->dev = page->mapping->host->i_sb->s_dev;
935 __entry->ino = page->mapping->host->i_ino;
Chao Yu87b88722013-11-20 16:40:10 +0800936 __entry->rw = rw;
Namjae Jeon6ec178d2013-04-23 17:51:43 +0900937 __entry->type = type;
938 __entry->index = page->index;
939 __entry->block = blk_addr;
940 ),
941
Jaegeuk Kima709f4a2013-11-24 14:42:23 +0900942 TP_printk("dev = (%d,%d), ino = %lu, %s%s, %s, index = %lu, blkaddr = 0x%llx",
Namjae Jeon6ec178d2013-04-23 17:51:43 +0900943 show_dev_ino(__entry),
Chao Yu87b88722013-11-20 16:40:10 +0800944 show_bio_type(__entry->rw),
Namjae Jeon6ec178d2013-04-23 17:51:43 +0900945 show_block_type(__entry->type),
946 (unsigned long)__entry->index,
947 (unsigned long long)__entry->block)
948);
949
Namjae Jeon2af4bd62013-04-23 18:26:54 +0900950TRACE_EVENT(f2fs_write_checkpoint,
951
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -0700952 TP_PROTO(struct super_block *sb, int reason, char *msg),
Namjae Jeon2af4bd62013-04-23 18:26:54 +0900953
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -0700954 TP_ARGS(sb, reason, msg),
Namjae Jeon2af4bd62013-04-23 18:26:54 +0900955
956 TP_STRUCT__entry(
957 __field(dev_t, dev)
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -0700958 __field(int, reason)
Namjae Jeon2af4bd62013-04-23 18:26:54 +0900959 __field(char *, msg)
960 ),
961
962 TP_fast_assign(
963 __entry->dev = sb->s_dev;
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -0700964 __entry->reason = reason;
Namjae Jeon2af4bd62013-04-23 18:26:54 +0900965 __entry->msg = msg;
966 ),
967
968 TP_printk("dev = (%d,%d), checkpoint for %s, state = %s",
969 show_dev(__entry),
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -0700970 show_cpreason(__entry->reason),
Namjae Jeon2af4bd62013-04-23 18:26:54 +0900971 __entry->msg)
972);
973
Jaegeuk Kim1661d072013-11-12 17:01:00 +0900974TRACE_EVENT(f2fs_issue_discard,
975
976 TP_PROTO(struct super_block *sb, block_t blkstart, block_t blklen),
977
978 TP_ARGS(sb, blkstart, blklen),
979
980 TP_STRUCT__entry(
981 __field(dev_t, dev)
982 __field(block_t, blkstart)
983 __field(block_t, blklen)
984 ),
985
986 TP_fast_assign(
987 __entry->dev = sb->s_dev;
988 __entry->blkstart = blkstart;
989 __entry->blklen = blklen;
990 ),
991
992 TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx",
993 show_dev(__entry),
994 (unsigned long long)__entry->blkstart,
995 (unsigned long long)__entry->blklen)
996);
Jaegeuk Kim24a9ee02014-07-25 17:46:10 -0700997
998TRACE_EVENT(f2fs_issue_flush,
999
1000 TP_PROTO(struct super_block *sb, bool nobarrier, bool flush_merge),
1001
1002 TP_ARGS(sb, nobarrier, flush_merge),
1003
1004 TP_STRUCT__entry(
1005 __field(dev_t, dev)
1006 __field(bool, nobarrier)
1007 __field(bool, flush_merge)
1008 ),
1009
1010 TP_fast_assign(
1011 __entry->dev = sb->s_dev;
1012 __entry->nobarrier = nobarrier;
1013 __entry->flush_merge = flush_merge;
1014 ),
1015
1016 TP_printk("dev = (%d,%d), %s %s",
1017 show_dev(__entry),
1018 __entry->nobarrier ? "skip (nobarrier)" : "issue",
1019 __entry->flush_merge ? " with flush_merge" : "")
1020);
Namjae Jeona2a4a7e2013-04-20 01:28:40 +09001021#endif /* _TRACE_F2FS_H */
1022
1023 /* This part must be outside protection */
1024#include <trace/define_trace.h>