Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
1abe9b8a | 2 | #undef TRACE_SYSTEM |
3 | #define TRACE_SYSTEM btrfs | |
4 | ||
5 | #if !defined(_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ) | |
6 | #define _TRACE_BTRFS_H | |
7 | ||
8 | #include <linux/writeback.h> | |
9 | #include <linux/tracepoint.h> | |
420adbe9 | 10 | #include <trace/events/mmflags.h> |
1abe9b8a | 11 | |
12 | struct btrfs_root; | |
13 | struct btrfs_fs_info; | |
14 | struct btrfs_inode; | |
15 | struct extent_map; | |
09ed2f16 | 16 | struct btrfs_file_extent_item; |
1abe9b8a | 17 | struct btrfs_ordered_extent; |
18 | struct btrfs_delayed_ref_node; | |
19 | struct btrfs_delayed_tree_ref; | |
1abe9b8a | 20 | struct btrfs_delayed_ref_head; |
32da5386 | 21 | struct btrfs_block_group; |
3f7de037 | 22 | struct btrfs_free_cluster; |
7dc66abb | 23 | struct btrfs_chunk_map; |
1abe9b8a | 24 | struct extent_buffer; |
52483bc2 | 25 | struct btrfs_work; |
a31b4a43 | 26 | struct btrfs_workqueue; |
0f5dcf8d | 27 | struct btrfs_qgroup_extent_record; |
3159fe7b | 28 | struct btrfs_qgroup; |
a1d19847 | 29 | struct extent_io_tree; |
00142756 | 30 | struct prelim_ref; |
480b9b4d | 31 | struct btrfs_space_info; |
b8bea09a QW |
32 | struct btrfs_raid_bio; |
33 | struct raid56_bio_trace_info; | |
cfc2de0f | 34 | struct find_free_extent_ctl; |
1abe9b8a | 35 | |
36 | #define show_ref_type(type) \ | |
37 | __print_symbolic(type, \ | |
38 | { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \ | |
39 | { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \ | |
1abe9b8a | 40 | { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \ |
41 | { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" }) | |
42 | ||
43 | #define __show_root_type(obj) \ | |
7f34b746 | 44 | __print_symbolic_u64(obj, \ |
1abe9b8a | 45 | { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ |
46 | { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ | |
47 | { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ | |
48 | { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \ | |
49 | { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \ | |
50 | { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \ | |
51 | { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \ | |
52 | { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ | |
e112e2b4 | 53 | { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \ |
1abe9b8a | 54 | { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ |
208acb8c OS |
55 | { BTRFS_UUID_TREE_OBJECTID, "UUID_TREE" }, \ |
56 | { BTRFS_FREE_SPACE_TREE_OBJECTID, "FREE_SPACE_TREE" }, \ | |
9c54e80d | 57 | { BTRFS_BLOCK_GROUP_TREE_OBJECTID, "BLOCK_GROUP_TREE" },\ |
1abe9b8a | 58 | { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) |
59 | ||
60 | #define show_root_type(obj) \ | |
61 | obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ | |
fb57dc81 | 62 | (obj >= BTRFS_ROOT_TREE_OBJECTID && \ |
e112e2b4 | 63 | obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-" |
1abe9b8a | 64 | |
5bca2c95 NB |
65 | #define FLUSH_ACTIONS \ |
66 | EM( BTRFS_RESERVE_NO_FLUSH, "BTRFS_RESERVE_NO_FLUSH") \ | |
67 | EM( BTRFS_RESERVE_FLUSH_LIMIT, "BTRFS_RESERVE_FLUSH_LIMIT") \ | |
68 | EM( BTRFS_RESERVE_FLUSH_ALL, "BTRFS_RESERVE_FLUSH_ALL") \ | |
69 | EMe(BTRFS_RESERVE_FLUSH_ALL_STEAL, "BTRFS_RESERVE_FLUSH_ALL_STEAL") | |
70 | ||
0840dd28 NB |
71 | #define FI_TYPES \ |
72 | EM( BTRFS_FILE_EXTENT_INLINE, "INLINE") \ | |
73 | EM( BTRFS_FILE_EXTENT_REG, "REG") \ | |
74 | EMe(BTRFS_FILE_EXTENT_PREALLOC, "PREALLOC") | |
75 | ||
1cb1f0b2 NB |
76 | #define QGROUP_RSV_TYPES \ |
77 | EM( BTRFS_QGROUP_RSV_DATA, "DATA") \ | |
78 | EM( BTRFS_QGROUP_RSV_META_PERTRANS, "META_PERTRANS") \ | |
79 | EMe(BTRFS_QGROUP_RSV_META_PREALLOC, "META_PREALLOC") | |
80 | ||
c92bb304 NB |
81 | #define IO_TREE_OWNER \ |
82 | EM( IO_TREE_FS_PINNED_EXTENTS, "PINNED_EXTENTS") \ | |
83 | EM( IO_TREE_FS_EXCLUDED_EXTENTS, "EXCLUDED_EXTENTS") \ | |
2c53a14d | 84 | EM( IO_TREE_BTREE_INODE_IO, "BTREE_INODE_IO") \ |
c92bb304 | 85 | EM( IO_TREE_INODE_IO, "INODE_IO") \ |
c92bb304 NB |
86 | EM( IO_TREE_RELOC_BLOCKS, "RELOC_BLOCKS") \ |
87 | EM( IO_TREE_TRANS_DIRTY_PAGES, "TRANS_DIRTY_PAGES") \ | |
88 | EM( IO_TREE_ROOT_DIRTY_LOG_PAGES, "ROOT_DIRTY_LOG_PAGES") \ | |
89 | EM( IO_TREE_INODE_FILE_EXTENT, "INODE_FILE_EXTENT") \ | |
90 | EM( IO_TREE_LOG_CSUM_RANGE, "LOG_CSUM_RANGE") \ | |
91 | EMe(IO_TREE_SELFTEST, "SELFTEST") | |
92 | ||
f0cdd15c NB |
93 | #define FLUSH_STATES \ |
94 | EM( FLUSH_DELAYED_ITEMS_NR, "FLUSH_DELAYED_ITEMS_NR") \ | |
95 | EM( FLUSH_DELAYED_ITEMS, "FLUSH_DELAYED_ITEMS") \ | |
96 | EM( FLUSH_DELALLOC, "FLUSH_DELALLOC") \ | |
97 | EM( FLUSH_DELALLOC_WAIT, "FLUSH_DELALLOC_WAIT") \ | |
03fe78cc | 98 | EM( FLUSH_DELALLOC_FULL, "FLUSH_DELALLOC_FULL") \ |
f0cdd15c | 99 | EM( FLUSH_DELAYED_REFS_NR, "FLUSH_DELAYED_REFS_NR") \ |
0a3212de | 100 | EM( FLUSH_DELAYED_REFS, "FLUSH_DELAYED_REFS") \ |
f0cdd15c NB |
101 | EM( ALLOC_CHUNK, "ALLOC_CHUNK") \ |
102 | EM( ALLOC_CHUNK_FORCE, "ALLOC_CHUNK_FORCE") \ | |
103 | EM( RUN_DELAYED_IPUTS, "RUN_DELAYED_IPUTS") \ | |
c416a30c | 104 | EMe(COMMIT_TRANS, "COMMIT_TRANS") |
f0cdd15c | 105 | |
5bca2c95 NB |
106 | /* |
107 | * First define the enums in the above macros to be exported to userspace via | |
108 | * TRACE_DEFINE_ENUM(). | |
109 | */ | |
110 | ||
0840dd28 NB |
111 | #undef EM |
112 | #undef EMe | |
113 | #define EM(a, b) TRACE_DEFINE_ENUM(a); | |
114 | #define EMe(a, b) TRACE_DEFINE_ENUM(a); | |
115 | ||
5bca2c95 | 116 | FLUSH_ACTIONS |
0840dd28 | 117 | FI_TYPES |
1cb1f0b2 | 118 | QGROUP_RSV_TYPES |
c92bb304 | 119 | IO_TREE_OWNER |
f0cdd15c | 120 | FLUSH_STATES |
0840dd28 | 121 | |
5bca2c95 NB |
122 | /* |
123 | * Now redefine the EM and EMe macros to map the enums to the strings that will | |
124 | * be printed in the output | |
125 | */ | |
126 | ||
0840dd28 NB |
127 | #undef EM |
128 | #undef EMe | |
129 | #define EM(a, b) {a, b}, | |
130 | #define EMe(a, b) {a, b} | |
09ed2f16 | 131 | |
a1d19847 | 132 | |
3f7de037 | 133 | #define BTRFS_GROUP_FLAGS \ |
e112e2b4 LB |
134 | { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \ |
135 | { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ | |
136 | { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ | |
137 | { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \ | |
138 | { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \ | |
139 | { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \ | |
140 | { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ | |
141 | { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \ | |
142 | { BTRFS_BLOCK_GROUP_RAID6, "RAID6"} | |
3f7de037 | 143 | |
a1d19847 QW |
144 | #define EXTENT_FLAGS \ |
145 | { EXTENT_DIRTY, "DIRTY"}, \ | |
a1d19847 QW |
146 | { EXTENT_UPTODATE, "UPTODATE"}, \ |
147 | { EXTENT_LOCKED, "LOCKED"}, \ | |
148 | { EXTENT_NEW, "NEW"}, \ | |
149 | { EXTENT_DELALLOC, "DELALLOC"}, \ | |
150 | { EXTENT_DEFRAG, "DEFRAG"}, \ | |
151 | { EXTENT_BOUNDARY, "BOUNDARY"}, \ | |
152 | { EXTENT_NODATASUM, "NODATASUM"}, \ | |
153 | { EXTENT_CLEAR_META_RESV, "CLEAR_META_RESV"}, \ | |
154 | { EXTENT_NEED_WAIT, "NEED_WAIT"}, \ | |
a1d19847 QW |
155 | { EXTENT_NORESERVE, "NORESERVE"}, \ |
156 | { EXTENT_QGROUP_RESERVED, "QGROUP_RESERVED"}, \ | |
157 | { EXTENT_CLEAR_DATA_RESV, "CLEAR_DATA_RESV"}, \ | |
158 | { EXTENT_DELALLOC_NEW, "DELALLOC_NEW"} | |
159 | ||
b94417ea AJ |
160 | #define BTRFS_FSID_SIZE 16 |
161 | #define TP_STRUCT__entry_fsid __array(u8, fsid, BTRFS_FSID_SIZE) | |
bc074524 JM |
162 | |
163 | #define TP_fast_assign_fsid(fs_info) \ | |
a1d19847 QW |
164 | ({ \ |
165 | if (fs_info) \ | |
166 | memcpy(__entry->fsid, fs_info->fs_devices->fsid, \ | |
167 | BTRFS_FSID_SIZE); \ | |
168 | else \ | |
169 | memset(__entry->fsid, 0, BTRFS_FSID_SIZE); \ | |
170 | }) | |
bc074524 JM |
171 | |
172 | #define TP_STRUCT__entry_btrfs(args...) \ | |
173 | TP_STRUCT__entry( \ | |
174 | TP_STRUCT__entry_fsid \ | |
175 | args) | |
176 | #define TP_fast_assign_btrfs(fs_info, args...) \ | |
177 | TP_fast_assign( \ | |
178 | TP_fast_assign_fsid(fs_info); \ | |
179 | args) | |
180 | #define TP_printk_btrfs(fmt, args...) \ | |
181 | TP_printk("%pU: " fmt, __entry->fsid, args) | |
8c2a3ca2 | 182 | |
1abe9b8a | 183 | TRACE_EVENT(btrfs_transaction_commit, |
184 | ||
2e4e97ab | 185 | TP_PROTO(const struct btrfs_fs_info *fs_info), |
1abe9b8a | 186 | |
2e4e97ab | 187 | TP_ARGS(fs_info), |
1abe9b8a | 188 | |
bc074524 | 189 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 190 | __field( u64, generation ) |
191 | __field( u64, root_objectid ) | |
192 | ), | |
193 | ||
2e4e97ab JB |
194 | TP_fast_assign_btrfs(fs_info, |
195 | __entry->generation = fs_info->generation; | |
196 | __entry->root_objectid = BTRFS_ROOT_TREE_OBJECTID; | |
1abe9b8a | 197 | ), |
198 | ||
79bcb71a | 199 | TP_printk_btrfs("root=%llu(%s) gen=%llu", |
1abe9b8a | 200 | show_root_type(__entry->root_objectid), |
8eec8463 | 201 | __entry->generation) |
1abe9b8a | 202 | ); |
203 | ||
204 | DECLARE_EVENT_CLASS(btrfs__inode, | |
205 | ||
9a35b637 | 206 | TP_PROTO(const struct inode *inode), |
1abe9b8a | 207 | |
208 | TP_ARGS(inode), | |
209 | ||
bc074524 | 210 | TP_STRUCT__entry_btrfs( |
f8f8e189 | 211 | __field( u64, ino ) |
94c3f6c6 | 212 | __field( u64, blocks ) |
1abe9b8a | 213 | __field( u64, disk_i_size ) |
214 | __field( u64, generation ) | |
215 | __field( u64, last_trans ) | |
216 | __field( u64, logged_trans ) | |
217 | __field( u64, root_objectid ) | |
218 | ), | |
219 | ||
bc074524 | 220 | TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), |
f8f8e189 | 221 | __entry->ino = btrfs_ino(BTRFS_I(inode)); |
1abe9b8a | 222 | __entry->blocks = inode->i_blocks; |
223 | __entry->disk_i_size = BTRFS_I(inode)->disk_i_size; | |
224 | __entry->generation = BTRFS_I(inode)->generation; | |
225 | __entry->last_trans = BTRFS_I(inode)->last_trans; | |
226 | __entry->logged_trans = BTRFS_I(inode)->logged_trans; | |
227 | __entry->root_objectid = | |
228 | BTRFS_I(inode)->root->root_key.objectid; | |
229 | ), | |
230 | ||
f8f8e189 | 231 | TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%llu blocks=%llu " |
562a7a07 | 232 | "disk_i_size=%llu last_trans=%llu logged_trans=%llu", |
1abe9b8a | 233 | show_root_type(__entry->root_objectid), |
8eec8463 DS |
234 | __entry->generation, |
235 | __entry->ino, | |
94c3f6c6 | 236 | __entry->blocks, |
8eec8463 DS |
237 | __entry->disk_i_size, |
238 | __entry->last_trans, | |
239 | __entry->logged_trans) | |
1abe9b8a | 240 | ); |
241 | ||
242 | DEFINE_EVENT(btrfs__inode, btrfs_inode_new, | |
243 | ||
9a35b637 | 244 | TP_PROTO(const struct inode *inode), |
1abe9b8a | 245 | |
246 | TP_ARGS(inode) | |
247 | ); | |
248 | ||
249 | DEFINE_EVENT(btrfs__inode, btrfs_inode_request, | |
250 | ||
9a35b637 | 251 | TP_PROTO(const struct inode *inode), |
1abe9b8a | 252 | |
253 | TP_ARGS(inode) | |
254 | ); | |
255 | ||
256 | DEFINE_EVENT(btrfs__inode, btrfs_inode_evict, | |
257 | ||
9a35b637 | 258 | TP_PROTO(const struct inode *inode), |
1abe9b8a | 259 | |
260 | TP_ARGS(inode) | |
261 | ); | |
262 | ||
263 | #define __show_map_type(type) \ | |
7f34b746 | 264 | __print_symbolic_u64(type, \ |
1abe9b8a | 265 | { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \ |
266 | { EXTENT_MAP_HOLE, "HOLE" }, \ | |
3c0e918b | 267 | { EXTENT_MAP_INLINE, "INLINE" }) |
1abe9b8a | 268 | |
269 | #define show_map_type(type) \ | |
270 | type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type) | |
271 | ||
272 | #define show_map_flags(flag) \ | |
273 | __print_flags(flag, "|", \ | |
f86f7a75 FM |
274 | { EXTENT_FLAG_PINNED, "PINNED" },\ |
275 | { EXTENT_FLAG_COMPRESS_ZLIB, "COMPRESS_ZLIB" },\ | |
276 | { EXTENT_FLAG_COMPRESS_LZO, "COMPRESS_LZO" },\ | |
277 | { EXTENT_FLAG_COMPRESS_ZSTD, "COMPRESS_ZSTD" },\ | |
278 | { EXTENT_FLAG_PREALLOC, "PREALLOC" },\ | |
2e438442 | 279 | { EXTENT_FLAG_LOGGING, "LOGGING" }) |
1abe9b8a | 280 | |
4cd8587c | 281 | TRACE_EVENT_CONDITION(btrfs_get_extent, |
1abe9b8a | 282 | |
9a35b637 JM |
283 | TP_PROTO(const struct btrfs_root *root, const struct btrfs_inode *inode, |
284 | const struct extent_map *map), | |
1abe9b8a | 285 | |
92a1bf76 | 286 | TP_ARGS(root, inode, map), |
1abe9b8a | 287 | |
4cd8587c SR |
288 | TP_CONDITION(map), |
289 | ||
bc074524 | 290 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 291 | __field( u64, root_objectid ) |
92a1bf76 | 292 | __field( u64, ino ) |
1abe9b8a | 293 | __field( u64, start ) |
294 | __field( u64, len ) | |
295 | __field( u64, orig_start ) | |
296 | __field( u64, block_start ) | |
297 | __field( u64, block_len ) | |
f86f7a75 | 298 | __field( u32, flags ) |
1abe9b8a | 299 | __field( int, refs ) |
1abe9b8a | 300 | ), |
301 | ||
bc074524 | 302 | TP_fast_assign_btrfs(root->fs_info, |
1abe9b8a | 303 | __entry->root_objectid = root->root_key.objectid; |
92a1bf76 LB |
304 | __entry->ino = btrfs_ino(inode); |
305 | __entry->start = map->start; | |
1abe9b8a | 306 | __entry->len = map->len; |
307 | __entry->orig_start = map->orig_start; | |
308 | __entry->block_start = map->block_start; | |
309 | __entry->block_len = map->block_len; | |
310 | __entry->flags = map->flags; | |
490b54d6 | 311 | __entry->refs = refcount_read(&map->refs); |
1abe9b8a | 312 | ), |
313 | ||
562a7a07 DS |
314 | TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu " |
315 | "orig_start=%llu block_start=%llu(%s) " | |
f86f7a75 | 316 | "block_len=%llu flags=%s refs=%u", |
1abe9b8a | 317 | show_root_type(__entry->root_objectid), |
8eec8463 DS |
318 | __entry->ino, |
319 | __entry->start, | |
320 | __entry->len, | |
321 | __entry->orig_start, | |
1abe9b8a | 322 | show_map_type(__entry->block_start), |
8eec8463 | 323 | __entry->block_len, |
1abe9b8a | 324 | show_map_flags(__entry->flags), |
f86f7a75 | 325 | __entry->refs) |
1abe9b8a | 326 | ); |
327 | ||
393da918 LB |
328 | TRACE_EVENT(btrfs_handle_em_exist, |
329 | ||
1d2e7c7c | 330 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
f46b24c9 DS |
331 | const struct extent_map *existing, const struct extent_map *map, |
332 | u64 start, u64 len), | |
393da918 | 333 | |
f46b24c9 | 334 | TP_ARGS(fs_info, existing, map, start, len), |
393da918 | 335 | |
f46b24c9 | 336 | TP_STRUCT__entry_btrfs( |
393da918 LB |
337 | __field( u64, e_start ) |
338 | __field( u64, e_len ) | |
339 | __field( u64, map_start ) | |
340 | __field( u64, map_len ) | |
341 | __field( u64, start ) | |
342 | __field( u64, len ) | |
343 | ), | |
344 | ||
f46b24c9 | 345 | TP_fast_assign_btrfs(fs_info, |
393da918 LB |
346 | __entry->e_start = existing->start; |
347 | __entry->e_len = existing->len; | |
348 | __entry->map_start = map->start; | |
349 | __entry->map_len = map->len; | |
350 | __entry->start = start; | |
351 | __entry->len = len; | |
352 | ), | |
353 | ||
f46b24c9 | 354 | TP_printk_btrfs("start=%llu len=%llu " |
393da918 LB |
355 | "existing(start=%llu len=%llu) " |
356 | "em(start=%llu len=%llu)", | |
8eec8463 DS |
357 | __entry->start, |
358 | __entry->len, | |
359 | __entry->e_start, | |
360 | __entry->e_len, | |
361 | __entry->map_start, | |
362 | __entry->map_len) | |
393da918 LB |
363 | ); |
364 | ||
09ed2f16 LB |
365 | /* file extent item */ |
366 | DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular, | |
367 | ||
1d2e7c7c DS |
368 | TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, |
369 | const struct btrfs_file_extent_item *fi, u64 start), | |
09ed2f16 LB |
370 | |
371 | TP_ARGS(bi, l, fi, start), | |
372 | ||
373 | TP_STRUCT__entry_btrfs( | |
374 | __field( u64, root_obj ) | |
375 | __field( u64, ino ) | |
376 | __field( loff_t, isize ) | |
377 | __field( u64, disk_isize ) | |
378 | __field( u64, num_bytes ) | |
379 | __field( u64, ram_bytes ) | |
380 | __field( u64, disk_bytenr ) | |
381 | __field( u64, disk_num_bytes ) | |
382 | __field( u64, extent_offset ) | |
383 | __field( u8, extent_type ) | |
384 | __field( u8, compression ) | |
385 | __field( u64, extent_start ) | |
386 | __field( u64, extent_end ) | |
387 | ), | |
388 | ||
389 | TP_fast_assign_btrfs(bi->root->fs_info, | |
4fd786e6 | 390 | __entry->root_obj = bi->root->root_key.objectid; |
09ed2f16 LB |
391 | __entry->ino = btrfs_ino(bi); |
392 | __entry->isize = bi->vfs_inode.i_size; | |
393 | __entry->disk_isize = bi->disk_i_size; | |
394 | __entry->num_bytes = btrfs_file_extent_num_bytes(l, fi); | |
395 | __entry->ram_bytes = btrfs_file_extent_ram_bytes(l, fi); | |
396 | __entry->disk_bytenr = btrfs_file_extent_disk_bytenr(l, fi); | |
397 | __entry->disk_num_bytes = btrfs_file_extent_disk_num_bytes(l, fi); | |
398 | __entry->extent_offset = btrfs_file_extent_offset(l, fi); | |
399 | __entry->extent_type = btrfs_file_extent_type(l, fi); | |
400 | __entry->compression = btrfs_file_extent_compression(l, fi); | |
401 | __entry->extent_start = start; | |
402 | __entry->extent_end = (start + __entry->num_bytes); | |
403 | ), | |
404 | ||
405 | TP_printk_btrfs( | |
406 | "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu " | |
407 | "file extent range=[%llu %llu] " | |
408 | "(num_bytes=%llu ram_bytes=%llu disk_bytenr=%llu " | |
409 | "disk_num_bytes=%llu extent_offset=%llu type=%s " | |
410 | "compression=%u", | |
411 | show_root_type(__entry->root_obj), __entry->ino, | |
412 | __entry->isize, | |
413 | __entry->disk_isize, __entry->extent_start, | |
414 | __entry->extent_end, __entry->num_bytes, __entry->ram_bytes, | |
415 | __entry->disk_bytenr, __entry->disk_num_bytes, | |
0840dd28 | 416 | __entry->extent_offset, __print_symbolic(__entry->extent_type, FI_TYPES), |
09ed2f16 LB |
417 | __entry->compression) |
418 | ); | |
419 | ||
420 | DECLARE_EVENT_CLASS( | |
421 | btrfs__file_extent_item_inline, | |
422 | ||
1d2e7c7c DS |
423 | TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, |
424 | const struct btrfs_file_extent_item *fi, int slot, u64 start), | |
09ed2f16 LB |
425 | |
426 | TP_ARGS(bi, l, fi, slot, start), | |
427 | ||
428 | TP_STRUCT__entry_btrfs( | |
429 | __field( u64, root_obj ) | |
430 | __field( u64, ino ) | |
431 | __field( loff_t, isize ) | |
432 | __field( u64, disk_isize ) | |
433 | __field( u8, extent_type ) | |
434 | __field( u8, compression ) | |
435 | __field( u64, extent_start ) | |
436 | __field( u64, extent_end ) | |
437 | ), | |
438 | ||
439 | TP_fast_assign_btrfs( | |
440 | bi->root->fs_info, | |
4fd786e6 | 441 | __entry->root_obj = bi->root->root_key.objectid; |
09ed2f16 LB |
442 | __entry->ino = btrfs_ino(bi); |
443 | __entry->isize = bi->vfs_inode.i_size; | |
444 | __entry->disk_isize = bi->disk_i_size; | |
445 | __entry->extent_type = btrfs_file_extent_type(l, fi); | |
446 | __entry->compression = btrfs_file_extent_compression(l, fi); | |
447 | __entry->extent_start = start; | |
e41ca589 | 448 | __entry->extent_end = (start + btrfs_file_extent_ram_bytes(l, fi)); |
09ed2f16 LB |
449 | ), |
450 | ||
451 | TP_printk_btrfs( | |
452 | "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu " | |
453 | "file extent range=[%llu %llu] " | |
454 | "extent_type=%s compression=%u", | |
455 | show_root_type(__entry->root_obj), __entry->ino, __entry->isize, | |
456 | __entry->disk_isize, __entry->extent_start, | |
0840dd28 | 457 | __entry->extent_end, __print_symbolic(__entry->extent_type, FI_TYPES), |
09ed2f16 LB |
458 | __entry->compression) |
459 | ); | |
460 | ||
461 | DEFINE_EVENT( | |
462 | btrfs__file_extent_item_regular, btrfs_get_extent_show_fi_regular, | |
463 | ||
1d2e7c7c DS |
464 | TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, |
465 | const struct btrfs_file_extent_item *fi, u64 start), | |
09ed2f16 LB |
466 | |
467 | TP_ARGS(bi, l, fi, start) | |
468 | ); | |
469 | ||
470 | DEFINE_EVENT( | |
471 | btrfs__file_extent_item_regular, btrfs_truncate_show_fi_regular, | |
472 | ||
1d2e7c7c DS |
473 | TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, |
474 | const struct btrfs_file_extent_item *fi, u64 start), | |
09ed2f16 LB |
475 | |
476 | TP_ARGS(bi, l, fi, start) | |
477 | ); | |
478 | ||
479 | DEFINE_EVENT( | |
480 | btrfs__file_extent_item_inline, btrfs_get_extent_show_fi_inline, | |
481 | ||
1d2e7c7c DS |
482 | TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, |
483 | const struct btrfs_file_extent_item *fi, int slot, u64 start), | |
09ed2f16 LB |
484 | |
485 | TP_ARGS(bi, l, fi, slot, start) | |
486 | ); | |
487 | ||
488 | DEFINE_EVENT( | |
489 | btrfs__file_extent_item_inline, btrfs_truncate_show_fi_inline, | |
490 | ||
1d2e7c7c DS |
491 | TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, |
492 | const struct btrfs_file_extent_item *fi, int slot, u64 start), | |
09ed2f16 LB |
493 | |
494 | TP_ARGS(bi, l, fi, slot, start) | |
495 | ); | |
496 | ||
9d04a8ce LB |
497 | #define show_ordered_flags(flags) \ |
498 | __print_flags(flags, "|", \ | |
3c198fe0 | 499 | { (1 << BTRFS_ORDERED_REGULAR), "REGULAR" }, \ |
9d04a8ce | 500 | { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \ |
9d04a8ce | 501 | { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \ |
3c198fe0 | 502 | { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \ |
9d04a8ce | 503 | { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \ |
3c198fe0 QW |
504 | { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \ |
505 | { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \ | |
9d04a8ce | 506 | { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \ |
792ddef0 | 507 | { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" }) |
e112e2b4 | 508 | |
1abe9b8a | 509 | |
510 | DECLARE_EVENT_CLASS(btrfs__ordered_extent, | |
511 | ||
acbf1dd0 | 512 | TP_PROTO(const struct btrfs_inode *inode, |
9a35b637 | 513 | const struct btrfs_ordered_extent *ordered), |
1abe9b8a | 514 | |
515 | TP_ARGS(inode, ordered), | |
516 | ||
bc074524 | 517 | TP_STRUCT__entry_btrfs( |
f8f8e189 | 518 | __field( u64, ino ) |
1abe9b8a | 519 | __field( u64, file_offset ) |
520 | __field( u64, start ) | |
521 | __field( u64, len ) | |
522 | __field( u64, disk_len ) | |
523 | __field( u64, bytes_left ) | |
524 | __field( unsigned long, flags ) | |
525 | __field( int, compress_type ) | |
526 | __field( int, refs ) | |
527 | __field( u64, root_objectid ) | |
78566548 | 528 | __field( u64, truncated_len ) |
1abe9b8a | 529 | ), |
530 | ||
acbf1dd0 NB |
531 | TP_fast_assign_btrfs(inode->root->fs_info, |
532 | __entry->ino = btrfs_ino(inode); | |
1abe9b8a | 533 | __entry->file_offset = ordered->file_offset; |
bffe633e OS |
534 | __entry->start = ordered->disk_bytenr; |
535 | __entry->len = ordered->num_bytes; | |
536 | __entry->disk_len = ordered->disk_num_bytes; | |
1abe9b8a | 537 | __entry->bytes_left = ordered->bytes_left; |
538 | __entry->flags = ordered->flags; | |
539 | __entry->compress_type = ordered->compress_type; | |
e76edab7 | 540 | __entry->refs = refcount_read(&ordered->refs); |
acbf1dd0 | 541 | __entry->root_objectid = inode->root->root_key.objectid; |
78566548 | 542 | __entry->truncated_len = ordered->truncated_len; |
1abe9b8a | 543 | ), |
544 | ||
562a7a07 DS |
545 | TP_printk_btrfs("root=%llu(%s) ino=%llu file_offset=%llu " |
546 | "start=%llu len=%llu disk_len=%llu " | |
547 | "truncated_len=%llu " | |
548 | "bytes_left=%llu flags=%s compress_type=%d " | |
549 | "refs=%d", | |
1abe9b8a | 550 | show_root_type(__entry->root_objectid), |
8eec8463 DS |
551 | __entry->ino, |
552 | __entry->file_offset, | |
553 | __entry->start, | |
554 | __entry->len, | |
555 | __entry->disk_len, | |
556 | __entry->truncated_len, | |
557 | __entry->bytes_left, | |
1abe9b8a | 558 | show_ordered_flags(__entry->flags), |
559 | __entry->compress_type, __entry->refs) | |
560 | ); | |
561 | ||
562 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add, | |
563 | ||
acbf1dd0 | 564 | TP_PROTO(const struct btrfs_inode *inode, |
9a35b637 | 565 | const struct btrfs_ordered_extent *ordered), |
1abe9b8a | 566 | |
567 | TP_ARGS(inode, ordered) | |
568 | ); | |
569 | ||
570 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove, | |
571 | ||
acbf1dd0 | 572 | TP_PROTO(const struct btrfs_inode *inode, |
9a35b637 | 573 | const struct btrfs_ordered_extent *ordered), |
1abe9b8a | 574 | |
575 | TP_ARGS(inode, ordered) | |
576 | ); | |
577 | ||
578 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start, | |
579 | ||
acbf1dd0 | 580 | TP_PROTO(const struct btrfs_inode *inode, |
9a35b637 | 581 | const struct btrfs_ordered_extent *ordered), |
1abe9b8a | 582 | |
583 | TP_ARGS(inode, ordered) | |
584 | ); | |
585 | ||
586 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put, | |
587 | ||
acbf1dd0 | 588 | TP_PROTO(const struct btrfs_inode *inode, |
9a35b637 | 589 | const struct btrfs_ordered_extent *ordered), |
1abe9b8a | 590 | |
591 | TP_ARGS(inode, ordered) | |
592 | ); | |
593 | ||
5bea2508 JT |
594 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_lookup, |
595 | ||
596 | TP_PROTO(const struct btrfs_inode *inode, | |
597 | const struct btrfs_ordered_extent *ordered), | |
598 | ||
599 | TP_ARGS(inode, ordered) | |
600 | ); | |
601 | ||
602 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_lookup_range, | |
603 | ||
604 | TP_PROTO(const struct btrfs_inode *inode, | |
605 | const struct btrfs_ordered_extent *ordered), | |
606 | ||
607 | TP_ARGS(inode, ordered) | |
608 | ); | |
609 | ||
610 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_lookup_first_range, | |
611 | ||
612 | TP_PROTO(const struct btrfs_inode *inode, | |
613 | const struct btrfs_ordered_extent *ordered), | |
614 | ||
615 | TP_ARGS(inode, ordered) | |
616 | ); | |
617 | ||
618 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_lookup_for_logging, | |
619 | ||
620 | TP_PROTO(const struct btrfs_inode *inode, | |
621 | const struct btrfs_ordered_extent *ordered), | |
622 | ||
623 | TP_ARGS(inode, ordered) | |
624 | ); | |
625 | ||
626 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_lookup_first, | |
627 | ||
628 | TP_PROTO(const struct btrfs_inode *inode, | |
629 | const struct btrfs_ordered_extent *ordered), | |
630 | ||
631 | TP_ARGS(inode, ordered) | |
632 | ); | |
633 | ||
634 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_split, | |
635 | ||
636 | TP_PROTO(const struct btrfs_inode *inode, | |
637 | const struct btrfs_ordered_extent *ordered), | |
638 | ||
639 | TP_ARGS(inode, ordered) | |
640 | ); | |
641 | ||
642 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_dec_test_pending, | |
643 | ||
644 | TP_PROTO(const struct btrfs_inode *inode, | |
645 | const struct btrfs_ordered_extent *ordered), | |
646 | ||
647 | TP_ARGS(inode, ordered) | |
648 | ); | |
649 | ||
650 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_mark_finished, | |
651 | ||
652 | TP_PROTO(const struct btrfs_inode *inode, | |
653 | const struct btrfs_ordered_extent *ordered), | |
654 | ||
655 | TP_ARGS(inode, ordered) | |
656 | ); | |
657 | ||
122e9ede CH |
658 | TRACE_EVENT(btrfs_finish_ordered_extent, |
659 | ||
660 | TP_PROTO(const struct btrfs_inode *inode, u64 start, u64 len, | |
661 | bool uptodate), | |
662 | ||
663 | TP_ARGS(inode, start, len, uptodate), | |
664 | ||
665 | TP_STRUCT__entry_btrfs( | |
666 | __field( u64, ino ) | |
667 | __field( u64, start ) | |
668 | __field( u64, len ) | |
669 | __field( bool, uptodate ) | |
670 | __field( u64, root_objectid ) | |
671 | ), | |
672 | ||
673 | TP_fast_assign_btrfs(inode->root->fs_info, | |
674 | __entry->ino = btrfs_ino(inode); | |
675 | __entry->start = start; | |
676 | __entry->len = len; | |
677 | __entry->uptodate = uptodate; | |
678 | __entry->root_objectid = inode->root->root_key.objectid; | |
679 | ), | |
680 | ||
681 | TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu uptodate=%d", | |
682 | show_root_type(__entry->root_objectid), | |
683 | __entry->ino, __entry->start, | |
684 | __entry->len, !!__entry->uptodate) | |
685 | ); | |
686 | ||
1abe9b8a | 687 | DECLARE_EVENT_CLASS(btrfs__writepage, |
688 | ||
9a35b637 JM |
689 | TP_PROTO(const struct page *page, const struct inode *inode, |
690 | const struct writeback_control *wbc), | |
1abe9b8a | 691 | |
692 | TP_ARGS(page, inode, wbc), | |
693 | ||
bc074524 | 694 | TP_STRUCT__entry_btrfs( |
f8f8e189 | 695 | __field( u64, ino ) |
1abe9b8a | 696 | __field( pgoff_t, index ) |
697 | __field( long, nr_to_write ) | |
698 | __field( long, pages_skipped ) | |
699 | __field( loff_t, range_start ) | |
700 | __field( loff_t, range_end ) | |
1abe9b8a | 701 | __field( char, for_kupdate ) |
702 | __field( char, for_reclaim ) | |
703 | __field( char, range_cyclic ) | |
94c3f6c6 | 704 | __field( unsigned long, writeback_index ) |
1abe9b8a | 705 | __field( u64, root_objectid ) |
706 | ), | |
707 | ||
bc074524 | 708 | TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), |
f8f8e189 | 709 | __entry->ino = btrfs_ino(BTRFS_I(inode)); |
1abe9b8a | 710 | __entry->index = page->index; |
711 | __entry->nr_to_write = wbc->nr_to_write; | |
712 | __entry->pages_skipped = wbc->pages_skipped; | |
713 | __entry->range_start = wbc->range_start; | |
714 | __entry->range_end = wbc->range_end; | |
1abe9b8a | 715 | __entry->for_kupdate = wbc->for_kupdate; |
716 | __entry->for_reclaim = wbc->for_reclaim; | |
717 | __entry->range_cyclic = wbc->range_cyclic; | |
718 | __entry->writeback_index = inode->i_mapping->writeback_index; | |
719 | __entry->root_objectid = | |
720 | BTRFS_I(inode)->root->root_key.objectid; | |
721 | ), | |
722 | ||
f8f8e189 | 723 | TP_printk_btrfs("root=%llu(%s) ino=%llu page_index=%lu " |
562a7a07 DS |
724 | "nr_to_write=%ld pages_skipped=%ld range_start=%llu " |
725 | "range_end=%llu for_kupdate=%d " | |
726 | "for_reclaim=%d range_cyclic=%d writeback_index=%lu", | |
1abe9b8a | 727 | show_root_type(__entry->root_objectid), |
8eec8463 | 728 | __entry->ino, __entry->index, |
1abe9b8a | 729 | __entry->nr_to_write, __entry->pages_skipped, |
730 | __entry->range_start, __entry->range_end, | |
846d5a09 | 731 | __entry->for_kupdate, |
1abe9b8a | 732 | __entry->for_reclaim, __entry->range_cyclic, |
94c3f6c6 | 733 | __entry->writeback_index) |
1abe9b8a | 734 | ); |
735 | ||
736 | DEFINE_EVENT(btrfs__writepage, __extent_writepage, | |
737 | ||
9a35b637 JM |
738 | TP_PROTO(const struct page *page, const struct inode *inode, |
739 | const struct writeback_control *wbc), | |
1abe9b8a | 740 | |
741 | TP_ARGS(page, inode, wbc) | |
742 | ); | |
743 | ||
744 | TRACE_EVENT(btrfs_writepage_end_io_hook, | |
745 | ||
38a39ac7 QW |
746 | TP_PROTO(const struct btrfs_inode *inode, u64 start, u64 end, |
747 | int uptodate), | |
1abe9b8a | 748 | |
38a39ac7 | 749 | TP_ARGS(inode, start, end, uptodate), |
1abe9b8a | 750 | |
bc074524 | 751 | TP_STRUCT__entry_btrfs( |
f8f8e189 | 752 | __field( u64, ino ) |
1abe9b8a | 753 | __field( u64, start ) |
754 | __field( u64, end ) | |
755 | __field( int, uptodate ) | |
756 | __field( u64, root_objectid ) | |
757 | ), | |
758 | ||
38a39ac7 QW |
759 | TP_fast_assign_btrfs(inode->root->fs_info, |
760 | __entry->ino = btrfs_ino(inode); | |
1abe9b8a | 761 | __entry->start = start; |
762 | __entry->end = end; | |
763 | __entry->uptodate = uptodate; | |
38a39ac7 | 764 | __entry->root_objectid = inode->root->root_key.objectid; |
1abe9b8a | 765 | ), |
766 | ||
38a39ac7 | 767 | TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu end=%llu uptodate=%d", |
1abe9b8a | 768 | show_root_type(__entry->root_objectid), |
38a39ac7 | 769 | __entry->ino, __entry->start, |
8eec8463 | 770 | __entry->end, __entry->uptodate) |
1abe9b8a | 771 | ); |
772 | ||
773 | TRACE_EVENT(btrfs_sync_file, | |
774 | ||
9a35b637 | 775 | TP_PROTO(const struct file *file, int datasync), |
1abe9b8a | 776 | |
777 | TP_ARGS(file, datasync), | |
778 | ||
bc074524 | 779 | TP_STRUCT__entry_btrfs( |
f8f8e189 DS |
780 | __field( u64, ino ) |
781 | __field( u64, parent ) | |
1abe9b8a | 782 | __field( int, datasync ) |
783 | __field( u64, root_objectid ) | |
784 | ), | |
785 | ||
786 | TP_fast_assign( | |
9a35b637 JM |
787 | const struct dentry *dentry = file->f_path.dentry; |
788 | const struct inode *inode = d_inode(dentry); | |
1abe9b8a | 789 | |
bc074524 | 790 | TP_fast_assign_fsid(btrfs_sb(file->f_path.dentry->d_sb)); |
f8f8e189 DS |
791 | __entry->ino = btrfs_ino(BTRFS_I(inode)); |
792 | __entry->parent = btrfs_ino(BTRFS_I(d_inode(dentry->d_parent))); | |
1abe9b8a | 793 | __entry->datasync = datasync; |
794 | __entry->root_objectid = | |
795 | BTRFS_I(inode)->root->root_key.objectid; | |
796 | ), | |
797 | ||
f8f8e189 | 798 | TP_printk_btrfs("root=%llu(%s) ino=%llu parent=%llu datasync=%d", |
1abe9b8a | 799 | show_root_type(__entry->root_objectid), |
8eec8463 DS |
800 | __entry->ino, |
801 | __entry->parent, | |
1abe9b8a | 802 | __entry->datasync) |
803 | ); | |
804 | ||
805 | TRACE_EVENT(btrfs_sync_fs, | |
806 | ||
9a35b637 | 807 | TP_PROTO(const struct btrfs_fs_info *fs_info, int wait), |
1abe9b8a | 808 | |
bc074524 | 809 | TP_ARGS(fs_info, wait), |
1abe9b8a | 810 | |
bc074524 | 811 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 812 | __field( int, wait ) |
813 | ), | |
814 | ||
bc074524 | 815 | TP_fast_assign_btrfs(fs_info, |
1abe9b8a | 816 | __entry->wait = wait; |
817 | ), | |
818 | ||
79bcb71a | 819 | TP_printk_btrfs("wait=%d", __entry->wait) |
1abe9b8a | 820 | ); |
821 | ||
c83f8eff JB |
822 | TRACE_EVENT(btrfs_add_block_group, |
823 | ||
9a35b637 | 824 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
32da5386 | 825 | const struct btrfs_block_group *block_group, int create), |
c83f8eff JB |
826 | |
827 | TP_ARGS(fs_info, block_group, create), | |
828 | ||
2e63e62d | 829 | TP_STRUCT__entry_btrfs( |
c83f8eff JB |
830 | __field( u64, offset ) |
831 | __field( u64, size ) | |
832 | __field( u64, flags ) | |
833 | __field( u64, bytes_used ) | |
834 | __field( u64, bytes_super ) | |
835 | __field( int, create ) | |
836 | ), | |
837 | ||
2e63e62d | 838 | TP_fast_assign_btrfs(fs_info, |
b3470b5d DS |
839 | __entry->offset = block_group->start; |
840 | __entry->size = block_group->length; | |
c83f8eff | 841 | __entry->flags = block_group->flags; |
bf38be65 | 842 | __entry->bytes_used = block_group->used; |
c83f8eff JB |
843 | __entry->bytes_super = block_group->bytes_super; |
844 | __entry->create = create; | |
845 | ), | |
846 | ||
2e63e62d | 847 | TP_printk_btrfs("block_group offset=%llu size=%llu " |
562a7a07 | 848 | "flags=%llu(%s) bytes_used=%llu bytes_super=%llu " |
2e63e62d | 849 | "create=%d", |
8eec8463 DS |
850 | __entry->offset, |
851 | __entry->size, | |
852 | __entry->flags, | |
c83f8eff JB |
853 | __print_flags((unsigned long)__entry->flags, "|", |
854 | BTRFS_GROUP_FLAGS), | |
8eec8463 DS |
855 | __entry->bytes_used, |
856 | __entry->bytes_super, __entry->create) | |
c83f8eff JB |
857 | ); |
858 | ||
1abe9b8a | 859 | #define show_ref_action(action) \ |
860 | __print_symbolic(action, \ | |
861 | { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \ | |
862 | { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \ | |
863 | { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \ | |
864 | { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" }) | |
865 | ||
866 | ||
599c75ec | 867 | DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref, |
1abe9b8a | 868 | |
9a35b637 | 869 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
1bff6d4f | 870 | const struct btrfs_delayed_ref_node *ref), |
1abe9b8a | 871 | |
1bff6d4f | 872 | TP_ARGS(fs_info, ref), |
1abe9b8a | 873 | |
bc074524 | 874 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 875 | __field( u64, bytenr ) |
876 | __field( u64, num_bytes ) | |
877 | __field( int, action ) | |
878 | __field( u64, parent ) | |
879 | __field( u64, ref_root ) | |
880 | __field( int, level ) | |
881 | __field( int, type ) | |
dea7d76e | 882 | __field( u64, seq ) |
1abe9b8a | 883 | ), |
884 | ||
bc074524 | 885 | TP_fast_assign_btrfs(fs_info, |
1abe9b8a | 886 | __entry->bytenr = ref->bytenr; |
887 | __entry->num_bytes = ref->num_bytes; | |
1bff6d4f | 888 | __entry->action = ref->action; |
cf4f0432 JB |
889 | __entry->parent = ref->parent; |
890 | __entry->ref_root = ref->ref_root; | |
1bff6d4f | 891 | __entry->level = ref->tree_ref.level; |
1abe9b8a | 892 | __entry->type = ref->type; |
dea7d76e | 893 | __entry->seq = ref->seq; |
1abe9b8a | 894 | ), |
895 | ||
562a7a07 DS |
896 | TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " |
897 | "parent=%llu(%s) ref_root=%llu(%s) level=%d " | |
898 | "type=%s seq=%llu", | |
8eec8463 DS |
899 | __entry->bytenr, |
900 | __entry->num_bytes, | |
1abe9b8a | 901 | show_ref_action(__entry->action), |
902 | show_root_type(__entry->parent), | |
903 | show_root_type(__entry->ref_root), | |
dea7d76e | 904 | __entry->level, show_ref_type(__entry->type), |
8eec8463 | 905 | __entry->seq) |
1abe9b8a | 906 | ); |
907 | ||
599c75ec LB |
908 | DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref, |
909 | ||
9a35b637 | 910 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
1bff6d4f | 911 | const struct btrfs_delayed_ref_node *ref), |
599c75ec | 912 | |
1bff6d4f | 913 | TP_ARGS(fs_info, ref) |
599c75ec LB |
914 | ); |
915 | ||
916 | DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref, | |
917 | ||
9a35b637 | 918 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
1bff6d4f | 919 | const struct btrfs_delayed_ref_node *ref), |
599c75ec | 920 | |
1bff6d4f | 921 | TP_ARGS(fs_info, ref) |
599c75ec LB |
922 | ); |
923 | ||
924 | DECLARE_EVENT_CLASS(btrfs_delayed_data_ref, | |
1abe9b8a | 925 | |
9a35b637 | 926 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
1bff6d4f | 927 | const struct btrfs_delayed_ref_node *ref), |
1abe9b8a | 928 | |
1bff6d4f | 929 | TP_ARGS(fs_info, ref), |
1abe9b8a | 930 | |
bc074524 | 931 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 932 | __field( u64, bytenr ) |
933 | __field( u64, num_bytes ) | |
934 | __field( int, action ) | |
935 | __field( u64, parent ) | |
936 | __field( u64, ref_root ) | |
937 | __field( u64, owner ) | |
938 | __field( u64, offset ) | |
939 | __field( int, type ) | |
dea7d76e | 940 | __field( u64, seq ) |
1abe9b8a | 941 | ), |
942 | ||
bc074524 | 943 | TP_fast_assign_btrfs(fs_info, |
1abe9b8a | 944 | __entry->bytenr = ref->bytenr; |
945 | __entry->num_bytes = ref->num_bytes; | |
1bff6d4f | 946 | __entry->action = ref->action; |
cf4f0432 JB |
947 | __entry->parent = ref->parent; |
948 | __entry->ref_root = ref->ref_root; | |
1bff6d4f JB |
949 | __entry->owner = ref->data_ref.objectid; |
950 | __entry->offset = ref->data_ref.offset; | |
1abe9b8a | 951 | __entry->type = ref->type; |
dea7d76e | 952 | __entry->seq = ref->seq; |
1abe9b8a | 953 | ), |
954 | ||
562a7a07 DS |
955 | TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " |
956 | "parent=%llu(%s) ref_root=%llu(%s) owner=%llu " | |
957 | "offset=%llu type=%s seq=%llu", | |
8eec8463 DS |
958 | __entry->bytenr, |
959 | __entry->num_bytes, | |
1abe9b8a | 960 | show_ref_action(__entry->action), |
961 | show_root_type(__entry->parent), | |
962 | show_root_type(__entry->ref_root), | |
8eec8463 DS |
963 | __entry->owner, |
964 | __entry->offset, | |
dea7d76e | 965 | show_ref_type(__entry->type), |
8eec8463 | 966 | __entry->seq) |
1abe9b8a | 967 | ); |
968 | ||
599c75ec LB |
969 | DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref, |
970 | ||
9a35b637 | 971 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
1bff6d4f | 972 | const struct btrfs_delayed_ref_node *ref), |
599c75ec | 973 | |
1bff6d4f | 974 | TP_ARGS(fs_info, ref) |
599c75ec LB |
975 | ); |
976 | ||
977 | DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref, | |
978 | ||
9a35b637 | 979 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
1bff6d4f | 980 | const struct btrfs_delayed_ref_node *ref), |
599c75ec | 981 | |
1bff6d4f | 982 | TP_ARGS(fs_info, ref) |
599c75ec LB |
983 | ); |
984 | ||
985 | DECLARE_EVENT_CLASS(btrfs_delayed_ref_head, | |
1abe9b8a | 986 | |
9a35b637 | 987 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
9a35b637 | 988 | const struct btrfs_delayed_ref_head *head_ref, |
1abe9b8a | 989 | int action), |
990 | ||
d278850e | 991 | TP_ARGS(fs_info, head_ref, action), |
1abe9b8a | 992 | |
bc074524 | 993 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 994 | __field( u64, bytenr ) |
995 | __field( u64, num_bytes ) | |
996 | __field( int, action ) | |
997 | __field( int, is_data ) | |
998 | ), | |
999 | ||
bc074524 | 1000 | TP_fast_assign_btrfs(fs_info, |
d278850e JB |
1001 | __entry->bytenr = head_ref->bytenr; |
1002 | __entry->num_bytes = head_ref->num_bytes; | |
1abe9b8a | 1003 | __entry->action = action; |
1004 | __entry->is_data = head_ref->is_data; | |
1005 | ), | |
1006 | ||
562a7a07 | 1007 | TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d", |
8eec8463 DS |
1008 | __entry->bytenr, |
1009 | __entry->num_bytes, | |
1abe9b8a | 1010 | show_ref_action(__entry->action), |
1011 | __entry->is_data) | |
1012 | ); | |
1013 | ||
599c75ec LB |
1014 | DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head, |
1015 | ||
9a35b637 | 1016 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
9a35b637 | 1017 | const struct btrfs_delayed_ref_head *head_ref, |
599c75ec LB |
1018 | int action), |
1019 | ||
d278850e | 1020 | TP_ARGS(fs_info, head_ref, action) |
599c75ec LB |
1021 | ); |
1022 | ||
1023 | DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head, | |
1024 | ||
9a35b637 | 1025 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
9a35b637 | 1026 | const struct btrfs_delayed_ref_head *head_ref, |
599c75ec LB |
1027 | int action), |
1028 | ||
d278850e | 1029 | TP_ARGS(fs_info, head_ref, action) |
599c75ec LB |
1030 | ); |
1031 | ||
1abe9b8a | 1032 | #define show_chunk_type(type) \ |
1033 | __print_flags(type, "|", \ | |
1034 | { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ | |
1035 | { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ | |
1036 | { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ | |
1037 | { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ | |
1038 | { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ | |
1039 | { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ | |
e112e2b4 LB |
1040 | { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ |
1041 | { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \ | |
1042 | { BTRFS_BLOCK_GROUP_RAID6, "RAID6" }) | |
1abe9b8a | 1043 | |
1044 | DECLARE_EVENT_CLASS(btrfs__chunk, | |
1045 | ||
9a35b637 | 1046 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
7dc66abb | 1047 | const struct btrfs_chunk_map *map, u64 offset, u64 size), |
1abe9b8a | 1048 | |
6bccf3ab | 1049 | TP_ARGS(fs_info, map, offset, size), |
1abe9b8a | 1050 | |
bc074524 | 1051 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 1052 | __field( int, num_stripes ) |
1053 | __field( u64, type ) | |
1054 | __field( int, sub_stripes ) | |
1055 | __field( u64, offset ) | |
1056 | __field( u64, size ) | |
1057 | __field( u64, root_objectid ) | |
1058 | ), | |
1059 | ||
6bccf3ab | 1060 | TP_fast_assign_btrfs(fs_info, |
1abe9b8a | 1061 | __entry->num_stripes = map->num_stripes; |
1062 | __entry->type = map->type; | |
1063 | __entry->sub_stripes = map->sub_stripes; | |
1064 | __entry->offset = offset; | |
1065 | __entry->size = size; | |
6bccf3ab | 1066 | __entry->root_objectid = fs_info->chunk_root->root_key.objectid; |
1abe9b8a | 1067 | ), |
1068 | ||
562a7a07 DS |
1069 | TP_printk_btrfs("root=%llu(%s) offset=%llu size=%llu " |
1070 | "num_stripes=%d sub_stripes=%d type=%s", | |
1abe9b8a | 1071 | show_root_type(__entry->root_objectid), |
8eec8463 DS |
1072 | __entry->offset, |
1073 | __entry->size, | |
1abe9b8a | 1074 | __entry->num_stripes, __entry->sub_stripes, |
1075 | show_chunk_type(__entry->type)) | |
1076 | ); | |
1077 | ||
1078 | DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc, | |
1079 | ||
9a35b637 | 1080 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
7dc66abb | 1081 | const struct btrfs_chunk_map *map, u64 offset, u64 size), |
1abe9b8a | 1082 | |
6bccf3ab | 1083 | TP_ARGS(fs_info, map, offset, size) |
1abe9b8a | 1084 | ); |
1085 | ||
1086 | DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free, | |
1087 | ||
9a35b637 | 1088 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
7dc66abb | 1089 | const struct btrfs_chunk_map *map, u64 offset, u64 size), |
1abe9b8a | 1090 | |
6bccf3ab | 1091 | TP_ARGS(fs_info, map, offset, size) |
1abe9b8a | 1092 | ); |
1093 | ||
1094 | TRACE_EVENT(btrfs_cow_block, | |
1095 | ||
9a35b637 JM |
1096 | TP_PROTO(const struct btrfs_root *root, const struct extent_buffer *buf, |
1097 | const struct extent_buffer *cow), | |
1abe9b8a | 1098 | |
1099 | TP_ARGS(root, buf, cow), | |
1100 | ||
bc074524 | 1101 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 1102 | __field( u64, root_objectid ) |
1103 | __field( u64, buf_start ) | |
1104 | __field( int, refs ) | |
1105 | __field( u64, cow_start ) | |
1106 | __field( int, buf_level ) | |
1107 | __field( int, cow_level ) | |
1108 | ), | |
1109 | ||
bc074524 | 1110 | TP_fast_assign_btrfs(root->fs_info, |
1abe9b8a | 1111 | __entry->root_objectid = root->root_key.objectid; |
1112 | __entry->buf_start = buf->start; | |
1113 | __entry->refs = atomic_read(&buf->refs); | |
1114 | __entry->cow_start = cow->start; | |
1115 | __entry->buf_level = btrfs_header_level(buf); | |
1116 | __entry->cow_level = btrfs_header_level(cow); | |
1117 | ), | |
1118 | ||
562a7a07 DS |
1119 | TP_printk_btrfs("root=%llu(%s) refs=%d orig_buf=%llu " |
1120 | "(orig_level=%d) cow_buf=%llu (cow_level=%d)", | |
1abe9b8a | 1121 | show_root_type(__entry->root_objectid), |
1122 | __entry->refs, | |
8eec8463 | 1123 | __entry->buf_start, |
1abe9b8a | 1124 | __entry->buf_level, |
8eec8463 | 1125 | __entry->cow_start, |
1abe9b8a | 1126 | __entry->cow_level) |
1127 | ); | |
1128 | ||
8c2a3ca2 JB |
1129 | TRACE_EVENT(btrfs_space_reservation, |
1130 | ||
1d2e7c7c | 1131 | TP_PROTO(const struct btrfs_fs_info *fs_info, const char *type, u64 val, |
8c2a3ca2 JB |
1132 | u64 bytes, int reserve), |
1133 | ||
1134 | TP_ARGS(fs_info, type, val, bytes, reserve), | |
1135 | ||
bc074524 | 1136 | TP_STRUCT__entry_btrfs( |
8c2a3ca2 JB |
1137 | __string( type, type ) |
1138 | __field( u64, val ) | |
1139 | __field( u64, bytes ) | |
1140 | __field( int, reserve ) | |
1141 | ), | |
1142 | ||
bc074524 | 1143 | TP_fast_assign_btrfs(fs_info, |
8c2a3ca2 JB |
1144 | __assign_str(type, type); |
1145 | __entry->val = val; | |
1146 | __entry->bytes = bytes; | |
1147 | __entry->reserve = reserve; | |
1148 | ), | |
1149 | ||
5439c7f5 | 1150 | TP_printk_btrfs("%s: %llu %s %llu", __get_str(type), __entry->val, |
bc074524 JM |
1151 | __entry->reserve ? "reserve" : "release", |
1152 | __entry->bytes) | |
8c2a3ca2 JB |
1153 | ); |
1154 | ||
f376df2b JB |
1155 | TRACE_EVENT(btrfs_trigger_flush, |
1156 | ||
9a35b637 | 1157 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes, |
1d2e7c7c | 1158 | int flush, const char *reason), |
f376df2b JB |
1159 | |
1160 | TP_ARGS(fs_info, flags, bytes, flush, reason), | |
1161 | ||
2e63e62d | 1162 | TP_STRUCT__entry_btrfs( |
f376df2b JB |
1163 | __field( u64, flags ) |
1164 | __field( u64, bytes ) | |
1165 | __field( int, flush ) | |
1166 | __string( reason, reason ) | |
1167 | ), | |
1168 | ||
2e63e62d | 1169 | TP_fast_assign_btrfs(fs_info, |
f376df2b JB |
1170 | __entry->flags = flags; |
1171 | __entry->bytes = bytes; | |
1172 | __entry->flush = flush; | |
78c14b38 | 1173 | __assign_str(reason, reason); |
f376df2b JB |
1174 | ), |
1175 | ||
2e63e62d DS |
1176 | TP_printk_btrfs("%s: flush=%d(%s) flags=%llu(%s) bytes=%llu", |
1177 | __get_str(reason), __entry->flush, | |
45e31869 | 1178 | __print_symbolic(__entry->flush, FLUSH_ACTIONS), |
8eec8463 | 1179 | __entry->flags, |
f376df2b JB |
1180 | __print_flags((unsigned long)__entry->flags, "|", |
1181 | BTRFS_GROUP_FLAGS), | |
8eec8463 | 1182 | __entry->bytes) |
f376df2b JB |
1183 | ); |
1184 | ||
f376df2b JB |
1185 | |
1186 | TRACE_EVENT(btrfs_flush_space, | |
1187 | ||
9a35b637 | 1188 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 num_bytes, |
4b02b00f | 1189 | int state, int ret, bool for_preempt), |
f376df2b | 1190 | |
4b02b00f | 1191 | TP_ARGS(fs_info, flags, num_bytes, state, ret, for_preempt), |
f376df2b | 1192 | |
2e63e62d | 1193 | TP_STRUCT__entry_btrfs( |
f376df2b JB |
1194 | __field( u64, flags ) |
1195 | __field( u64, num_bytes ) | |
f376df2b JB |
1196 | __field( int, state ) |
1197 | __field( int, ret ) | |
4b02b00f | 1198 | __field( bool, for_preempt ) |
f376df2b JB |
1199 | ), |
1200 | ||
2e63e62d | 1201 | TP_fast_assign_btrfs(fs_info, |
f376df2b JB |
1202 | __entry->flags = flags; |
1203 | __entry->num_bytes = num_bytes; | |
f376df2b JB |
1204 | __entry->state = state; |
1205 | __entry->ret = ret; | |
4b02b00f | 1206 | __entry->for_preempt = for_preempt; |
f376df2b JB |
1207 | ), |
1208 | ||
4b02b00f | 1209 | TP_printk_btrfs("state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d for_preempt=%d", |
2e63e62d | 1210 | __entry->state, |
f0cdd15c | 1211 | __print_symbolic(__entry->state, FLUSH_STATES), |
8eec8463 | 1212 | __entry->flags, |
f376df2b JB |
1213 | __print_flags((unsigned long)__entry->flags, "|", |
1214 | BTRFS_GROUP_FLAGS), | |
4b02b00f | 1215 | __entry->num_bytes, __entry->ret, __entry->for_preempt) |
f376df2b JB |
1216 | ); |
1217 | ||
1abe9b8a | 1218 | DECLARE_EVENT_CLASS(btrfs__reserved_extent, |
1219 | ||
9a35b637 | 1220 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), |
1abe9b8a | 1221 | |
71ff6437 | 1222 | TP_ARGS(fs_info, start, len), |
1abe9b8a | 1223 | |
bc074524 | 1224 | TP_STRUCT__entry_btrfs( |
bc074524 JM |
1225 | __field( u64, start ) |
1226 | __field( u64, len ) | |
1abe9b8a | 1227 | ), |
1228 | ||
71ff6437 | 1229 | TP_fast_assign_btrfs(fs_info, |
1abe9b8a | 1230 | __entry->start = start; |
1231 | __entry->len = len; | |
1232 | ), | |
1233 | ||
562a7a07 | 1234 | TP_printk_btrfs("root=%llu(%s) start=%llu len=%llu", |
71ff6437 | 1235 | show_root_type(BTRFS_EXTENT_TREE_OBJECTID), |
8eec8463 DS |
1236 | __entry->start, |
1237 | __entry->len) | |
1abe9b8a | 1238 | ); |
1239 | ||
1240 | DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc, | |
1241 | ||
9a35b637 | 1242 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), |
1abe9b8a | 1243 | |
71ff6437 | 1244 | TP_ARGS(fs_info, start, len) |
1abe9b8a | 1245 | ); |
1246 | ||
1247 | DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free, | |
1248 | ||
9a35b637 | 1249 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), |
1abe9b8a | 1250 | |
71ff6437 | 1251 | TP_ARGS(fs_info, start, len) |
1abe9b8a | 1252 | ); |
1253 | ||
3f7de037 JB |
1254 | TRACE_EVENT(find_free_extent, |
1255 | ||
cfc2de0f BB |
1256 | TP_PROTO(const struct btrfs_root *root, |
1257 | const struct find_free_extent_ctl *ffe_ctl), | |
3f7de037 | 1258 | |
cfc2de0f | 1259 | TP_ARGS(root, ffe_ctl), |
3f7de037 | 1260 | |
bc074524 | 1261 | TP_STRUCT__entry_btrfs( |
437490fe | 1262 | __field( u64, root_objectid ) |
3f7de037 JB |
1263 | __field( u64, num_bytes ) |
1264 | __field( u64, empty_size ) | |
cfc2de0f | 1265 | __field( u64, flags ) |
3f7de037 JB |
1266 | ), |
1267 | ||
437490fe QW |
1268 | TP_fast_assign_btrfs(root->fs_info, |
1269 | __entry->root_objectid = root->root_key.objectid; | |
cfc2de0f BB |
1270 | __entry->num_bytes = ffe_ctl->num_bytes; |
1271 | __entry->empty_size = ffe_ctl->empty_size; | |
1272 | __entry->flags = ffe_ctl->flags; | |
3f7de037 JB |
1273 | ), |
1274 | ||
5439c7f5 | 1275 | TP_printk_btrfs("root=%llu(%s) len=%llu empty_size=%llu flags=%llu(%s)", |
437490fe | 1276 | show_root_type(__entry->root_objectid), |
cfc2de0f BB |
1277 | __entry->num_bytes, __entry->empty_size, __entry->flags, |
1278 | __print_flags((unsigned long)__entry->flags, "|", | |
3f7de037 JB |
1279 | BTRFS_GROUP_FLAGS)) |
1280 | ); | |
1281 | ||
854c2f36 BB |
1282 | TRACE_EVENT(find_free_extent_search_loop, |
1283 | ||
1284 | TP_PROTO(const struct btrfs_root *root, | |
1285 | const struct find_free_extent_ctl *ffe_ctl), | |
1286 | ||
1287 | TP_ARGS(root, ffe_ctl), | |
1288 | ||
1289 | TP_STRUCT__entry_btrfs( | |
1290 | __field( u64, root_objectid ) | |
1291 | __field( u64, num_bytes ) | |
1292 | __field( u64, empty_size ) | |
1293 | __field( u64, flags ) | |
1294 | __field( u64, loop ) | |
1295 | ), | |
1296 | ||
1297 | TP_fast_assign_btrfs(root->fs_info, | |
1298 | __entry->root_objectid = root->root_key.objectid; | |
1299 | __entry->num_bytes = ffe_ctl->num_bytes; | |
1300 | __entry->empty_size = ffe_ctl->empty_size; | |
1301 | __entry->flags = ffe_ctl->flags; | |
1302 | __entry->loop = ffe_ctl->loop; | |
1303 | ), | |
1304 | ||
1305 | TP_printk_btrfs("root=%llu(%s) len=%llu empty_size=%llu flags=%llu(%s) loop=%llu", | |
1306 | show_root_type(__entry->root_objectid), | |
1307 | __entry->num_bytes, __entry->empty_size, __entry->flags, | |
1308 | __print_flags((unsigned long)__entry->flags, "|", BTRFS_GROUP_FLAGS), | |
1309 | __entry->loop) | |
1310 | ); | |
1311 | ||
1312 | TRACE_EVENT(find_free_extent_have_block_group, | |
1313 | ||
1314 | TP_PROTO(const struct btrfs_root *root, | |
1315 | const struct find_free_extent_ctl *ffe_ctl, | |
1316 | const struct btrfs_block_group *block_group), | |
1317 | ||
1318 | TP_ARGS(root, ffe_ctl, block_group), | |
1319 | ||
1320 | TP_STRUCT__entry_btrfs( | |
1321 | __field( u64, root_objectid ) | |
1322 | __field( u64, num_bytes ) | |
1323 | __field( u64, empty_size ) | |
1324 | __field( u64, flags ) | |
1325 | __field( u64, loop ) | |
1326 | __field( bool, hinted ) | |
1327 | __field( u64, bg_start ) | |
1328 | __field( u64, bg_flags ) | |
1329 | ), | |
1330 | ||
1331 | TP_fast_assign_btrfs(root->fs_info, | |
1332 | __entry->root_objectid = root->root_key.objectid; | |
1333 | __entry->num_bytes = ffe_ctl->num_bytes; | |
1334 | __entry->empty_size = ffe_ctl->empty_size; | |
1335 | __entry->flags = ffe_ctl->flags; | |
1336 | __entry->loop = ffe_ctl->loop; | |
1337 | __entry->hinted = ffe_ctl->hinted; | |
1338 | __entry->bg_start = block_group->start; | |
1339 | __entry->bg_flags = block_group->flags; | |
1340 | ), | |
1341 | ||
1342 | TP_printk_btrfs( | |
1343 | "root=%llu(%s) len=%llu empty_size=%llu flags=%llu(%s) loop=%llu hinted=%d block_group=%llu bg_flags=%llu(%s)", | |
1344 | show_root_type(__entry->root_objectid), | |
1345 | __entry->num_bytes, __entry->empty_size, __entry->flags, | |
1346 | __print_flags((unsigned long)__entry->flags, "|", BTRFS_GROUP_FLAGS), | |
1347 | __entry->loop, __entry->hinted, | |
1348 | __entry->bg_start, __entry->bg_flags, | |
1349 | __print_flags((unsigned long)__entry->bg_flags, "|", | |
1350 | BTRFS_GROUP_FLAGS)) | |
1351 | ); | |
1352 | ||
3f7de037 JB |
1353 | DECLARE_EVENT_CLASS(btrfs__reserve_extent, |
1354 | ||
cfc2de0f BB |
1355 | TP_PROTO(const struct btrfs_block_group *block_group, |
1356 | const struct find_free_extent_ctl *ffe_ctl), | |
3f7de037 | 1357 | |
cfc2de0f | 1358 | TP_ARGS(block_group, ffe_ctl), |
3f7de037 | 1359 | |
bc074524 | 1360 | TP_STRUCT__entry_btrfs( |
3f7de037 JB |
1361 | __field( u64, bg_objectid ) |
1362 | __field( u64, flags ) | |
52bb7a21 | 1363 | __field( int, bg_size_class ) |
3f7de037 JB |
1364 | __field( u64, start ) |
1365 | __field( u64, len ) | |
854c2f36 BB |
1366 | __field( u64, loop ) |
1367 | __field( bool, hinted ) | |
52bb7a21 | 1368 | __field( int, size_class ) |
3f7de037 JB |
1369 | ), |
1370 | ||
3dca5c94 | 1371 | TP_fast_assign_btrfs(block_group->fs_info, |
b3470b5d | 1372 | __entry->bg_objectid = block_group->start; |
3f7de037 | 1373 | __entry->flags = block_group->flags; |
52bb7a21 | 1374 | __entry->bg_size_class = block_group->size_class; |
cfc2de0f BB |
1375 | __entry->start = ffe_ctl->search_start; |
1376 | __entry->len = ffe_ctl->num_bytes; | |
854c2f36 BB |
1377 | __entry->loop = ffe_ctl->loop; |
1378 | __entry->hinted = ffe_ctl->hinted; | |
52bb7a21 | 1379 | __entry->size_class = ffe_ctl->size_class; |
3f7de037 JB |
1380 | ), |
1381 | ||
854c2f36 | 1382 | TP_printk_btrfs( |
52bb7a21 | 1383 | "root=%llu(%s) block_group=%llu flags=%llu(%s) bg_size_class=%d start=%llu len=%llu loop=%llu hinted=%d size_class=%d", |
71ff6437 JM |
1384 | show_root_type(BTRFS_EXTENT_TREE_OBJECTID), |
1385 | __entry->bg_objectid, | |
3f7de037 JB |
1386 | __entry->flags, __print_flags((unsigned long)__entry->flags, |
1387 | "|", BTRFS_GROUP_FLAGS), | |
52bb7a21 BB |
1388 | __entry->bg_size_class, __entry->start, __entry->len, |
1389 | __entry->loop, __entry->hinted, __entry->size_class) | |
3f7de037 JB |
1390 | ); |
1391 | ||
1392 | DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent, | |
1393 | ||
cfc2de0f BB |
1394 | TP_PROTO(const struct btrfs_block_group *block_group, |
1395 | const struct find_free_extent_ctl *ffe_ctl), | |
3f7de037 | 1396 | |
cfc2de0f | 1397 | TP_ARGS(block_group, ffe_ctl) |
3f7de037 JB |
1398 | ); |
1399 | ||
1400 | DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster, | |
1401 | ||
cfc2de0f BB |
1402 | TP_PROTO(const struct btrfs_block_group *block_group, |
1403 | const struct find_free_extent_ctl *ffe_ctl), | |
3f7de037 | 1404 | |
cfc2de0f | 1405 | TP_ARGS(block_group, ffe_ctl) |
3f7de037 JB |
1406 | ); |
1407 | ||
1408 | TRACE_EVENT(btrfs_find_cluster, | |
1409 | ||
32da5386 | 1410 | TP_PROTO(const struct btrfs_block_group *block_group, u64 start, |
3f7de037 JB |
1411 | u64 bytes, u64 empty_size, u64 min_bytes), |
1412 | ||
1413 | TP_ARGS(block_group, start, bytes, empty_size, min_bytes), | |
1414 | ||
bc074524 | 1415 | TP_STRUCT__entry_btrfs( |
3f7de037 JB |
1416 | __field( u64, bg_objectid ) |
1417 | __field( u64, flags ) | |
1418 | __field( u64, start ) | |
1419 | __field( u64, bytes ) | |
1420 | __field( u64, empty_size ) | |
1421 | __field( u64, min_bytes ) | |
1422 | ), | |
1423 | ||
bc074524 | 1424 | TP_fast_assign_btrfs(block_group->fs_info, |
b3470b5d | 1425 | __entry->bg_objectid = block_group->start; |
3f7de037 JB |
1426 | __entry->flags = block_group->flags; |
1427 | __entry->start = start; | |
1428 | __entry->bytes = bytes; | |
1429 | __entry->empty_size = empty_size; | |
1430 | __entry->min_bytes = min_bytes; | |
1431 | ), | |
1432 | ||
5439c7f5 DS |
1433 | TP_printk_btrfs("block_group=%llu flags=%llu(%s) start=%llu len=%llu " |
1434 | "empty_size=%llu min_bytes=%llu", __entry->bg_objectid, | |
3f7de037 JB |
1435 | __entry->flags, |
1436 | __print_flags((unsigned long)__entry->flags, "|", | |
1437 | BTRFS_GROUP_FLAGS), __entry->start, | |
1438 | __entry->bytes, __entry->empty_size, __entry->min_bytes) | |
1439 | ); | |
1440 | ||
1441 | TRACE_EVENT(btrfs_failed_cluster_setup, | |
1442 | ||
32da5386 | 1443 | TP_PROTO(const struct btrfs_block_group *block_group), |
3f7de037 JB |
1444 | |
1445 | TP_ARGS(block_group), | |
1446 | ||
bc074524 | 1447 | TP_STRUCT__entry_btrfs( |
3f7de037 JB |
1448 | __field( u64, bg_objectid ) |
1449 | ), | |
1450 | ||
bc074524 | 1451 | TP_fast_assign_btrfs(block_group->fs_info, |
b3470b5d | 1452 | __entry->bg_objectid = block_group->start; |
3f7de037 JB |
1453 | ), |
1454 | ||
5439c7f5 | 1455 | TP_printk_btrfs("block_group=%llu", __entry->bg_objectid) |
3f7de037 JB |
1456 | ); |
1457 | ||
1458 | TRACE_EVENT(btrfs_setup_cluster, | |
1459 | ||
32da5386 | 1460 | TP_PROTO(const struct btrfs_block_group *block_group, |
9a35b637 JM |
1461 | const struct btrfs_free_cluster *cluster, |
1462 | u64 size, int bitmap), | |
3f7de037 JB |
1463 | |
1464 | TP_ARGS(block_group, cluster, size, bitmap), | |
1465 | ||
bc074524 | 1466 | TP_STRUCT__entry_btrfs( |
3f7de037 JB |
1467 | __field( u64, bg_objectid ) |
1468 | __field( u64, flags ) | |
1469 | __field( u64, start ) | |
1470 | __field( u64, max_size ) | |
1471 | __field( u64, size ) | |
1472 | __field( int, bitmap ) | |
1473 | ), | |
1474 | ||
bc074524 | 1475 | TP_fast_assign_btrfs(block_group->fs_info, |
b3470b5d | 1476 | __entry->bg_objectid = block_group->start; |
3f7de037 JB |
1477 | __entry->flags = block_group->flags; |
1478 | __entry->start = cluster->window_start; | |
1479 | __entry->max_size = cluster->max_size; | |
1480 | __entry->size = size; | |
1481 | __entry->bitmap = bitmap; | |
1482 | ), | |
1483 | ||
5439c7f5 DS |
1484 | TP_printk_btrfs("block_group=%llu flags=%llu(%s) window_start=%llu " |
1485 | "size=%llu max_size=%llu bitmap=%d", | |
3f7de037 JB |
1486 | __entry->bg_objectid, |
1487 | __entry->flags, | |
1488 | __print_flags((unsigned long)__entry->flags, "|", | |
1489 | BTRFS_GROUP_FLAGS), __entry->start, | |
1490 | __entry->size, __entry->max_size, __entry->bitmap) | |
1491 | ); | |
1492 | ||
143bede5 JM |
1493 | struct extent_state; |
1494 | TRACE_EVENT(alloc_extent_state, | |
1495 | ||
9a35b637 JM |
1496 | TP_PROTO(const struct extent_state *state, |
1497 | gfp_t mask, unsigned long IP), | |
143bede5 JM |
1498 | |
1499 | TP_ARGS(state, mask, IP), | |
1500 | ||
1501 | TP_STRUCT__entry( | |
9a35b637 | 1502 | __field(const struct extent_state *, state) |
fe573327 | 1503 | __field(unsigned long, mask) |
94c3f6c6 | 1504 | __field(const void*, ip) |
143bede5 JM |
1505 | ), |
1506 | ||
1507 | TP_fast_assign( | |
1508 | __entry->state = state, | |
fe573327 | 1509 | __entry->mask = (__force unsigned long)mask, |
94c3f6c6 | 1510 | __entry->ip = (const void *)IP |
143bede5 JM |
1511 | ), |
1512 | ||
562a7a07 | 1513 | TP_printk("state=%p mask=%s caller=%pS", __entry->state, |
94c3f6c6 | 1514 | show_gfp_flags(__entry->mask), __entry->ip) |
143bede5 JM |
1515 | ); |
1516 | ||
1517 | TRACE_EVENT(free_extent_state, | |
1518 | ||
9a35b637 | 1519 | TP_PROTO(const struct extent_state *state, unsigned long IP), |
143bede5 JM |
1520 | |
1521 | TP_ARGS(state, IP), | |
1522 | ||
1523 | TP_STRUCT__entry( | |
9a35b637 | 1524 | __field(const struct extent_state *, state) |
94c3f6c6 | 1525 | __field(const void*, ip) |
143bede5 JM |
1526 | ), |
1527 | ||
1528 | TP_fast_assign( | |
1529 | __entry->state = state, | |
94c3f6c6 | 1530 | __entry->ip = (const void *)IP |
143bede5 JM |
1531 | ), |
1532 | ||
94c3f6c6 | 1533 | TP_printk("state=%p caller=%pS", __entry->state, __entry->ip) |
143bede5 JM |
1534 | ); |
1535 | ||
52483bc2 QW |
1536 | DECLARE_EVENT_CLASS(btrfs__work, |
1537 | ||
9a35b637 | 1538 | TP_PROTO(const struct btrfs_work *work), |
52483bc2 QW |
1539 | |
1540 | TP_ARGS(work), | |
1541 | ||
bc074524 | 1542 | TP_STRUCT__entry_btrfs( |
9a35b637 JM |
1543 | __field( const void *, work ) |
1544 | __field( const void *, wq ) | |
1545 | __field( const void *, func ) | |
1546 | __field( const void *, ordered_func ) | |
9a35b637 | 1547 | __field( const void *, normal_work ) |
52483bc2 QW |
1548 | ), |
1549 | ||
bc074524 | 1550 | TP_fast_assign_btrfs(btrfs_work_owner(work), |
52483bc2 QW |
1551 | __entry->work = work; |
1552 | __entry->wq = work->wq; | |
1553 | __entry->func = work->func; | |
1554 | __entry->ordered_func = work->ordered_func; | |
b38a6258 | 1555 | __entry->normal_work = &work->normal_work; |
52483bc2 QW |
1556 | ), |
1557 | ||
078b8b90 | 1558 | TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%ps ordered_func=%p", |
b38a6258 | 1559 | __entry->work, __entry->normal_work, __entry->wq, |
078b8b90 | 1560 | __entry->func, __entry->ordered_func) |
52483bc2 QW |
1561 | ); |
1562 | ||
ac0c7cf8 | 1563 | /* |
c9eb55db OS |
1564 | * For situations when the work is freed, we pass fs_info and a tag that matches |
1565 | * the address of the work structure so it can be paired with the scheduling | |
1566 | * event. DO NOT add anything here that dereferences wtag. | |
ac0c7cf8 | 1567 | */ |
52483bc2 QW |
1568 | DECLARE_EVENT_CLASS(btrfs__work__done, |
1569 | ||
9a35b637 | 1570 | TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag), |
52483bc2 | 1571 | |
ac0c7cf8 | 1572 | TP_ARGS(fs_info, wtag), |
52483bc2 | 1573 | |
bc074524 | 1574 | TP_STRUCT__entry_btrfs( |
9a35b637 | 1575 | __field( const void *, wtag ) |
52483bc2 QW |
1576 | ), |
1577 | ||
ac0c7cf8 DS |
1578 | TP_fast_assign_btrfs(fs_info, |
1579 | __entry->wtag = wtag; | |
52483bc2 QW |
1580 | ), |
1581 | ||
ac0c7cf8 | 1582 | TP_printk_btrfs("work->%p", __entry->wtag) |
52483bc2 QW |
1583 | ); |
1584 | ||
1585 | DEFINE_EVENT(btrfs__work, btrfs_work_queued, | |
1586 | ||
9a35b637 | 1587 | TP_PROTO(const struct btrfs_work *work), |
52483bc2 QW |
1588 | |
1589 | TP_ARGS(work) | |
1590 | ); | |
1591 | ||
1592 | DEFINE_EVENT(btrfs__work, btrfs_work_sched, | |
1593 | ||
9a35b637 | 1594 | TP_PROTO(const struct btrfs_work *work), |
52483bc2 QW |
1595 | |
1596 | TP_ARGS(work) | |
1597 | ); | |
1598 | ||
52483bc2 QW |
1599 | DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done, |
1600 | ||
9a35b637 | 1601 | TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag), |
52483bc2 | 1602 | |
ac0c7cf8 | 1603 | TP_ARGS(fs_info, wtag) |
52483bc2 QW |
1604 | ); |
1605 | ||
1606 | DEFINE_EVENT(btrfs__work, btrfs_ordered_sched, | |
1607 | ||
9a35b637 | 1608 | TP_PROTO(const struct btrfs_work *work), |
52483bc2 QW |
1609 | |
1610 | TP_ARGS(work) | |
1611 | ); | |
1612 | ||
a31b4a43 | 1613 | DECLARE_EVENT_CLASS(btrfs_workqueue, |
c3a46891 | 1614 | |
a31b4a43 | 1615 | TP_PROTO(const struct btrfs_workqueue *wq, const char *name), |
c3a46891 | 1616 | |
a31b4a43 | 1617 | TP_ARGS(wq, name), |
c3a46891 | 1618 | |
bc074524 | 1619 | TP_STRUCT__entry_btrfs( |
9a35b637 | 1620 | __field( const void *, wq ) |
c3a46891 | 1621 | __string( name, name ) |
c3a46891 QW |
1622 | ), |
1623 | ||
bc074524 | 1624 | TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), |
c3a46891 QW |
1625 | __entry->wq = wq; |
1626 | __assign_str(name, name); | |
c3a46891 QW |
1627 | ), |
1628 | ||
a31b4a43 | 1629 | TP_printk_btrfs("name=%s wq=%p", __get_str(name), |
c3a46891 QW |
1630 | __entry->wq) |
1631 | ); | |
1632 | ||
a31b4a43 | 1633 | DEFINE_EVENT(btrfs_workqueue, btrfs_workqueue_alloc, |
c3a46891 | 1634 | |
a31b4a43 | 1635 | TP_PROTO(const struct btrfs_workqueue *wq, const char *name), |
c3a46891 | 1636 | |
a31b4a43 | 1637 | TP_ARGS(wq, name) |
c3a46891 QW |
1638 | ); |
1639 | ||
a31b4a43 | 1640 | DECLARE_EVENT_CLASS(btrfs_workqueue_done, |
c3a46891 | 1641 | |
a31b4a43 | 1642 | TP_PROTO(const struct btrfs_workqueue *wq), |
c3a46891 QW |
1643 | |
1644 | TP_ARGS(wq), | |
1645 | ||
bc074524 | 1646 | TP_STRUCT__entry_btrfs( |
9a35b637 | 1647 | __field( const void *, wq ) |
c3a46891 QW |
1648 | ), |
1649 | ||
bc074524 | 1650 | TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), |
c3a46891 QW |
1651 | __entry->wq = wq; |
1652 | ), | |
1653 | ||
bc074524 | 1654 | TP_printk_btrfs("wq=%p", __entry->wq) |
c3a46891 QW |
1655 | ); |
1656 | ||
a31b4a43 | 1657 | DEFINE_EVENT(btrfs_workqueue_done, btrfs_workqueue_destroy, |
c3a46891 | 1658 | |
a31b4a43 | 1659 | TP_PROTO(const struct btrfs_workqueue *wq), |
c3a46891 QW |
1660 | |
1661 | TP_ARGS(wq) | |
1662 | ); | |
52483bc2 | 1663 | |
81fb6f77 QW |
1664 | #define BTRFS_QGROUP_OPERATIONS \ |
1665 | { QGROUP_RESERVE, "reserve" }, \ | |
1666 | { QGROUP_RELEASE, "release" }, \ | |
1667 | { QGROUP_FREE, "free" } | |
1668 | ||
1669 | DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data, | |
1670 | ||
9a35b637 JM |
1671 | TP_PROTO(const struct inode *inode, u64 start, u64 len, |
1672 | u64 reserved, int op), | |
81fb6f77 QW |
1673 | |
1674 | TP_ARGS(inode, start, len, reserved, op), | |
1675 | ||
bc074524 | 1676 | TP_STRUCT__entry_btrfs( |
81fb6f77 | 1677 | __field( u64, rootid ) |
f8f8e189 | 1678 | __field( u64, ino ) |
81fb6f77 QW |
1679 | __field( u64, start ) |
1680 | __field( u64, len ) | |
1681 | __field( u64, reserved ) | |
1682 | __field( int, op ) | |
1683 | ), | |
1684 | ||
bc074524 | 1685 | TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), |
4fd786e6 MT |
1686 | __entry->rootid = |
1687 | BTRFS_I(inode)->root->root_key.objectid; | |
f8f8e189 | 1688 | __entry->ino = btrfs_ino(BTRFS_I(inode)); |
81fb6f77 QW |
1689 | __entry->start = start; |
1690 | __entry->len = len; | |
1691 | __entry->reserved = reserved; | |
1692 | __entry->op = op; | |
1693 | ), | |
1694 | ||
f8f8e189 | 1695 | TP_printk_btrfs("root=%llu ino=%llu start=%llu len=%llu reserved=%llu op=%s", |
81fb6f77 QW |
1696 | __entry->rootid, __entry->ino, __entry->start, __entry->len, |
1697 | __entry->reserved, | |
1698 | __print_flags((unsigned long)__entry->op, "", | |
1699 | BTRFS_QGROUP_OPERATIONS) | |
1700 | ) | |
1701 | ); | |
1702 | ||
1703 | DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_reserve_data, | |
1704 | ||
9a35b637 JM |
1705 | TP_PROTO(const struct inode *inode, u64 start, u64 len, |
1706 | u64 reserved, int op), | |
81fb6f77 QW |
1707 | |
1708 | TP_ARGS(inode, start, len, reserved, op) | |
1709 | ); | |
1710 | ||
1711 | DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_release_data, | |
1712 | ||
9a35b637 JM |
1713 | TP_PROTO(const struct inode *inode, u64 start, u64 len, |
1714 | u64 reserved, int op), | |
81fb6f77 QW |
1715 | |
1716 | TP_ARGS(inode, start, len, reserved, op) | |
1717 | ); | |
1718 | ||
0f5dcf8d | 1719 | DECLARE_EVENT_CLASS(btrfs_qgroup_extent, |
9a35b637 JM |
1720 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
1721 | const struct btrfs_qgroup_extent_record *rec), | |
0f5dcf8d | 1722 | |
bc074524 | 1723 | TP_ARGS(fs_info, rec), |
0f5dcf8d | 1724 | |
bc074524 | 1725 | TP_STRUCT__entry_btrfs( |
0f5dcf8d MF |
1726 | __field( u64, bytenr ) |
1727 | __field( u64, num_bytes ) | |
1728 | ), | |
1729 | ||
bc074524 | 1730 | TP_fast_assign_btrfs(fs_info, |
0f5dcf8d MF |
1731 | __entry->bytenr = rec->bytenr, |
1732 | __entry->num_bytes = rec->num_bytes; | |
1733 | ), | |
1734 | ||
562a7a07 | 1735 | TP_printk_btrfs("bytenr=%llu num_bytes=%llu", |
94c3f6c6 | 1736 | __entry->bytenr, __entry->num_bytes) |
0f5dcf8d MF |
1737 | ); |
1738 | ||
1739 | DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents, | |
1740 | ||
9a35b637 JM |
1741 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
1742 | const struct btrfs_qgroup_extent_record *rec), | |
0f5dcf8d | 1743 | |
bc074524 | 1744 | TP_ARGS(fs_info, rec) |
0f5dcf8d MF |
1745 | ); |
1746 | ||
50b3e040 | 1747 | DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_trace_extent, |
0f5dcf8d | 1748 | |
9a35b637 JM |
1749 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
1750 | const struct btrfs_qgroup_extent_record *rec), | |
0f5dcf8d | 1751 | |
bc074524 | 1752 | TP_ARGS(fs_info, rec) |
0f5dcf8d MF |
1753 | ); |
1754 | ||
c337e7b0 QW |
1755 | TRACE_EVENT(qgroup_num_dirty_extents, |
1756 | ||
1757 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 transid, | |
1758 | u64 num_dirty_extents), | |
1759 | ||
1760 | TP_ARGS(fs_info, transid, num_dirty_extents), | |
1761 | ||
1762 | TP_STRUCT__entry_btrfs( | |
1763 | __field( u64, transid ) | |
1764 | __field( u64, num_dirty_extents ) | |
1765 | ), | |
1766 | ||
1767 | TP_fast_assign_btrfs(fs_info, | |
1768 | __entry->transid = transid; | |
1769 | __entry->num_dirty_extents = num_dirty_extents; | |
1770 | ), | |
1771 | ||
1772 | TP_printk_btrfs("transid=%llu num_dirty_extents=%llu", | |
1773 | __entry->transid, __entry->num_dirty_extents) | |
1774 | ); | |
1775 | ||
0f5dcf8d MF |
1776 | TRACE_EVENT(btrfs_qgroup_account_extent, |
1777 | ||
c9f6f3cd | 1778 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 transid, u64 bytenr, |
bc074524 | 1779 | u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots), |
0f5dcf8d | 1780 | |
c9f6f3cd QW |
1781 | TP_ARGS(fs_info, transid, bytenr, num_bytes, nr_old_roots, |
1782 | nr_new_roots), | |
0f5dcf8d | 1783 | |
bc074524 | 1784 | TP_STRUCT__entry_btrfs( |
c9f6f3cd | 1785 | __field( u64, transid ) |
0f5dcf8d MF |
1786 | __field( u64, bytenr ) |
1787 | __field( u64, num_bytes ) | |
1788 | __field( u64, nr_old_roots ) | |
1789 | __field( u64, nr_new_roots ) | |
1790 | ), | |
1791 | ||
bc074524 | 1792 | TP_fast_assign_btrfs(fs_info, |
c9f6f3cd | 1793 | __entry->transid = transid; |
0f5dcf8d MF |
1794 | __entry->bytenr = bytenr; |
1795 | __entry->num_bytes = num_bytes; | |
1796 | __entry->nr_old_roots = nr_old_roots; | |
1797 | __entry->nr_new_roots = nr_new_roots; | |
1798 | ), | |
1799 | ||
c9f6f3cd QW |
1800 | TP_printk_btrfs( |
1801 | "transid=%llu bytenr=%llu num_bytes=%llu nr_old_roots=%llu nr_new_roots=%llu", | |
1802 | __entry->transid, | |
1803 | __entry->bytenr, | |
1804 | __entry->num_bytes, | |
1805 | __entry->nr_old_roots, | |
1806 | __entry->nr_new_roots) | |
0f5dcf8d MF |
1807 | ); |
1808 | ||
1809 | TRACE_EVENT(qgroup_update_counters, | |
1810 | ||
8b317901 | 1811 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
1d2e7c7c | 1812 | const struct btrfs_qgroup *qgroup, |
bc074524 | 1813 | u64 cur_old_count, u64 cur_new_count), |
0f5dcf8d | 1814 | |
8b317901 | 1815 | TP_ARGS(fs_info, qgroup, cur_old_count, cur_new_count), |
0f5dcf8d | 1816 | |
bc074524 | 1817 | TP_STRUCT__entry_btrfs( |
0f5dcf8d | 1818 | __field( u64, qgid ) |
8b317901 QW |
1819 | __field( u64, old_rfer ) |
1820 | __field( u64, old_excl ) | |
0f5dcf8d MF |
1821 | __field( u64, cur_old_count ) |
1822 | __field( u64, cur_new_count ) | |
1823 | ), | |
1824 | ||
bc074524 | 1825 | TP_fast_assign_btrfs(fs_info, |
8b317901 QW |
1826 | __entry->qgid = qgroup->qgroupid; |
1827 | __entry->old_rfer = qgroup->rfer; | |
1828 | __entry->old_excl = qgroup->excl; | |
0f5dcf8d MF |
1829 | __entry->cur_old_count = cur_old_count; |
1830 | __entry->cur_new_count = cur_new_count; | |
1831 | ), | |
1832 | ||
8b317901 QW |
1833 | TP_printk_btrfs("qgid=%llu old_rfer=%llu old_excl=%llu cur_old_count=%llu cur_new_count=%llu", |
1834 | __entry->qgid, __entry->old_rfer, __entry->old_excl, | |
1835 | __entry->cur_old_count, __entry->cur_new_count) | |
0f5dcf8d MF |
1836 | ); |
1837 | ||
3159fe7b QW |
1838 | TRACE_EVENT(qgroup_update_reserve, |
1839 | ||
1840 | TP_PROTO(struct btrfs_fs_info *fs_info, struct btrfs_qgroup *qgroup, | |
64ee4e75 | 1841 | s64 diff, int type), |
3159fe7b | 1842 | |
64ee4e75 | 1843 | TP_ARGS(fs_info, qgroup, diff, type), |
3159fe7b QW |
1844 | |
1845 | TP_STRUCT__entry_btrfs( | |
1846 | __field( u64, qgid ) | |
1847 | __field( u64, cur_reserved ) | |
1848 | __field( s64, diff ) | |
64ee4e75 | 1849 | __field( int, type ) |
3159fe7b QW |
1850 | ), |
1851 | ||
1852 | TP_fast_assign_btrfs(fs_info, | |
1853 | __entry->qgid = qgroup->qgroupid; | |
64ee4e75 | 1854 | __entry->cur_reserved = qgroup->rsv.values[type]; |
3159fe7b | 1855 | __entry->diff = diff; |
1b2442b4 | 1856 | __entry->type = type; |
3159fe7b QW |
1857 | ), |
1858 | ||
64ee4e75 | 1859 | TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld", |
1cb1f0b2 | 1860 | __entry->qgid, __print_symbolic(__entry->type, QGROUP_RSV_TYPES), |
64ee4e75 | 1861 | __entry->cur_reserved, __entry->diff) |
3159fe7b QW |
1862 | ); |
1863 | ||
1864 | TRACE_EVENT(qgroup_meta_reserve, | |
1865 | ||
4ee0d883 QW |
1866 | TP_PROTO(struct btrfs_root *root, s64 diff, int type), |
1867 | ||
1868 | TP_ARGS(root, diff, type), | |
1869 | ||
1870 | TP_STRUCT__entry_btrfs( | |
1871 | __field( u64, refroot ) | |
1872 | __field( s64, diff ) | |
1873 | __field( int, type ) | |
1874 | ), | |
1875 | ||
1876 | TP_fast_assign_btrfs(root->fs_info, | |
4fd786e6 | 1877 | __entry->refroot = root->root_key.objectid; |
4ee0d883 | 1878 | __entry->diff = diff; |
1b2442b4 | 1879 | __entry->type = type; |
4ee0d883 QW |
1880 | ), |
1881 | ||
1882 | TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld", | |
1883 | show_root_type(__entry->refroot), | |
1cb1f0b2 | 1884 | __print_symbolic(__entry->type, QGROUP_RSV_TYPES), __entry->diff) |
4ee0d883 QW |
1885 | ); |
1886 | ||
1887 | TRACE_EVENT(qgroup_meta_convert, | |
1888 | ||
3159fe7b QW |
1889 | TP_PROTO(struct btrfs_root *root, s64 diff), |
1890 | ||
1891 | TP_ARGS(root, diff), | |
1892 | ||
1893 | TP_STRUCT__entry_btrfs( | |
1894 | __field( u64, refroot ) | |
1895 | __field( s64, diff ) | |
1896 | ), | |
1897 | ||
1898 | TP_fast_assign_btrfs(root->fs_info, | |
4fd786e6 | 1899 | __entry->refroot = root->root_key.objectid; |
3159fe7b QW |
1900 | __entry->diff = diff; |
1901 | ), | |
1902 | ||
4ee0d883 QW |
1903 | TP_printk_btrfs("refroot=%llu(%s) type=%s->%s diff=%lld", |
1904 | show_root_type(__entry->refroot), | |
1cb1f0b2 NB |
1905 | __print_symbolic(BTRFS_QGROUP_RSV_META_PREALLOC, QGROUP_RSV_TYPES), |
1906 | __print_symbolic(BTRFS_QGROUP_RSV_META_PERTRANS, QGROUP_RSV_TYPES), | |
4ee0d883 QW |
1907 | __entry->diff) |
1908 | ); | |
1909 | ||
1910 | TRACE_EVENT(qgroup_meta_free_all_pertrans, | |
1911 | ||
1912 | TP_PROTO(struct btrfs_root *root), | |
1913 | ||
1914 | TP_ARGS(root), | |
1915 | ||
1916 | TP_STRUCT__entry_btrfs( | |
1917 | __field( u64, refroot ) | |
1918 | __field( s64, diff ) | |
1919 | __field( int, type ) | |
1920 | ), | |
1921 | ||
1922 | TP_fast_assign_btrfs(root->fs_info, | |
4fd786e6 | 1923 | __entry->refroot = root->root_key.objectid; |
4ee0d883 QW |
1924 | spin_lock(&root->qgroup_meta_rsv_lock); |
1925 | __entry->diff = -(s64)root->qgroup_meta_rsv_pertrans; | |
1926 | spin_unlock(&root->qgroup_meta_rsv_lock); | |
1927 | __entry->type = BTRFS_QGROUP_RSV_META_PERTRANS; | |
1928 | ), | |
1929 | ||
1930 | TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld", | |
1931 | show_root_type(__entry->refroot), | |
1cb1f0b2 | 1932 | __print_symbolic(__entry->type, QGROUP_RSV_TYPES), __entry->diff) |
3159fe7b QW |
1933 | ); |
1934 | ||
00142756 JM |
1935 | DECLARE_EVENT_CLASS(btrfs__prelim_ref, |
1936 | TP_PROTO(const struct btrfs_fs_info *fs_info, | |
1937 | const struct prelim_ref *oldref, | |
1938 | const struct prelim_ref *newref, u64 tree_size), | |
1939 | TP_ARGS(fs_info, newref, oldref, tree_size), | |
1940 | ||
1941 | TP_STRUCT__entry_btrfs( | |
1942 | __field( u64, root_id ) | |
1943 | __field( u64, objectid ) | |
1944 | __field( u8, type ) | |
1945 | __field( u64, offset ) | |
1946 | __field( int, level ) | |
1947 | __field( int, old_count ) | |
1948 | __field( u64, parent ) | |
1949 | __field( u64, bytenr ) | |
1950 | __field( int, mod_count ) | |
1951 | __field( u64, tree_size ) | |
1952 | ), | |
1953 | ||
1954 | TP_fast_assign_btrfs(fs_info, | |
1955 | __entry->root_id = oldref->root_id; | |
1956 | __entry->objectid = oldref->key_for_search.objectid; | |
1957 | __entry->type = oldref->key_for_search.type; | |
1958 | __entry->offset = oldref->key_for_search.offset; | |
1959 | __entry->level = oldref->level; | |
1960 | __entry->old_count = oldref->count; | |
1961 | __entry->parent = oldref->parent; | |
1962 | __entry->bytenr = oldref->wanted_disk_byte; | |
1963 | __entry->mod_count = newref ? newref->count : 0; | |
1964 | __entry->tree_size = tree_size; | |
1965 | ), | |
1966 | ||
1967 | TP_printk_btrfs("root_id=%llu key=[%llu,%u,%llu] level=%d count=[%d+%d=%d] parent=%llu wanted_disk_byte=%llu nodes=%llu", | |
8eec8463 DS |
1968 | __entry->root_id, |
1969 | __entry->objectid, __entry->type, | |
1970 | __entry->offset, __entry->level, | |
00142756 JM |
1971 | __entry->old_count, __entry->mod_count, |
1972 | __entry->old_count + __entry->mod_count, | |
8eec8463 DS |
1973 | __entry->parent, |
1974 | __entry->bytenr, | |
1975 | __entry->tree_size) | |
00142756 JM |
1976 | ); |
1977 | ||
1978 | DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_merge, | |
1979 | TP_PROTO(const struct btrfs_fs_info *fs_info, | |
1980 | const struct prelim_ref *oldref, | |
1981 | const struct prelim_ref *newref, u64 tree_size), | |
1982 | TP_ARGS(fs_info, oldref, newref, tree_size) | |
1983 | ); | |
1984 | ||
1985 | DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_insert, | |
1986 | TP_PROTO(const struct btrfs_fs_info *fs_info, | |
1987 | const struct prelim_ref *oldref, | |
1988 | const struct prelim_ref *newref, u64 tree_size), | |
1989 | TP_ARGS(fs_info, oldref, newref, tree_size) | |
1990 | ); | |
1991 | ||
dd48d407 | 1992 | TRACE_EVENT(btrfs_inode_mod_outstanding_extents, |
64425500 | 1993 | TP_PROTO(const struct btrfs_root *root, u64 ino, int mod, unsigned outstanding), |
dd48d407 | 1994 | |
64425500 | 1995 | TP_ARGS(root, ino, mod, outstanding), |
dd48d407 JB |
1996 | |
1997 | TP_STRUCT__entry_btrfs( | |
1998 | __field( u64, root_objectid ) | |
1999 | __field( u64, ino ) | |
2000 | __field( int, mod ) | |
64425500 | 2001 | __field( unsigned, outstanding ) |
dd48d407 JB |
2002 | ), |
2003 | ||
2004 | TP_fast_assign_btrfs(root->fs_info, | |
4fd786e6 | 2005 | __entry->root_objectid = root->root_key.objectid; |
dd48d407 JB |
2006 | __entry->ino = ino; |
2007 | __entry->mod = mod; | |
64425500 | 2008 | __entry->outstanding = outstanding; |
dd48d407 JB |
2009 | ), |
2010 | ||
64425500 | 2011 | TP_printk_btrfs("root=%llu(%s) ino=%llu mod=%d outstanding=%u", |
dd48d407 | 2012 | show_root_type(__entry->root_objectid), |
64425500 | 2013 | __entry->ino, __entry->mod, __entry->outstanding) |
dd48d407 | 2014 | ); |
3dca5c94 | 2015 | |
4ed0a7a3 | 2016 | DECLARE_EVENT_CLASS(btrfs__block_group, |
32da5386 | 2017 | TP_PROTO(const struct btrfs_block_group *bg_cache), |
4ed0a7a3 QW |
2018 | |
2019 | TP_ARGS(bg_cache), | |
2020 | ||
2021 | TP_STRUCT__entry_btrfs( | |
2022 | __field( u64, bytenr ) | |
2023 | __field( u64, len ) | |
2024 | __field( u64, used ) | |
2025 | __field( u64, flags ) | |
2026 | ), | |
2027 | ||
2028 | TP_fast_assign_btrfs(bg_cache->fs_info, | |
b3470b5d DS |
2029 | __entry->bytenr = bg_cache->start, |
2030 | __entry->len = bg_cache->length, | |
bf38be65 | 2031 | __entry->used = bg_cache->used; |
4ed0a7a3 QW |
2032 | __entry->flags = bg_cache->flags; |
2033 | ), | |
2034 | ||
2035 | TP_printk_btrfs("bg bytenr=%llu len=%llu used=%llu flags=%llu(%s)", | |
2036 | __entry->bytenr, __entry->len, __entry->used, __entry->flags, | |
2037 | __print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS)) | |
2038 | ); | |
2039 | ||
2040 | DEFINE_EVENT(btrfs__block_group, btrfs_remove_block_group, | |
32da5386 | 2041 | TP_PROTO(const struct btrfs_block_group *bg_cache), |
4ed0a7a3 QW |
2042 | |
2043 | TP_ARGS(bg_cache) | |
2044 | ); | |
2045 | ||
2046 | DEFINE_EVENT(btrfs__block_group, btrfs_add_unused_block_group, | |
32da5386 | 2047 | TP_PROTO(const struct btrfs_block_group *bg_cache), |
4ed0a7a3 QW |
2048 | |
2049 | TP_ARGS(bg_cache) | |
2050 | ); | |
2051 | ||
18bb8bbf JT |
2052 | DEFINE_EVENT(btrfs__block_group, btrfs_add_reclaim_block_group, |
2053 | TP_PROTO(const struct btrfs_block_group *bg_cache), | |
2054 | ||
2055 | TP_ARGS(bg_cache) | |
2056 | ); | |
2057 | ||
2058 | DEFINE_EVENT(btrfs__block_group, btrfs_reclaim_block_group, | |
2059 | TP_PROTO(const struct btrfs_block_group *bg_cache), | |
2060 | ||
2061 | TP_ARGS(bg_cache) | |
2062 | ); | |
2063 | ||
4ed0a7a3 | 2064 | DEFINE_EVENT(btrfs__block_group, btrfs_skip_unused_block_group, |
32da5386 | 2065 | TP_PROTO(const struct btrfs_block_group *bg_cache), |
4ed0a7a3 QW |
2066 | |
2067 | TP_ARGS(bg_cache) | |
2068 | ); | |
2069 | ||
a1d19847 QW |
2070 | TRACE_EVENT(btrfs_set_extent_bit, |
2071 | TP_PROTO(const struct extent_io_tree *tree, | |
2072 | u64 start, u64 len, unsigned set_bits), | |
2073 | ||
2074 | TP_ARGS(tree, start, len, set_bits), | |
2075 | ||
2076 | TP_STRUCT__entry_btrfs( | |
2077 | __field( unsigned, owner ) | |
2078 | __field( u64, ino ) | |
2079 | __field( u64, rootid ) | |
2080 | __field( u64, start ) | |
2081 | __field( u64, len ) | |
2082 | __field( unsigned, set_bits) | |
2083 | ), | |
2084 | ||
738290c0 DS |
2085 | TP_fast_assign_btrfs(extent_io_tree_to_fs_info(tree), |
2086 | const struct btrfs_inode *inode = extent_io_tree_to_inode_const(tree); | |
2087 | ||
2088 | __entry->owner = tree->owner; | |
2089 | __entry->ino = inode ? btrfs_ino(inode) : 0; | |
2090 | __entry->rootid = inode ? inode->root->root_key.objectid : 0; | |
a1d19847 QW |
2091 | __entry->start = start; |
2092 | __entry->len = len; | |
2093 | __entry->set_bits = set_bits; | |
2094 | ), | |
2095 | ||
2096 | TP_printk_btrfs( | |
2097 | "io_tree=%s ino=%llu root=%llu start=%llu len=%llu set_bits=%s", | |
c92bb304 | 2098 | __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino, |
a1d19847 QW |
2099 | __entry->rootid, __entry->start, __entry->len, |
2100 | __print_flags(__entry->set_bits, "|", EXTENT_FLAGS)) | |
2101 | ); | |
2102 | ||
2103 | TRACE_EVENT(btrfs_clear_extent_bit, | |
2104 | TP_PROTO(const struct extent_io_tree *tree, | |
2105 | u64 start, u64 len, unsigned clear_bits), | |
2106 | ||
2107 | TP_ARGS(tree, start, len, clear_bits), | |
2108 | ||
2109 | TP_STRUCT__entry_btrfs( | |
2110 | __field( unsigned, owner ) | |
2111 | __field( u64, ino ) | |
2112 | __field( u64, rootid ) | |
2113 | __field( u64, start ) | |
2114 | __field( u64, len ) | |
2115 | __field( unsigned, clear_bits) | |
2116 | ), | |
2117 | ||
738290c0 DS |
2118 | TP_fast_assign_btrfs(extent_io_tree_to_fs_info(tree), |
2119 | const struct btrfs_inode *inode = extent_io_tree_to_inode_const(tree); | |
a1d19847 | 2120 | |
738290c0 DS |
2121 | __entry->owner = tree->owner; |
2122 | __entry->ino = inode ? btrfs_ino(inode) : 0; | |
2123 | __entry->rootid = inode ? inode->root->root_key.objectid : 0; | |
a1d19847 QW |
2124 | __entry->start = start; |
2125 | __entry->len = len; | |
2126 | __entry->clear_bits = clear_bits; | |
2127 | ), | |
2128 | ||
2129 | TP_printk_btrfs( | |
2130 | "io_tree=%s ino=%llu root=%llu start=%llu len=%llu clear_bits=%s", | |
c92bb304 | 2131 | __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino, |
a1d19847 QW |
2132 | __entry->rootid, __entry->start, __entry->len, |
2133 | __print_flags(__entry->clear_bits, "|", EXTENT_FLAGS)) | |
2134 | ); | |
2135 | ||
2136 | TRACE_EVENT(btrfs_convert_extent_bit, | |
2137 | TP_PROTO(const struct extent_io_tree *tree, | |
2138 | u64 start, u64 len, unsigned set_bits, unsigned clear_bits), | |
2139 | ||
2140 | TP_ARGS(tree, start, len, set_bits, clear_bits), | |
2141 | ||
2142 | TP_STRUCT__entry_btrfs( | |
2143 | __field( unsigned, owner ) | |
2144 | __field( u64, ino ) | |
2145 | __field( u64, rootid ) | |
2146 | __field( u64, start ) | |
2147 | __field( u64, len ) | |
2148 | __field( unsigned, set_bits) | |
2149 | __field( unsigned, clear_bits) | |
2150 | ), | |
2151 | ||
738290c0 DS |
2152 | TP_fast_assign_btrfs(extent_io_tree_to_fs_info(tree), |
2153 | const struct btrfs_inode *inode = extent_io_tree_to_inode_const(tree); | |
a1d19847 | 2154 | |
738290c0 DS |
2155 | __entry->owner = tree->owner; |
2156 | __entry->ino = inode ? btrfs_ino(inode) : 0; | |
2157 | __entry->rootid = inode ? inode->root->root_key.objectid : 0; | |
a1d19847 QW |
2158 | __entry->start = start; |
2159 | __entry->len = len; | |
2160 | __entry->set_bits = set_bits; | |
2161 | __entry->clear_bits = clear_bits; | |
2162 | ), | |
2163 | ||
2164 | TP_printk_btrfs( | |
2165 | "io_tree=%s ino=%llu root=%llu start=%llu len=%llu set_bits=%s clear_bits=%s", | |
c92bb304 | 2166 | __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino, |
a1d19847 QW |
2167 | __entry->rootid, __entry->start, __entry->len, |
2168 | __print_flags(__entry->set_bits , "|", EXTENT_FLAGS), | |
2169 | __print_flags(__entry->clear_bits, "|", EXTENT_FLAGS)) | |
2170 | ); | |
2171 | ||
e5ad49e2 | 2172 | DECLARE_EVENT_CLASS(btrfs_dump_space_info, |
8197766d | 2173 | TP_PROTO(struct btrfs_fs_info *fs_info, |
e5ad49e2 JB |
2174 | const struct btrfs_space_info *sinfo), |
2175 | ||
2176 | TP_ARGS(fs_info, sinfo), | |
2177 | ||
2178 | TP_STRUCT__entry_btrfs( | |
2179 | __field( u64, flags ) | |
2180 | __field( u64, total_bytes ) | |
2181 | __field( u64, bytes_used ) | |
2182 | __field( u64, bytes_pinned ) | |
2183 | __field( u64, bytes_reserved ) | |
2184 | __field( u64, bytes_may_use ) | |
2185 | __field( u64, bytes_readonly ) | |
2186 | __field( u64, reclaim_size ) | |
2187 | __field( int, clamp ) | |
2188 | __field( u64, global_reserved ) | |
2189 | __field( u64, trans_reserved ) | |
2190 | __field( u64, delayed_refs_reserved ) | |
2191 | __field( u64, delayed_reserved ) | |
2192 | __field( u64, free_chunk_space ) | |
8197766d JB |
2193 | __field( u64, delalloc_bytes ) |
2194 | __field( u64, ordered_bytes ) | |
e5ad49e2 JB |
2195 | ), |
2196 | ||
2197 | TP_fast_assign_btrfs(fs_info, | |
2198 | __entry->flags = sinfo->flags; | |
2199 | __entry->total_bytes = sinfo->total_bytes; | |
2200 | __entry->bytes_used = sinfo->bytes_used; | |
2201 | __entry->bytes_pinned = sinfo->bytes_pinned; | |
2202 | __entry->bytes_reserved = sinfo->bytes_reserved; | |
2203 | __entry->bytes_may_use = sinfo->bytes_may_use; | |
2204 | __entry->bytes_readonly = sinfo->bytes_readonly; | |
2205 | __entry->reclaim_size = sinfo->reclaim_size; | |
2206 | __entry->clamp = sinfo->clamp; | |
2207 | __entry->global_reserved = fs_info->global_block_rsv.reserved; | |
2208 | __entry->trans_reserved = fs_info->trans_block_rsv.reserved; | |
2209 | __entry->delayed_refs_reserved = fs_info->delayed_refs_rsv.reserved; | |
2210 | __entry->delayed_reserved = fs_info->delayed_block_rsv.reserved; | |
2211 | __entry->free_chunk_space = atomic64_read(&fs_info->free_chunk_space); | |
8197766d JB |
2212 | __entry->delalloc_bytes = percpu_counter_sum_positive(&fs_info->delalloc_bytes); |
2213 | __entry->ordered_bytes = percpu_counter_sum_positive(&fs_info->ordered_bytes); | |
e5ad49e2 JB |
2214 | ), |
2215 | ||
2216 | TP_printk_btrfs("flags=%s total_bytes=%llu bytes_used=%llu " | |
2217 | "bytes_pinned=%llu bytes_reserved=%llu " | |
2218 | "bytes_may_use=%llu bytes_readonly=%llu " | |
2219 | "reclaim_size=%llu clamp=%d global_reserved=%llu " | |
2220 | "trans_reserved=%llu delayed_refs_reserved=%llu " | |
8197766d JB |
2221 | "delayed_reserved=%llu chunk_free_space=%llu " |
2222 | "delalloc_bytes=%llu ordered_bytes=%llu", | |
e5ad49e2 JB |
2223 | __print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS), |
2224 | __entry->total_bytes, __entry->bytes_used, | |
2225 | __entry->bytes_pinned, __entry->bytes_reserved, | |
2226 | __entry->bytes_may_use, __entry->bytes_readonly, | |
2227 | __entry->reclaim_size, __entry->clamp, | |
2228 | __entry->global_reserved, __entry->trans_reserved, | |
2229 | __entry->delayed_refs_reserved, | |
8197766d JB |
2230 | __entry->delayed_reserved, __entry->free_chunk_space, |
2231 | __entry->delalloc_bytes, __entry->ordered_bytes) | |
e5ad49e2 JB |
2232 | ); |
2233 | ||
2234 | DEFINE_EVENT(btrfs_dump_space_info, btrfs_done_preemptive_reclaim, | |
8197766d | 2235 | TP_PROTO(struct btrfs_fs_info *fs_info, |
e5ad49e2 JB |
2236 | const struct btrfs_space_info *sinfo), |
2237 | TP_ARGS(fs_info, sinfo) | |
2238 | ); | |
2239 | ||
fcdef39c JB |
2240 | DEFINE_EVENT(btrfs_dump_space_info, btrfs_fail_all_tickets, |
2241 | TP_PROTO(struct btrfs_fs_info *fs_info, | |
2242 | const struct btrfs_space_info *sinfo), | |
2243 | TP_ARGS(fs_info, sinfo) | |
2244 | ); | |
2245 | ||
ac1ea10e JB |
2246 | TRACE_EVENT(btrfs_reserve_ticket, |
2247 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes, | |
2248 | u64 start_ns, int flush, int error), | |
2249 | ||
2250 | TP_ARGS(fs_info, flags, bytes, start_ns, flush, error), | |
2251 | ||
2252 | TP_STRUCT__entry_btrfs( | |
2253 | __field( u64, flags ) | |
2254 | __field( u64, bytes ) | |
2255 | __field( u64, start_ns ) | |
2256 | __field( int, flush ) | |
2257 | __field( int, error ) | |
2258 | ), | |
2259 | ||
2260 | TP_fast_assign_btrfs(fs_info, | |
2261 | __entry->flags = flags; | |
2262 | __entry->bytes = bytes; | |
2263 | __entry->start_ns = start_ns; | |
2264 | __entry->flush = flush; | |
2265 | __entry->error = error; | |
2266 | ), | |
2267 | ||
2268 | TP_printk_btrfs("flags=%s bytes=%llu start_ns=%llu flush=%s error=%d", | |
2269 | __print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS), | |
2270 | __entry->bytes, __entry->start_ns, | |
2271 | __print_symbolic(__entry->flush, FLUSH_ACTIONS), | |
2272 | __entry->error) | |
2273 | ); | |
2274 | ||
34e73cc9 QW |
2275 | DECLARE_EVENT_CLASS(btrfs_sleep_tree_lock, |
2276 | TP_PROTO(const struct extent_buffer *eb, u64 start_ns), | |
2277 | ||
2278 | TP_ARGS(eb, start_ns), | |
2279 | ||
2280 | TP_STRUCT__entry_btrfs( | |
2281 | __field( u64, block ) | |
2282 | __field( u64, generation ) | |
2283 | __field( u64, start_ns ) | |
2284 | __field( u64, end_ns ) | |
2285 | __field( u64, diff_ns ) | |
2286 | __field( u64, owner ) | |
2287 | __field( int, is_log_tree ) | |
2288 | ), | |
2289 | ||
2290 | TP_fast_assign_btrfs(eb->fs_info, | |
2291 | __entry->block = eb->start; | |
2292 | __entry->generation = btrfs_header_generation(eb); | |
2293 | __entry->start_ns = start_ns; | |
2294 | __entry->end_ns = ktime_get_ns(); | |
2295 | __entry->diff_ns = __entry->end_ns - start_ns; | |
2296 | __entry->owner = btrfs_header_owner(eb); | |
2297 | __entry->is_log_tree = (eb->log_index >= 0); | |
2298 | ), | |
2299 | ||
2300 | TP_printk_btrfs( | |
2301 | "block=%llu generation=%llu start_ns=%llu end_ns=%llu diff_ns=%llu owner=%llu is_log_tree=%d", | |
2302 | __entry->block, __entry->generation, | |
2303 | __entry->start_ns, __entry->end_ns, __entry->diff_ns, | |
2304 | __entry->owner, __entry->is_log_tree) | |
2305 | ); | |
2306 | ||
2307 | DEFINE_EVENT(btrfs_sleep_tree_lock, btrfs_tree_read_lock, | |
2308 | TP_PROTO(const struct extent_buffer *eb, u64 start_ns), | |
2309 | ||
2310 | TP_ARGS(eb, start_ns) | |
2311 | ); | |
2312 | ||
2313 | DEFINE_EVENT(btrfs_sleep_tree_lock, btrfs_tree_lock, | |
2314 | TP_PROTO(const struct extent_buffer *eb, u64 start_ns), | |
2315 | ||
2316 | TP_ARGS(eb, start_ns) | |
2317 | ); | |
2318 | ||
31aab402 QW |
2319 | DECLARE_EVENT_CLASS(btrfs_locking_events, |
2320 | TP_PROTO(const struct extent_buffer *eb), | |
2321 | ||
2322 | TP_ARGS(eb), | |
2323 | ||
2324 | TP_STRUCT__entry_btrfs( | |
2325 | __field( u64, block ) | |
2326 | __field( u64, generation ) | |
2327 | __field( u64, owner ) | |
2328 | __field( int, is_log_tree ) | |
2329 | ), | |
2330 | ||
2331 | TP_fast_assign_btrfs(eb->fs_info, | |
2332 | __entry->block = eb->start; | |
2333 | __entry->generation = btrfs_header_generation(eb); | |
2334 | __entry->owner = btrfs_header_owner(eb); | |
2335 | __entry->is_log_tree = (eb->log_index >= 0); | |
2336 | ), | |
2337 | ||
2338 | TP_printk_btrfs("block=%llu generation=%llu owner=%llu is_log_tree=%d", | |
2339 | __entry->block, __entry->generation, | |
2340 | __entry->owner, __entry->is_log_tree) | |
2341 | ); | |
2342 | ||
2343 | #define DEFINE_BTRFS_LOCK_EVENT(name) \ | |
2344 | DEFINE_EVENT(btrfs_locking_events, name, \ | |
2345 | TP_PROTO(const struct extent_buffer *eb), \ | |
2346 | \ | |
2347 | TP_ARGS(eb) \ | |
2348 | ) | |
2349 | ||
2350 | DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_unlock); | |
2351 | DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock); | |
2352 | DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock_blocking); | |
2353 | DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_read); | |
2354 | DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_write); | |
31aab402 QW |
2355 | DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_read_lock); |
2356 | DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_write_lock); | |
2357 | DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_lock_atomic); | |
2358 | ||
480b9b4d QW |
2359 | DECLARE_EVENT_CLASS(btrfs__space_info_update, |
2360 | ||
1d2e7c7c DS |
2361 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
2362 | const struct btrfs_space_info *sinfo, u64 old, s64 diff), | |
480b9b4d QW |
2363 | |
2364 | TP_ARGS(fs_info, sinfo, old, diff), | |
2365 | ||
2366 | TP_STRUCT__entry_btrfs( | |
2367 | __field( u64, type ) | |
2368 | __field( u64, old ) | |
2369 | __field( s64, diff ) | |
2370 | ), | |
2371 | ||
2372 | TP_fast_assign_btrfs(fs_info, | |
2373 | __entry->type = sinfo->flags; | |
2374 | __entry->old = old; | |
2375 | __entry->diff = diff; | |
2376 | ), | |
2377 | TP_printk_btrfs("type=%s old=%llu diff=%lld", | |
2378 | __print_flags(__entry->type, "|", BTRFS_GROUP_FLAGS), | |
2379 | __entry->old, __entry->diff) | |
2380 | ); | |
2381 | ||
2382 | DEFINE_EVENT(btrfs__space_info_update, update_bytes_may_use, | |
2383 | ||
1d2e7c7c DS |
2384 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
2385 | const struct btrfs_space_info *sinfo, u64 old, s64 diff), | |
480b9b4d QW |
2386 | |
2387 | TP_ARGS(fs_info, sinfo, old, diff) | |
2388 | ); | |
2389 | ||
2390 | DEFINE_EVENT(btrfs__space_info_update, update_bytes_pinned, | |
2391 | ||
1d2e7c7c DS |
2392 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
2393 | const struct btrfs_space_info *sinfo, u64 old, s64 diff), | |
480b9b4d QW |
2394 | |
2395 | TP_ARGS(fs_info, sinfo, old, diff) | |
2396 | ); | |
2397 | ||
b8bea09a QW |
2398 | DECLARE_EVENT_CLASS(btrfs_raid56_bio, |
2399 | ||
2400 | TP_PROTO(const struct btrfs_raid_bio *rbio, | |
2401 | const struct bio *bio, | |
2402 | const struct raid56_bio_trace_info *trace_info), | |
2403 | ||
2404 | TP_ARGS(rbio, bio, trace_info), | |
2405 | ||
2406 | TP_STRUCT__entry_btrfs( | |
2407 | __field( u64, full_stripe ) | |
2408 | __field( u64, physical ) | |
2409 | __field( u64, devid ) | |
2410 | __field( u32, offset ) | |
2411 | __field( u32, len ) | |
2412 | __field( u8, opf ) | |
2413 | __field( u8, total_stripes ) | |
2414 | __field( u8, real_stripes ) | |
2415 | __field( u8, nr_data ) | |
2416 | __field( u8, stripe_nr ) | |
2417 | ), | |
2418 | ||
2419 | TP_fast_assign_btrfs(rbio->bioc->fs_info, | |
18d758a2 | 2420 | __entry->full_stripe = rbio->bioc->full_stripe_logical; |
b8bea09a QW |
2421 | __entry->physical = bio->bi_iter.bi_sector << SECTOR_SHIFT; |
2422 | __entry->len = bio->bi_iter.bi_size; | |
2423 | __entry->opf = bio_op(bio); | |
2424 | __entry->devid = trace_info->devid; | |
2425 | __entry->offset = trace_info->offset; | |
2426 | __entry->stripe_nr = trace_info->stripe_nr; | |
2427 | __entry->total_stripes = rbio->bioc->num_stripes; | |
2428 | __entry->real_stripes = rbio->real_stripes; | |
2429 | __entry->nr_data = rbio->nr_data; | |
2430 | ), | |
2431 | /* | |
2432 | * For type output, we need to output things like "DATA1" | |
2433 | * (the first data stripe), "DATA2" (the second data stripe), | |
2434 | * "PQ1" (P stripe),"PQ2" (Q stripe), "REPLACE0" (replace target device). | |
2435 | */ | |
2436 | TP_printk_btrfs( | |
2437 | "full_stripe=%llu devid=%lld type=%s%d offset=%d opf=0x%x physical=%llu len=%u", | |
2438 | __entry->full_stripe, __entry->devid, | |
2439 | (__entry->stripe_nr < __entry->nr_data) ? "DATA" : | |
2440 | ((__entry->stripe_nr < __entry->real_stripes) ? "PQ" : | |
2441 | "REPLACE"), | |
2442 | (__entry->stripe_nr < __entry->nr_data) ? | |
2443 | (__entry->stripe_nr + 1) : | |
2444 | ((__entry->stripe_nr < __entry->real_stripes) ? | |
2445 | (__entry->stripe_nr - __entry->nr_data + 1) : 0), | |
2446 | __entry->offset, __entry->opf, __entry->physical, __entry->len) | |
2447 | ); | |
2448 | ||
dbb6ecb3 | 2449 | DEFINE_EVENT(btrfs_raid56_bio, raid56_read, |
b8bea09a QW |
2450 | TP_PROTO(const struct btrfs_raid_bio *rbio, |
2451 | const struct bio *bio, | |
2452 | const struct raid56_bio_trace_info *trace_info), | |
2453 | ||
2454 | TP_ARGS(rbio, bio, trace_info) | |
2455 | ); | |
2456 | ||
dbb6ecb3 | 2457 | DEFINE_EVENT(btrfs_raid56_bio, raid56_write, |
b8bea09a QW |
2458 | TP_PROTO(const struct btrfs_raid_bio *rbio, |
2459 | const struct bio *bio, | |
2460 | const struct raid56_bio_trace_info *trace_info), | |
2461 | ||
2462 | TP_ARGS(rbio, bio, trace_info) | |
2463 | ); | |
2464 | ||
b5e2c2ff JT |
2465 | TRACE_EVENT(btrfs_insert_one_raid_extent, |
2466 | ||
2467 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 logical, u64 length, | |
2468 | int num_stripes), | |
2469 | ||
2470 | TP_ARGS(fs_info, logical, length, num_stripes), | |
2471 | ||
2472 | TP_STRUCT__entry_btrfs( | |
2473 | __field( u64, logical ) | |
2474 | __field( u64, length ) | |
2475 | __field( int, num_stripes ) | |
2476 | ), | |
2477 | ||
2478 | TP_fast_assign_btrfs(fs_info, | |
2479 | __entry->logical = logical; | |
2480 | __entry->length = length; | |
2481 | __entry->num_stripes = num_stripes; | |
2482 | ), | |
2483 | ||
2484 | TP_printk_btrfs("logical=%llu length=%llu num_stripes=%d", | |
2485 | __entry->logical, __entry->length, | |
2486 | __entry->num_stripes) | |
2487 | ); | |
2488 | ||
2489 | TRACE_EVENT(btrfs_raid_extent_delete, | |
2490 | ||
2491 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 end, | |
2492 | u64 found_start, u64 found_end), | |
2493 | ||
2494 | TP_ARGS(fs_info, start, end, found_start, found_end), | |
2495 | ||
2496 | TP_STRUCT__entry_btrfs( | |
2497 | __field( u64, start ) | |
2498 | __field( u64, end ) | |
2499 | __field( u64, found_start ) | |
2500 | __field( u64, found_end ) | |
2501 | ), | |
2502 | ||
2503 | TP_fast_assign_btrfs(fs_info, | |
2504 | __entry->start = start; | |
2505 | __entry->end = end; | |
2506 | __entry->found_start = found_start; | |
2507 | __entry->found_end = found_end; | |
2508 | ), | |
2509 | ||
2510 | TP_printk_btrfs("start=%llu end=%llu found_start=%llu found_end=%llu", | |
2511 | __entry->start, __entry->end, __entry->found_start, | |
2512 | __entry->found_end) | |
2513 | ); | |
2514 | ||
2515 | TRACE_EVENT(btrfs_get_raid_extent_offset, | |
2516 | ||
2517 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 logical, u64 length, | |
2518 | u64 physical, u64 devid), | |
2519 | ||
2520 | TP_ARGS(fs_info, logical, length, physical, devid), | |
2521 | ||
2522 | TP_STRUCT__entry_btrfs( | |
2523 | __field( u64, logical ) | |
2524 | __field( u64, length ) | |
2525 | __field( u64, physical ) | |
2526 | __field( u64, devid ) | |
2527 | ), | |
2528 | ||
2529 | TP_fast_assign_btrfs(fs_info, | |
2530 | __entry->logical = logical; | |
2531 | __entry->length = length; | |
2532 | __entry->physical = physical; | |
2533 | __entry->devid = devid; | |
2534 | ), | |
2535 | ||
2536 | TP_printk_btrfs("logical=%llu length=%llu physical=%llu devid=%llu", | |
2537 | __entry->logical, __entry->length, __entry->physical, | |
2538 | __entry->devid) | |
2539 | ); | |
2540 | ||
1abe9b8a | 2541 | #endif /* _TRACE_BTRFS_H */ |
2542 | ||
2543 | /* This part must be outside protection */ | |
2544 | #include <trace/define_trace.h> |