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