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