hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/include/trace/events/btrfs.h
....@@ -19,7 +19,7 @@
1919 struct btrfs_delayed_tree_ref;
2020 struct btrfs_delayed_data_ref;
2121 struct btrfs_delayed_ref_head;
22
-struct btrfs_block_group_cache;
22
+struct btrfs_block_group;
2323 struct btrfs_free_cluster;
2424 struct map_lookup;
2525 struct extent_buffer;
....@@ -27,14 +27,9 @@
2727 struct __btrfs_workqueue;
2828 struct btrfs_qgroup_extent_record;
2929 struct btrfs_qgroup;
30
+struct extent_io_tree;
3031 struct prelim_ref;
31
-
32
-TRACE_DEFINE_ENUM(FLUSH_DELAYED_ITEMS_NR);
33
-TRACE_DEFINE_ENUM(FLUSH_DELAYED_ITEMS);
34
-TRACE_DEFINE_ENUM(FLUSH_DELALLOC);
35
-TRACE_DEFINE_ENUM(FLUSH_DELALLOC_WAIT);
36
-TRACE_DEFINE_ENUM(ALLOC_CHUNK);
37
-TRACE_DEFINE_ENUM(COMMIT_TRANS);
32
+struct btrfs_space_info;
3833
3934 #define show_ref_type(type) \
4035 __print_symbolic(type, \
....@@ -65,17 +60,73 @@
6560 (obj >= BTRFS_ROOT_TREE_OBJECTID && \
6661 obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
6762
68
-#define show_fi_type(type) \
69
- __print_symbolic(type, \
70
- { BTRFS_FILE_EXTENT_INLINE, "INLINE" }, \
71
- { BTRFS_FILE_EXTENT_REG, "REG" }, \
72
- { BTRFS_FILE_EXTENT_PREALLOC, "PREALLOC"})
63
+#define FLUSH_ACTIONS \
64
+ EM( BTRFS_RESERVE_NO_FLUSH, "BTRFS_RESERVE_NO_FLUSH") \
65
+ EM( BTRFS_RESERVE_FLUSH_LIMIT, "BTRFS_RESERVE_FLUSH_LIMIT") \
66
+ EM( BTRFS_RESERVE_FLUSH_ALL, "BTRFS_RESERVE_FLUSH_ALL") \
67
+ EMe(BTRFS_RESERVE_FLUSH_ALL_STEAL, "BTRFS_RESERVE_FLUSH_ALL_STEAL")
7368
74
-#define show_qgroup_rsv_type(type) \
75
- __print_symbolic(type, \
76
- { BTRFS_QGROUP_RSV_DATA, "DATA" }, \
77
- { BTRFS_QGROUP_RSV_META_PERTRANS, "META_PERTRANS" }, \
78
- { BTRFS_QGROUP_RSV_META_PREALLOC, "META_PREALLOC" })
69
+#define FI_TYPES \
70
+ EM( BTRFS_FILE_EXTENT_INLINE, "INLINE") \
71
+ EM( BTRFS_FILE_EXTENT_REG, "REG") \
72
+ EMe(BTRFS_FILE_EXTENT_PREALLOC, "PREALLOC")
73
+
74
+#define QGROUP_RSV_TYPES \
75
+ EM( BTRFS_QGROUP_RSV_DATA, "DATA") \
76
+ EM( BTRFS_QGROUP_RSV_META_PERTRANS, "META_PERTRANS") \
77
+ EMe(BTRFS_QGROUP_RSV_META_PREALLOC, "META_PREALLOC")
78
+
79
+#define IO_TREE_OWNER \
80
+ EM( IO_TREE_FS_PINNED_EXTENTS, "PINNED_EXTENTS") \
81
+ EM( IO_TREE_FS_EXCLUDED_EXTENTS, "EXCLUDED_EXTENTS") \
82
+ EM( IO_TREE_BTREE_INODE_IO, "BTREE_INODE_IO") \
83
+ EM( IO_TREE_INODE_IO, "INODE_IO") \
84
+ EM( IO_TREE_INODE_IO_FAILURE, "INODE_IO_FAILURE") \
85
+ EM( IO_TREE_RELOC_BLOCKS, "RELOC_BLOCKS") \
86
+ EM( IO_TREE_TRANS_DIRTY_PAGES, "TRANS_DIRTY_PAGES") \
87
+ EM( IO_TREE_ROOT_DIRTY_LOG_PAGES, "ROOT_DIRTY_LOG_PAGES") \
88
+ EM( IO_TREE_INODE_FILE_EXTENT, "INODE_FILE_EXTENT") \
89
+ EM( IO_TREE_LOG_CSUM_RANGE, "LOG_CSUM_RANGE") \
90
+ EMe(IO_TREE_SELFTEST, "SELFTEST")
91
+
92
+#define FLUSH_STATES \
93
+ EM( FLUSH_DELAYED_ITEMS_NR, "FLUSH_DELAYED_ITEMS_NR") \
94
+ EM( FLUSH_DELAYED_ITEMS, "FLUSH_DELAYED_ITEMS") \
95
+ EM( FLUSH_DELALLOC, "FLUSH_DELALLOC") \
96
+ EM( FLUSH_DELALLOC_WAIT, "FLUSH_DELALLOC_WAIT") \
97
+ EM( FLUSH_DELAYED_REFS_NR, "FLUSH_DELAYED_REFS_NR") \
98
+ EM( FLUSH_DELAYED_REFS, "FLUSH_ELAYED_REFS") \
99
+ EM( ALLOC_CHUNK, "ALLOC_CHUNK") \
100
+ EM( ALLOC_CHUNK_FORCE, "ALLOC_CHUNK_FORCE") \
101
+ EM( RUN_DELAYED_IPUTS, "RUN_DELAYED_IPUTS") \
102
+ EMe(COMMIT_TRANS, "COMMIT_TRANS")
103
+
104
+/*
105
+ * First define the enums in the above macros to be exported to userspace via
106
+ * TRACE_DEFINE_ENUM().
107
+ */
108
+
109
+#undef EM
110
+#undef EMe
111
+#define EM(a, b) TRACE_DEFINE_ENUM(a);
112
+#define EMe(a, b) TRACE_DEFINE_ENUM(a);
113
+
114
+FLUSH_ACTIONS
115
+FI_TYPES
116
+QGROUP_RSV_TYPES
117
+IO_TREE_OWNER
118
+FLUSH_STATES
119
+
120
+/*
121
+ * Now redefine the EM and EMe macros to map the enums to the strings that will
122
+ * be printed in the output
123
+ */
124
+
125
+#undef EM
126
+#undef EMe
127
+#define EM(a, b) {a, b},
128
+#define EMe(a, b) {a, b}
129
+
79130
80131 #define BTRFS_GROUP_FLAGS \
81132 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \
....@@ -88,11 +139,34 @@
88139 { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \
89140 { BTRFS_BLOCK_GROUP_RAID6, "RAID6"}
90141
142
+#define EXTENT_FLAGS \
143
+ { EXTENT_DIRTY, "DIRTY"}, \
144
+ { EXTENT_UPTODATE, "UPTODATE"}, \
145
+ { EXTENT_LOCKED, "LOCKED"}, \
146
+ { EXTENT_NEW, "NEW"}, \
147
+ { EXTENT_DELALLOC, "DELALLOC"}, \
148
+ { EXTENT_DEFRAG, "DEFRAG"}, \
149
+ { EXTENT_BOUNDARY, "BOUNDARY"}, \
150
+ { EXTENT_NODATASUM, "NODATASUM"}, \
151
+ { EXTENT_CLEAR_META_RESV, "CLEAR_META_RESV"}, \
152
+ { EXTENT_NEED_WAIT, "NEED_WAIT"}, \
153
+ { EXTENT_DAMAGED, "DAMAGED"}, \
154
+ { EXTENT_NORESERVE, "NORESERVE"}, \
155
+ { EXTENT_QGROUP_RESERVED, "QGROUP_RESERVED"}, \
156
+ { EXTENT_CLEAR_DATA_RESV, "CLEAR_DATA_RESV"}, \
157
+ { EXTENT_DELALLOC_NEW, "DELALLOC_NEW"}
158
+
91159 #define BTRFS_FSID_SIZE 16
92160 #define TP_STRUCT__entry_fsid __array(u8, fsid, BTRFS_FSID_SIZE)
93161
94162 #define TP_fast_assign_fsid(fs_info) \
95
- memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE)
163
+({ \
164
+ if (fs_info) \
165
+ memcpy(__entry->fsid, fs_info->fs_devices->fsid, \
166
+ BTRFS_FSID_SIZE); \
167
+ else \
168
+ memset(__entry->fsid, 0, BTRFS_FSID_SIZE); \
169
+})
96170
97171 #define TP_STRUCT__entry_btrfs(args...) \
98172 TP_STRUCT__entry( \
....@@ -134,7 +208,7 @@
134208
135209 TP_STRUCT__entry_btrfs(
136210 __field( u64, ino )
137
- __field( blkcnt_t, blocks )
211
+ __field( u64, blocks )
138212 __field( u64, disk_i_size )
139213 __field( u64, generation )
140214 __field( u64, last_trans )
....@@ -158,7 +232,7 @@
158232 show_root_type(__entry->root_objectid),
159233 __entry->generation,
160234 __entry->ino,
161
- (unsigned long long)__entry->blocks,
235
+ __entry->blocks,
162236 __entry->disk_i_size,
163237 __entry->last_trans,
164238 __entry->logged_trans)
....@@ -256,7 +330,7 @@
256330
257331 TRACE_EVENT(btrfs_handle_em_exist,
258332
259
- TP_PROTO(struct btrfs_fs_info *fs_info,
333
+ TP_PROTO(const struct btrfs_fs_info *fs_info,
260334 const struct extent_map *existing, const struct extent_map *map,
261335 u64 start, u64 len),
262336
....@@ -294,8 +368,8 @@
294368 /* file extent item */
295369 DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular,
296370
297
- TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
298
- struct btrfs_file_extent_item *fi, u64 start),
371
+ TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l,
372
+ const struct btrfs_file_extent_item *fi, u64 start),
299373
300374 TP_ARGS(bi, l, fi, start),
301375
....@@ -316,7 +390,7 @@
316390 ),
317391
318392 TP_fast_assign_btrfs(bi->root->fs_info,
319
- __entry->root_obj = bi->root->objectid;
393
+ __entry->root_obj = bi->root->root_key.objectid;
320394 __entry->ino = btrfs_ino(bi);
321395 __entry->isize = bi->vfs_inode.i_size;
322396 __entry->disk_isize = bi->disk_i_size;
....@@ -342,15 +416,15 @@
342416 __entry->disk_isize, __entry->extent_start,
343417 __entry->extent_end, __entry->num_bytes, __entry->ram_bytes,
344418 __entry->disk_bytenr, __entry->disk_num_bytes,
345
- __entry->extent_offset, show_fi_type(__entry->extent_type),
419
+ __entry->extent_offset, __print_symbolic(__entry->extent_type, FI_TYPES),
346420 __entry->compression)
347421 );
348422
349423 DECLARE_EVENT_CLASS(
350424 btrfs__file_extent_item_inline,
351425
352
- TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
353
- struct btrfs_file_extent_item *fi, int slot, u64 start),
426
+ TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l,
427
+ const struct btrfs_file_extent_item *fi, int slot, u64 start),
354428
355429 TP_ARGS(bi, l, fi, slot, start),
356430
....@@ -367,7 +441,7 @@
367441
368442 TP_fast_assign_btrfs(
369443 bi->root->fs_info,
370
- __entry->root_obj = bi->root->objectid;
444
+ __entry->root_obj = bi->root->root_key.objectid;
371445 __entry->ino = btrfs_ino(bi);
372446 __entry->isize = bi->vfs_inode.i_size;
373447 __entry->disk_isize = bi->disk_i_size;
....@@ -383,15 +457,15 @@
383457 "extent_type=%s compression=%u",
384458 show_root_type(__entry->root_obj), __entry->ino, __entry->isize,
385459 __entry->disk_isize, __entry->extent_start,
386
- __entry->extent_end, show_fi_type(__entry->extent_type),
460
+ __entry->extent_end, __print_symbolic(__entry->extent_type, FI_TYPES),
387461 __entry->compression)
388462 );
389463
390464 DEFINE_EVENT(
391465 btrfs__file_extent_item_regular, btrfs_get_extent_show_fi_regular,
392466
393
- TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
394
- struct btrfs_file_extent_item *fi, u64 start),
467
+ TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l,
468
+ const struct btrfs_file_extent_item *fi, u64 start),
395469
396470 TP_ARGS(bi, l, fi, start)
397471 );
....@@ -399,8 +473,8 @@
399473 DEFINE_EVENT(
400474 btrfs__file_extent_item_regular, btrfs_truncate_show_fi_regular,
401475
402
- TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
403
- struct btrfs_file_extent_item *fi, u64 start),
476
+ TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l,
477
+ const struct btrfs_file_extent_item *fi, u64 start),
404478
405479 TP_ARGS(bi, l, fi, start)
406480 );
....@@ -408,8 +482,8 @@
408482 DEFINE_EVENT(
409483 btrfs__file_extent_item_inline, btrfs_get_extent_show_fi_inline,
410484
411
- TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
412
- struct btrfs_file_extent_item *fi, int slot, u64 start),
485
+ TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l,
486
+ const struct btrfs_file_extent_item *fi, int slot, u64 start),
413487
414488 TP_ARGS(bi, l, fi, slot, start)
415489 );
....@@ -417,8 +491,8 @@
417491 DEFINE_EVENT(
418492 btrfs__file_extent_item_inline, btrfs_truncate_show_fi_inline,
419493
420
- TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
421
- struct btrfs_file_extent_item *fi, int slot, u64 start),
494
+ TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l,
495
+ const struct btrfs_file_extent_item *fi, int slot, u64 start),
422496
423497 TP_ARGS(bi, l, fi, slot, start)
424498 );
....@@ -432,13 +506,12 @@
432506 { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \
433507 { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \
434508 { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \
435
- { (1 << BTRFS_ORDERED_UPDATED_ISIZE), "UPDATED_ISIZE" }, \
436509 { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" })
437510
438511
439512 DECLARE_EVENT_CLASS(btrfs__ordered_extent,
440513
441
- TP_PROTO(const struct inode *inode,
514
+ TP_PROTO(const struct btrfs_inode *inode,
442515 const struct btrfs_ordered_extent *ordered),
443516
444517 TP_ARGS(inode, ordered),
....@@ -457,18 +530,17 @@
457530 __field( u64, truncated_len )
458531 ),
459532
460
- TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
461
- __entry->ino = btrfs_ino(BTRFS_I(inode));
533
+ TP_fast_assign_btrfs(inode->root->fs_info,
534
+ __entry->ino = btrfs_ino(inode);
462535 __entry->file_offset = ordered->file_offset;
463
- __entry->start = ordered->start;
464
- __entry->len = ordered->len;
465
- __entry->disk_len = ordered->disk_len;
536
+ __entry->start = ordered->disk_bytenr;
537
+ __entry->len = ordered->num_bytes;
538
+ __entry->disk_len = ordered->disk_num_bytes;
466539 __entry->bytes_left = ordered->bytes_left;
467540 __entry->flags = ordered->flags;
468541 __entry->compress_type = ordered->compress_type;
469542 __entry->refs = refcount_read(&ordered->refs);
470
- __entry->root_objectid =
471
- BTRFS_I(inode)->root->root_key.objectid;
543
+ __entry->root_objectid = inode->root->root_key.objectid;
472544 __entry->truncated_len = ordered->truncated_len;
473545 ),
474546
....@@ -491,7 +563,7 @@
491563
492564 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add,
493565
494
- TP_PROTO(const struct inode *inode,
566
+ TP_PROTO(const struct btrfs_inode *inode,
495567 const struct btrfs_ordered_extent *ordered),
496568
497569 TP_ARGS(inode, ordered)
....@@ -499,7 +571,7 @@
499571
500572 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove,
501573
502
- TP_PROTO(const struct inode *inode,
574
+ TP_PROTO(const struct btrfs_inode *inode,
503575 const struct btrfs_ordered_extent *ordered),
504576
505577 TP_ARGS(inode, ordered)
....@@ -507,7 +579,7 @@
507579
508580 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start,
509581
510
- TP_PROTO(const struct inode *inode,
582
+ TP_PROTO(const struct btrfs_inode *inode,
511583 const struct btrfs_ordered_extent *ordered),
512584
513585 TP_ARGS(inode, ordered)
....@@ -515,7 +587,7 @@
515587
516588 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put,
517589
518
- TP_PROTO(const struct inode *inode,
590
+ TP_PROTO(const struct btrfs_inode *inode,
519591 const struct btrfs_ordered_extent *ordered),
520592
521593 TP_ARGS(inode, ordered)
....@@ -538,7 +610,7 @@
538610 __field( char, for_kupdate )
539611 __field( char, for_reclaim )
540612 __field( char, range_cyclic )
541
- __field( pgoff_t, writeback_index )
613
+ __field( unsigned long, writeback_index )
542614 __field( u64, root_objectid )
543615 ),
544616
....@@ -567,7 +639,7 @@
567639 __entry->range_start, __entry->range_end,
568640 __entry->for_kupdate,
569641 __entry->for_reclaim, __entry->range_cyclic,
570
- (unsigned long)__entry->writeback_index)
642
+ __entry->writeback_index)
571643 );
572644
573645 DEFINE_EVENT(btrfs__writepage, __extent_writepage,
....@@ -586,7 +658,7 @@
586658
587659 TP_STRUCT__entry_btrfs(
588660 __field( u64, ino )
589
- __field( pgoff_t, index )
661
+ __field( unsigned long, index )
590662 __field( u64, start )
591663 __field( u64, end )
592664 __field( int, uptodate )
....@@ -606,7 +678,7 @@
606678 TP_printk_btrfs("root=%llu(%s) ino=%llu page_index=%lu start=%llu "
607679 "end=%llu uptodate=%d",
608680 show_root_type(__entry->root_objectid),
609
- __entry->ino, (unsigned long)__entry->index,
681
+ __entry->ino, __entry->index,
610682 __entry->start,
611683 __entry->end, __entry->uptodate)
612684 );
....@@ -663,7 +735,7 @@
663735 TRACE_EVENT(btrfs_add_block_group,
664736
665737 TP_PROTO(const struct btrfs_fs_info *fs_info,
666
- const struct btrfs_block_group_cache *block_group, int create),
738
+ const struct btrfs_block_group *block_group, int create),
667739
668740 TP_ARGS(fs_info, block_group, create),
669741
....@@ -677,11 +749,10 @@
677749 ),
678750
679751 TP_fast_assign_btrfs(fs_info,
680
- __entry->offset = block_group->key.objectid;
681
- __entry->size = block_group->key.offset;
752
+ __entry->offset = block_group->start;
753
+ __entry->size = block_group->length;
682754 __entry->flags = block_group->flags;
683
- __entry->bytes_used =
684
- btrfs_block_group_used(&block_group->item);
755
+ __entry->bytes_used = block_group->used;
685756 __entry->bytes_super = block_group->bytes_super;
686757 __entry->create = create;
687758 ),
....@@ -982,7 +1053,7 @@
9821053
9831054 TRACE_EVENT(btrfs_space_reservation,
9841055
985
- TP_PROTO(const struct btrfs_fs_info *fs_info, char *type, u64 val,
1056
+ TP_PROTO(const struct btrfs_fs_info *fs_info, const char *type, u64 val,
9861057 u64 bytes, int reserve),
9871058
9881059 TP_ARGS(fs_info, type, val, bytes, reserve),
....@@ -1006,16 +1077,10 @@
10061077 __entry->bytes)
10071078 );
10081079
1009
-#define show_flush_action(action) \
1010
- __print_symbolic(action, \
1011
- { BTRFS_RESERVE_NO_FLUSH, "BTRFS_RESERVE_NO_FLUSH"}, \
1012
- { BTRFS_RESERVE_FLUSH_LIMIT, "BTRFS_RESERVE_FLUSH_LIMIT"}, \
1013
- { BTRFS_RESERVE_FLUSH_ALL, "BTRFS_RESERVE_FLUSH_ALL"})
1014
-
10151080 TRACE_EVENT(btrfs_trigger_flush,
10161081
10171082 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes,
1018
- int flush, char *reason),
1083
+ int flush, const char *reason),
10191084
10201085 TP_ARGS(fs_info, flags, bytes, flush, reason),
10211086
....@@ -1035,21 +1100,13 @@
10351100
10361101 TP_printk_btrfs("%s: flush=%d(%s) flags=%llu(%s) bytes=%llu",
10371102 __get_str(reason), __entry->flush,
1038
- show_flush_action(__entry->flush),
1103
+ __print_symbolic(__entry->flush, FLUSH_ACTIONS),
10391104 __entry->flags,
10401105 __print_flags((unsigned long)__entry->flags, "|",
10411106 BTRFS_GROUP_FLAGS),
10421107 __entry->bytes)
10431108 );
10441109
1045
-#define show_flush_state(state) \
1046
- __print_symbolic(state, \
1047
- { FLUSH_DELAYED_ITEMS_NR, "FLUSH_DELAYED_ITEMS_NR"}, \
1048
- { FLUSH_DELAYED_ITEMS, "FLUSH_DELAYED_ITEMS"}, \
1049
- { FLUSH_DELALLOC, "FLUSH_DELALLOC"}, \
1050
- { FLUSH_DELALLOC_WAIT, "FLUSH_DELALLOC_WAIT"}, \
1051
- { ALLOC_CHUNK, "ALLOC_CHUNK"}, \
1052
- { COMMIT_TRANS, "COMMIT_TRANS"})
10531110
10541111 TRACE_EVENT(btrfs_flush_space,
10551112
....@@ -1074,7 +1131,7 @@
10741131
10751132 TP_printk_btrfs("state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d",
10761133 __entry->state,
1077
- show_flush_state(__entry->state),
1134
+ __print_symbolic(__entry->state, FLUSH_STATES),
10781135 __entry->flags,
10791136 __print_flags((unsigned long)__entry->flags, "|",
10801137 BTRFS_GROUP_FLAGS),
....@@ -1119,25 +1176,27 @@
11191176
11201177 TRACE_EVENT(find_free_extent,
11211178
1122
- TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes,
1179
+ TP_PROTO(const struct btrfs_root *root, u64 num_bytes,
11231180 u64 empty_size, u64 data),
11241181
1125
- TP_ARGS(fs_info, num_bytes, empty_size, data),
1182
+ TP_ARGS(root, num_bytes, empty_size, data),
11261183
11271184 TP_STRUCT__entry_btrfs(
1185
+ __field( u64, root_objectid )
11281186 __field( u64, num_bytes )
11291187 __field( u64, empty_size )
11301188 __field( u64, data )
11311189 ),
11321190
1133
- TP_fast_assign_btrfs(fs_info,
1191
+ TP_fast_assign_btrfs(root->fs_info,
1192
+ __entry->root_objectid = root->root_key.objectid;
11341193 __entry->num_bytes = num_bytes;
11351194 __entry->empty_size = empty_size;
11361195 __entry->data = data;
11371196 ),
11381197
11391198 TP_printk_btrfs("root=%llu(%s) len=%llu empty_size=%llu flags=%llu(%s)",
1140
- show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
1199
+ show_root_type(__entry->root_objectid),
11411200 __entry->num_bytes, __entry->empty_size, __entry->data,
11421201 __print_flags((unsigned long)__entry->data, "|",
11431202 BTRFS_GROUP_FLAGS))
....@@ -1145,7 +1204,7 @@
11451204
11461205 DECLARE_EVENT_CLASS(btrfs__reserve_extent,
11471206
1148
- TP_PROTO(const struct btrfs_block_group_cache *block_group, u64 start,
1207
+ TP_PROTO(const struct btrfs_block_group *block_group, u64 start,
11491208 u64 len),
11501209
11511210 TP_ARGS(block_group, start, len),
....@@ -1158,7 +1217,7 @@
11581217 ),
11591218
11601219 TP_fast_assign_btrfs(block_group->fs_info,
1161
- __entry->bg_objectid = block_group->key.objectid;
1220
+ __entry->bg_objectid = block_group->start;
11621221 __entry->flags = block_group->flags;
11631222 __entry->start = start;
11641223 __entry->len = len;
....@@ -1175,7 +1234,7 @@
11751234
11761235 DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent,
11771236
1178
- TP_PROTO(const struct btrfs_block_group_cache *block_group, u64 start,
1237
+ TP_PROTO(const struct btrfs_block_group *block_group, u64 start,
11791238 u64 len),
11801239
11811240 TP_ARGS(block_group, start, len)
....@@ -1183,7 +1242,7 @@
11831242
11841243 DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
11851244
1186
- TP_PROTO(const struct btrfs_block_group_cache *block_group, u64 start,
1245
+ TP_PROTO(const struct btrfs_block_group *block_group, u64 start,
11871246 u64 len),
11881247
11891248 TP_ARGS(block_group, start, len)
....@@ -1191,7 +1250,7 @@
11911250
11921251 TRACE_EVENT(btrfs_find_cluster,
11931252
1194
- TP_PROTO(const struct btrfs_block_group_cache *block_group, u64 start,
1253
+ TP_PROTO(const struct btrfs_block_group *block_group, u64 start,
11951254 u64 bytes, u64 empty_size, u64 min_bytes),
11961255
11971256 TP_ARGS(block_group, start, bytes, empty_size, min_bytes),
....@@ -1206,7 +1265,7 @@
12061265 ),
12071266
12081267 TP_fast_assign_btrfs(block_group->fs_info,
1209
- __entry->bg_objectid = block_group->key.objectid;
1268
+ __entry->bg_objectid = block_group->start;
12101269 __entry->flags = block_group->flags;
12111270 __entry->start = start;
12121271 __entry->bytes = bytes;
....@@ -1224,7 +1283,7 @@
12241283
12251284 TRACE_EVENT(btrfs_failed_cluster_setup,
12261285
1227
- TP_PROTO(const struct btrfs_block_group_cache *block_group),
1286
+ TP_PROTO(const struct btrfs_block_group *block_group),
12281287
12291288 TP_ARGS(block_group),
12301289
....@@ -1233,7 +1292,7 @@
12331292 ),
12341293
12351294 TP_fast_assign_btrfs(block_group->fs_info,
1236
- __entry->bg_objectid = block_group->key.objectid;
1295
+ __entry->bg_objectid = block_group->start;
12371296 ),
12381297
12391298 TP_printk_btrfs("block_group=%llu", __entry->bg_objectid)
....@@ -1241,7 +1300,7 @@
12411300
12421301 TRACE_EVENT(btrfs_setup_cluster,
12431302
1244
- TP_PROTO(const struct btrfs_block_group_cache *block_group,
1303
+ TP_PROTO(const struct btrfs_block_group *block_group,
12451304 const struct btrfs_free_cluster *cluster,
12461305 u64 size, int bitmap),
12471306
....@@ -1257,7 +1316,7 @@
12571316 ),
12581317
12591318 TP_fast_assign_btrfs(block_group->fs_info,
1260
- __entry->bg_objectid = block_group->key.objectid;
1319
+ __entry->bg_objectid = block_group->start;
12611320 __entry->flags = block_group->flags;
12621321 __entry->start = cluster->window_start;
12631322 __entry->max_size = cluster->max_size;
....@@ -1285,17 +1344,17 @@
12851344 TP_STRUCT__entry(
12861345 __field(const struct extent_state *, state)
12871346 __field(gfp_t, mask)
1288
- __field(unsigned long, ip)
1347
+ __field(const void*, ip)
12891348 ),
12901349
12911350 TP_fast_assign(
12921351 __entry->state = state,
12931352 __entry->mask = mask,
1294
- __entry->ip = IP
1353
+ __entry->ip = (const void *)IP
12951354 ),
12961355
12971356 TP_printk("state=%p mask=%s caller=%pS", __entry->state,
1298
- show_gfp_flags(__entry->mask), (const void *)__entry->ip)
1357
+ show_gfp_flags(__entry->mask), __entry->ip)
12991358 );
13001359
13011360 TRACE_EVENT(free_extent_state,
....@@ -1306,16 +1365,15 @@
13061365
13071366 TP_STRUCT__entry(
13081367 __field(const struct extent_state *, state)
1309
- __field(unsigned long, ip)
1368
+ __field(const void*, ip)
13101369 ),
13111370
13121371 TP_fast_assign(
13131372 __entry->state = state,
1314
- __entry->ip = IP
1373
+ __entry->ip = (const void *)IP
13151374 ),
13161375
1317
- TP_printk("state=%p caller=%pS", __entry->state,
1318
- (const void *)__entry->ip)
1376
+ TP_printk("state=%p caller=%pS", __entry->state, __entry->ip)
13191377 );
13201378
13211379 DECLARE_EVENT_CLASS(btrfs__work,
....@@ -1342,16 +1400,16 @@
13421400 __entry->normal_work = &work->normal_work;
13431401 ),
13441402
1345
- TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%pf ordered_func=%p "
1403
+ TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%ps ordered_func=%p "
13461404 "ordered_free=%p",
13471405 __entry->work, __entry->normal_work, __entry->wq,
13481406 __entry->func, __entry->ordered_func, __entry->ordered_free)
13491407 );
13501408
13511409 /*
1352
- * For situiations when the work is freed, we pass fs_info and a tag that that
1353
- * matches address of the work structure so it can be paired with the
1354
- * scheduling event.
1410
+ * For situations when the work is freed, we pass fs_info and a tag that matches
1411
+ * the address of the work structure so it can be paired with the scheduling
1412
+ * event. DO NOT add anything here that dereferences wtag.
13551413 */
13561414 DECLARE_EVENT_CLASS(btrfs__work__done,
13571415
....@@ -1477,7 +1535,8 @@
14771535 ),
14781536
14791537 TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
1480
- __entry->rootid = BTRFS_I(inode)->root->objectid;
1538
+ __entry->rootid =
1539
+ BTRFS_I(inode)->root->root_key.objectid;
14811540 __entry->ino = btrfs_ino(BTRFS_I(inode));
14821541 __entry->start = start;
14831542 __entry->len = len;
....@@ -1509,35 +1568,6 @@
15091568 TP_ARGS(inode, start, len, reserved, op)
15101569 );
15111570
1512
-DECLARE_EVENT_CLASS(btrfs__qgroup_delayed_ref,
1513
-
1514
- TP_PROTO(const struct btrfs_fs_info *fs_info,
1515
- u64 ref_root, u64 reserved),
1516
-
1517
- TP_ARGS(fs_info, ref_root, reserved),
1518
-
1519
- TP_STRUCT__entry_btrfs(
1520
- __field( u64, ref_root )
1521
- __field( u64, reserved )
1522
- ),
1523
-
1524
- TP_fast_assign_btrfs(fs_info,
1525
- __entry->ref_root = ref_root;
1526
- __entry->reserved = reserved;
1527
- ),
1528
-
1529
- TP_printk_btrfs("root=%llu reserved=%llu op=free",
1530
- __entry->ref_root, __entry->reserved)
1531
-);
1532
-
1533
-DEFINE_EVENT(btrfs__qgroup_delayed_ref, btrfs_qgroup_free_delayed_ref,
1534
-
1535
- TP_PROTO(const struct btrfs_fs_info *fs_info,
1536
- u64 ref_root, u64 reserved),
1537
-
1538
- TP_ARGS(fs_info, ref_root, reserved)
1539
-);
1540
-
15411571 DECLARE_EVENT_CLASS(btrfs_qgroup_extent,
15421572 TP_PROTO(const struct btrfs_fs_info *fs_info,
15431573 const struct btrfs_qgroup_extent_record *rec),
....@@ -1555,8 +1585,7 @@
15551585 ),
15561586
15571587 TP_printk_btrfs("bytenr=%llu num_bytes=%llu",
1558
- (unsigned long long)__entry->bytenr,
1559
- (unsigned long long)__entry->num_bytes)
1588
+ __entry->bytenr, __entry->num_bytes)
15601589 );
15611590
15621591 DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents,
....@@ -1573,6 +1602,27 @@
15731602 const struct btrfs_qgroup_extent_record *rec),
15741603
15751604 TP_ARGS(fs_info, rec)
1605
+);
1606
+
1607
+TRACE_EVENT(qgroup_num_dirty_extents,
1608
+
1609
+ TP_PROTO(const struct btrfs_fs_info *fs_info, u64 transid,
1610
+ u64 num_dirty_extents),
1611
+
1612
+ TP_ARGS(fs_info, transid, num_dirty_extents),
1613
+
1614
+ TP_STRUCT__entry_btrfs(
1615
+ __field( u64, transid )
1616
+ __field( u64, num_dirty_extents )
1617
+ ),
1618
+
1619
+ TP_fast_assign_btrfs(fs_info,
1620
+ __entry->transid = transid;
1621
+ __entry->num_dirty_extents = num_dirty_extents;
1622
+ ),
1623
+
1624
+ TP_printk_btrfs("transid=%llu num_dirty_extents=%llu",
1625
+ __entry->transid, __entry->num_dirty_extents)
15761626 );
15771627
15781628 TRACE_EVENT(btrfs_qgroup_account_extent,
....@@ -1611,7 +1661,7 @@
16111661 TRACE_EVENT(qgroup_update_counters,
16121662
16131663 TP_PROTO(const struct btrfs_fs_info *fs_info,
1614
- struct btrfs_qgroup *qgroup,
1664
+ const struct btrfs_qgroup *qgroup,
16151665 u64 cur_old_count, u64 cur_new_count),
16161666
16171667 TP_ARGS(fs_info, qgroup, cur_old_count, cur_new_count),
....@@ -1659,7 +1709,7 @@
16591709 ),
16601710
16611711 TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld",
1662
- __entry->qgid, show_qgroup_rsv_type(__entry->type),
1712
+ __entry->qgid, __print_symbolic(__entry->type, QGROUP_RSV_TYPES),
16631713 __entry->cur_reserved, __entry->diff)
16641714 );
16651715
....@@ -1676,14 +1726,14 @@
16761726 ),
16771727
16781728 TP_fast_assign_btrfs(root->fs_info,
1679
- __entry->refroot = root->objectid;
1729
+ __entry->refroot = root->root_key.objectid;
16801730 __entry->diff = diff;
16811731 __entry->type = type;
16821732 ),
16831733
16841734 TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld",
16851735 show_root_type(__entry->refroot),
1686
- show_qgroup_rsv_type(__entry->type), __entry->diff)
1736
+ __print_symbolic(__entry->type, QGROUP_RSV_TYPES), __entry->diff)
16871737 );
16881738
16891739 TRACE_EVENT(qgroup_meta_convert,
....@@ -1698,14 +1748,14 @@
16981748 ),
16991749
17001750 TP_fast_assign_btrfs(root->fs_info,
1701
- __entry->refroot = root->objectid;
1751
+ __entry->refroot = root->root_key.objectid;
17021752 __entry->diff = diff;
17031753 ),
17041754
17051755 TP_printk_btrfs("refroot=%llu(%s) type=%s->%s diff=%lld",
17061756 show_root_type(__entry->refroot),
1707
- show_qgroup_rsv_type(BTRFS_QGROUP_RSV_META_PREALLOC),
1708
- show_qgroup_rsv_type(BTRFS_QGROUP_RSV_META_PERTRANS),
1757
+ __print_symbolic(BTRFS_QGROUP_RSV_META_PREALLOC, QGROUP_RSV_TYPES),
1758
+ __print_symbolic(BTRFS_QGROUP_RSV_META_PERTRANS, QGROUP_RSV_TYPES),
17091759 __entry->diff)
17101760 );
17111761
....@@ -1722,7 +1772,7 @@
17221772 ),
17231773
17241774 TP_fast_assign_btrfs(root->fs_info,
1725
- __entry->refroot = root->objectid;
1775
+ __entry->refroot = root->root_key.objectid;
17261776 spin_lock(&root->qgroup_meta_rsv_lock);
17271777 __entry->diff = -(s64)root->qgroup_meta_rsv_pertrans;
17281778 spin_unlock(&root->qgroup_meta_rsv_lock);
....@@ -1731,7 +1781,7 @@
17311781
17321782 TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld",
17331783 show_root_type(__entry->refroot),
1734
- show_qgroup_rsv_type(__entry->type), __entry->diff)
1784
+ __print_symbolic(__entry->type, QGROUP_RSV_TYPES), __entry->diff)
17351785 );
17361786
17371787 DECLARE_EVENT_CLASS(btrfs__prelim_ref,
....@@ -1792,7 +1842,7 @@
17921842 );
17931843
17941844 TRACE_EVENT(btrfs_inode_mod_outstanding_extents,
1795
- TP_PROTO(struct btrfs_root *root, u64 ino, int mod),
1845
+ TP_PROTO(const struct btrfs_root *root, u64 ino, int mod),
17961846
17971847 TP_ARGS(root, ino, mod),
17981848
....@@ -1803,7 +1853,7 @@
18031853 ),
18041854
18051855 TP_fast_assign_btrfs(root->fs_info,
1806
- __entry->root_objectid = root->objectid;
1856
+ __entry->root_objectid = root->root_key.objectid;
18071857 __entry->ino = ino;
18081858 __entry->mod = mod;
18091859 ),
....@@ -1814,7 +1864,7 @@
18141864 );
18151865
18161866 DECLARE_EVENT_CLASS(btrfs__block_group,
1817
- TP_PROTO(const struct btrfs_block_group_cache *bg_cache),
1867
+ TP_PROTO(const struct btrfs_block_group *bg_cache),
18181868
18191869 TP_ARGS(bg_cache),
18201870
....@@ -1826,9 +1876,9 @@
18261876 ),
18271877
18281878 TP_fast_assign_btrfs(bg_cache->fs_info,
1829
- __entry->bytenr = bg_cache->key.objectid,
1830
- __entry->len = bg_cache->key.offset,
1831
- __entry->used = btrfs_block_group_used(&bg_cache->item);
1879
+ __entry->bytenr = bg_cache->start,
1880
+ __entry->len = bg_cache->length,
1881
+ __entry->used = bg_cache->used;
18321882 __entry->flags = bg_cache->flags;
18331883 ),
18341884
....@@ -1838,23 +1888,266 @@
18381888 );
18391889
18401890 DEFINE_EVENT(btrfs__block_group, btrfs_remove_block_group,
1841
- TP_PROTO(const struct btrfs_block_group_cache *bg_cache),
1891
+ TP_PROTO(const struct btrfs_block_group *bg_cache),
18421892
18431893 TP_ARGS(bg_cache)
18441894 );
18451895
18461896 DEFINE_EVENT(btrfs__block_group, btrfs_add_unused_block_group,
1847
- TP_PROTO(const struct btrfs_block_group_cache *bg_cache),
1897
+ TP_PROTO(const struct btrfs_block_group *bg_cache),
18481898
18491899 TP_ARGS(bg_cache)
18501900 );
18511901
18521902 DEFINE_EVENT(btrfs__block_group, btrfs_skip_unused_block_group,
1853
- TP_PROTO(const struct btrfs_block_group_cache *bg_cache),
1903
+ TP_PROTO(const struct btrfs_block_group *bg_cache),
18541904
18551905 TP_ARGS(bg_cache)
18561906 );
18571907
1908
+TRACE_EVENT(btrfs_set_extent_bit,
1909
+ TP_PROTO(const struct extent_io_tree *tree,
1910
+ u64 start, u64 len, unsigned set_bits),
1911
+
1912
+ TP_ARGS(tree, start, len, set_bits),
1913
+
1914
+ TP_STRUCT__entry_btrfs(
1915
+ __field( unsigned, owner )
1916
+ __field( u64, ino )
1917
+ __field( u64, rootid )
1918
+ __field( u64, start )
1919
+ __field( u64, len )
1920
+ __field( unsigned, set_bits)
1921
+ ),
1922
+
1923
+ TP_fast_assign_btrfs(tree->fs_info,
1924
+ __entry->owner = tree->owner;
1925
+ if (tree->private_data) {
1926
+ const struct inode *inode = tree->private_data;
1927
+
1928
+ __entry->ino = btrfs_ino(BTRFS_I(inode));
1929
+ __entry->rootid =
1930
+ BTRFS_I(inode)->root->root_key.objectid;
1931
+ } else {
1932
+ __entry->ino = 0;
1933
+ __entry->rootid = 0;
1934
+ }
1935
+ __entry->start = start;
1936
+ __entry->len = len;
1937
+ __entry->set_bits = set_bits;
1938
+ ),
1939
+
1940
+ TP_printk_btrfs(
1941
+ "io_tree=%s ino=%llu root=%llu start=%llu len=%llu set_bits=%s",
1942
+ __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino,
1943
+ __entry->rootid, __entry->start, __entry->len,
1944
+ __print_flags(__entry->set_bits, "|", EXTENT_FLAGS))
1945
+);
1946
+
1947
+TRACE_EVENT(btrfs_clear_extent_bit,
1948
+ TP_PROTO(const struct extent_io_tree *tree,
1949
+ u64 start, u64 len, unsigned clear_bits),
1950
+
1951
+ TP_ARGS(tree, start, len, clear_bits),
1952
+
1953
+ TP_STRUCT__entry_btrfs(
1954
+ __field( unsigned, owner )
1955
+ __field( u64, ino )
1956
+ __field( u64, rootid )
1957
+ __field( u64, start )
1958
+ __field( u64, len )
1959
+ __field( unsigned, clear_bits)
1960
+ ),
1961
+
1962
+ TP_fast_assign_btrfs(tree->fs_info,
1963
+ __entry->owner = tree->owner;
1964
+ if (tree->private_data) {
1965
+ const struct inode *inode = tree->private_data;
1966
+
1967
+ __entry->ino = btrfs_ino(BTRFS_I(inode));
1968
+ __entry->rootid =
1969
+ BTRFS_I(inode)->root->root_key.objectid;
1970
+ } else {
1971
+ __entry->ino = 0;
1972
+ __entry->rootid = 0;
1973
+ }
1974
+ __entry->start = start;
1975
+ __entry->len = len;
1976
+ __entry->clear_bits = clear_bits;
1977
+ ),
1978
+
1979
+ TP_printk_btrfs(
1980
+ "io_tree=%s ino=%llu root=%llu start=%llu len=%llu clear_bits=%s",
1981
+ __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino,
1982
+ __entry->rootid, __entry->start, __entry->len,
1983
+ __print_flags(__entry->clear_bits, "|", EXTENT_FLAGS))
1984
+);
1985
+
1986
+TRACE_EVENT(btrfs_convert_extent_bit,
1987
+ TP_PROTO(const struct extent_io_tree *tree,
1988
+ u64 start, u64 len, unsigned set_bits, unsigned clear_bits),
1989
+
1990
+ TP_ARGS(tree, start, len, set_bits, clear_bits),
1991
+
1992
+ TP_STRUCT__entry_btrfs(
1993
+ __field( unsigned, owner )
1994
+ __field( u64, ino )
1995
+ __field( u64, rootid )
1996
+ __field( u64, start )
1997
+ __field( u64, len )
1998
+ __field( unsigned, set_bits)
1999
+ __field( unsigned, clear_bits)
2000
+ ),
2001
+
2002
+ TP_fast_assign_btrfs(tree->fs_info,
2003
+ __entry->owner = tree->owner;
2004
+ if (tree->private_data) {
2005
+ const struct inode *inode = tree->private_data;
2006
+
2007
+ __entry->ino = btrfs_ino(BTRFS_I(inode));
2008
+ __entry->rootid =
2009
+ BTRFS_I(inode)->root->root_key.objectid;
2010
+ } else {
2011
+ __entry->ino = 0;
2012
+ __entry->rootid = 0;
2013
+ }
2014
+ __entry->start = start;
2015
+ __entry->len = len;
2016
+ __entry->set_bits = set_bits;
2017
+ __entry->clear_bits = clear_bits;
2018
+ ),
2019
+
2020
+ TP_printk_btrfs(
2021
+"io_tree=%s ino=%llu root=%llu start=%llu len=%llu set_bits=%s clear_bits=%s",
2022
+ __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino,
2023
+ __entry->rootid, __entry->start, __entry->len,
2024
+ __print_flags(__entry->set_bits , "|", EXTENT_FLAGS),
2025
+ __print_flags(__entry->clear_bits, "|", EXTENT_FLAGS))
2026
+);
2027
+
2028
+DECLARE_EVENT_CLASS(btrfs_sleep_tree_lock,
2029
+ TP_PROTO(const struct extent_buffer *eb, u64 start_ns),
2030
+
2031
+ TP_ARGS(eb, start_ns),
2032
+
2033
+ TP_STRUCT__entry_btrfs(
2034
+ __field( u64, block )
2035
+ __field( u64, generation )
2036
+ __field( u64, start_ns )
2037
+ __field( u64, end_ns )
2038
+ __field( u64, diff_ns )
2039
+ __field( u64, owner )
2040
+ __field( int, is_log_tree )
2041
+ ),
2042
+
2043
+ TP_fast_assign_btrfs(eb->fs_info,
2044
+ __entry->block = eb->start;
2045
+ __entry->generation = btrfs_header_generation(eb);
2046
+ __entry->start_ns = start_ns;
2047
+ __entry->end_ns = ktime_get_ns();
2048
+ __entry->diff_ns = __entry->end_ns - start_ns;
2049
+ __entry->owner = btrfs_header_owner(eb);
2050
+ __entry->is_log_tree = (eb->log_index >= 0);
2051
+ ),
2052
+
2053
+ TP_printk_btrfs(
2054
+"block=%llu generation=%llu start_ns=%llu end_ns=%llu diff_ns=%llu owner=%llu is_log_tree=%d",
2055
+ __entry->block, __entry->generation,
2056
+ __entry->start_ns, __entry->end_ns, __entry->diff_ns,
2057
+ __entry->owner, __entry->is_log_tree)
2058
+);
2059
+
2060
+DEFINE_EVENT(btrfs_sleep_tree_lock, btrfs_tree_read_lock,
2061
+ TP_PROTO(const struct extent_buffer *eb, u64 start_ns),
2062
+
2063
+ TP_ARGS(eb, start_ns)
2064
+);
2065
+
2066
+DEFINE_EVENT(btrfs_sleep_tree_lock, btrfs_tree_lock,
2067
+ TP_PROTO(const struct extent_buffer *eb, u64 start_ns),
2068
+
2069
+ TP_ARGS(eb, start_ns)
2070
+);
2071
+
2072
+DECLARE_EVENT_CLASS(btrfs_locking_events,
2073
+ TP_PROTO(const struct extent_buffer *eb),
2074
+
2075
+ TP_ARGS(eb),
2076
+
2077
+ TP_STRUCT__entry_btrfs(
2078
+ __field( u64, block )
2079
+ __field( u64, generation )
2080
+ __field( u64, owner )
2081
+ __field( int, is_log_tree )
2082
+ ),
2083
+
2084
+ TP_fast_assign_btrfs(eb->fs_info,
2085
+ __entry->block = eb->start;
2086
+ __entry->generation = btrfs_header_generation(eb);
2087
+ __entry->owner = btrfs_header_owner(eb);
2088
+ __entry->is_log_tree = (eb->log_index >= 0);
2089
+ ),
2090
+
2091
+ TP_printk_btrfs("block=%llu generation=%llu owner=%llu is_log_tree=%d",
2092
+ __entry->block, __entry->generation,
2093
+ __entry->owner, __entry->is_log_tree)
2094
+);
2095
+
2096
+#define DEFINE_BTRFS_LOCK_EVENT(name) \
2097
+DEFINE_EVENT(btrfs_locking_events, name, \
2098
+ TP_PROTO(const struct extent_buffer *eb), \
2099
+ \
2100
+ TP_ARGS(eb) \
2101
+)
2102
+
2103
+DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_unlock);
2104
+DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock);
2105
+DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock_blocking);
2106
+DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_read);
2107
+DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_write);
2108
+DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_read_lock);
2109
+DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_write_lock);
2110
+DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_lock_atomic);
2111
+
2112
+DECLARE_EVENT_CLASS(btrfs__space_info_update,
2113
+
2114
+ TP_PROTO(const struct btrfs_fs_info *fs_info,
2115
+ const struct btrfs_space_info *sinfo, u64 old, s64 diff),
2116
+
2117
+ TP_ARGS(fs_info, sinfo, old, diff),
2118
+
2119
+ TP_STRUCT__entry_btrfs(
2120
+ __field( u64, type )
2121
+ __field( u64, old )
2122
+ __field( s64, diff )
2123
+ ),
2124
+
2125
+ TP_fast_assign_btrfs(fs_info,
2126
+ __entry->type = sinfo->flags;
2127
+ __entry->old = old;
2128
+ __entry->diff = diff;
2129
+ ),
2130
+ TP_printk_btrfs("type=%s old=%llu diff=%lld",
2131
+ __print_flags(__entry->type, "|", BTRFS_GROUP_FLAGS),
2132
+ __entry->old, __entry->diff)
2133
+);
2134
+
2135
+DEFINE_EVENT(btrfs__space_info_update, update_bytes_may_use,
2136
+
2137
+ TP_PROTO(const struct btrfs_fs_info *fs_info,
2138
+ const struct btrfs_space_info *sinfo, u64 old, s64 diff),
2139
+
2140
+ TP_ARGS(fs_info, sinfo, old, diff)
2141
+);
2142
+
2143
+DEFINE_EVENT(btrfs__space_info_update, update_bytes_pinned,
2144
+
2145
+ TP_PROTO(const struct btrfs_fs_info *fs_info,
2146
+ const struct btrfs_space_info *sinfo, u64 old, s64 diff),
2147
+
2148
+ TP_ARGS(fs_info, sinfo, old, diff)
2149
+);
2150
+
18582151 #endif /* _TRACE_BTRFS_H */
18592152
18602153 /* This part must be outside protection */