1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM btrfs
5 #if !defined(_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ)
8 #include <linux/writeback.h>
9 #include <linux/tracepoint.h>
10 #include <trace/events/mmflags.h>
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;
27 struct __btrfs_workqueue;
28 struct btrfs_qgroup_extent_record;
30 struct extent_io_tree;
32 struct btrfs_space_info;
34 #define show_ref_type(type) \
35 __print_symbolic(type, \
36 { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \
37 { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \
38 { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \
39 { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \
40 { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" })
42 #define __show_root_type(obj) \
43 __print_symbolic_u64(obj, \
44 { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \
45 { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \
46 { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \
47 { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \
48 { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \
49 { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \
50 { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \
51 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \
52 { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \
53 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \
54 { BTRFS_UUID_TREE_OBJECTID, "UUID_TREE" }, \
55 { BTRFS_FREE_SPACE_TREE_OBJECTID, "FREE_SPACE_TREE" }, \
56 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
58 #define show_root_type(obj) \
59 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
60 (obj >= BTRFS_ROOT_TREE_OBJECTID && \
61 obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
63 #define FLUSH_ACTIONS \
64 EM( BTRFS_RESERVE_NO_FLUSH, "BTRFS_RESERVE_NO_FLUSH") \
65 EM( BTRFS_RESERVE_FLUSH_LIMIT, "BTRFS_RESERVE_FLUSH_LIMIT") \
66 EM( BTRFS_RESERVE_FLUSH_ALL, "BTRFS_RESERVE_FLUSH_ALL") \
67 EMe(BTRFS_RESERVE_FLUSH_ALL_STEAL, "BTRFS_RESERVE_FLUSH_ALL_STEAL")
70 EM( BTRFS_FILE_EXTENT_INLINE, "INLINE") \
71 EM( BTRFS_FILE_EXTENT_REG, "REG") \
72 EMe(BTRFS_FILE_EXTENT_PREALLOC, "PREALLOC")
74 #define QGROUP_RSV_TYPES \
75 EM( BTRFS_QGROUP_RSV_DATA, "DATA") \
76 EM( BTRFS_QGROUP_RSV_META_PERTRANS, "META_PERTRANS") \
77 EMe(BTRFS_QGROUP_RSV_META_PREALLOC, "META_PREALLOC")
79 #define IO_TREE_OWNER \
80 EM( IO_TREE_FS_PINNED_EXTENTS, "PINNED_EXTENTS") \
81 EM( IO_TREE_FS_EXCLUDED_EXTENTS, "EXCLUDED_EXTENTS") \
82 EM( IO_TREE_BTREE_INODE_IO, "BTREE_INODE_IO") \
83 EM( IO_TREE_INODE_IO, "INODE_IO") \
84 EM( IO_TREE_INODE_IO_FAILURE, "INODE_IO_FAILURE") \
85 EM( IO_TREE_RELOC_BLOCKS, "RELOC_BLOCKS") \
86 EM( IO_TREE_TRANS_DIRTY_PAGES, "TRANS_DIRTY_PAGES") \
87 EM( IO_TREE_ROOT_DIRTY_LOG_PAGES, "ROOT_DIRTY_LOG_PAGES") \
88 EM( IO_TREE_INODE_FILE_EXTENT, "INODE_FILE_EXTENT") \
89 EM( IO_TREE_LOG_CSUM_RANGE, "LOG_CSUM_RANGE") \
90 EMe(IO_TREE_SELFTEST, "SELFTEST")
92 #define FLUSH_STATES \
93 EM( FLUSH_DELAYED_ITEMS_NR, "FLUSH_DELAYED_ITEMS_NR") \
94 EM( FLUSH_DELAYED_ITEMS, "FLUSH_DELAYED_ITEMS") \
95 EM( FLUSH_DELALLOC, "FLUSH_DELALLOC") \
96 EM( FLUSH_DELALLOC_WAIT, "FLUSH_DELALLOC_WAIT") \
97 EM( FLUSH_DELAYED_REFS_NR, "FLUSH_DELAYED_REFS_NR") \
98 EM( FLUSH_DELAYED_REFS, "FLUSH_ELAYED_REFS") \
99 EM( ALLOC_CHUNK, "ALLOC_CHUNK") \
100 EM( ALLOC_CHUNK_FORCE, "ALLOC_CHUNK_FORCE") \
101 EM( RUN_DELAYED_IPUTS, "RUN_DELAYED_IPUTS") \
102 EM( COMMIT_TRANS, "COMMIT_TRANS") \
103 EMe(FORCE_COMMIT_TRANS, "FORCE_COMMIT_TRANS")
106 * First define the enums in the above macros to be exported to userspace via
107 * TRACE_DEFINE_ENUM().
112 #define EM(a, b) TRACE_DEFINE_ENUM(a);
113 #define EMe(a, b) TRACE_DEFINE_ENUM(a);
122 * Now redefine the EM and EMe macros to map the enums to the strings that will
123 * be printed in the output
128 #define EM(a, b) {a, b},
129 #define EMe(a, b) {a, b}
132 #define BTRFS_GROUP_FLAGS \
133 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \
134 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
135 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
136 { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \
137 { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \
138 { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \
139 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
140 { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \
141 { BTRFS_BLOCK_GROUP_RAID6, "RAID6"}
143 #define EXTENT_FLAGS \
144 { EXTENT_DIRTY, "DIRTY"}, \
145 { EXTENT_UPTODATE, "UPTODATE"}, \
146 { EXTENT_LOCKED, "LOCKED"}, \
147 { EXTENT_NEW, "NEW"}, \
148 { EXTENT_DELALLOC, "DELALLOC"}, \
149 { EXTENT_DEFRAG, "DEFRAG"}, \
150 { EXTENT_BOUNDARY, "BOUNDARY"}, \
151 { EXTENT_NODATASUM, "NODATASUM"}, \
152 { EXTENT_CLEAR_META_RESV, "CLEAR_META_RESV"}, \
153 { EXTENT_NEED_WAIT, "NEED_WAIT"}, \
154 { EXTENT_DAMAGED, "DAMAGED"}, \
155 { EXTENT_NORESERVE, "NORESERVE"}, \
156 { EXTENT_QGROUP_RESERVED, "QGROUP_RESERVED"}, \
157 { EXTENT_CLEAR_DATA_RESV, "CLEAR_DATA_RESV"}, \
158 { EXTENT_DELALLOC_NEW, "DELALLOC_NEW"}
160 #define BTRFS_FSID_SIZE 16
161 #define TP_STRUCT__entry_fsid __array(u8, fsid, BTRFS_FSID_SIZE)
163 #define TP_fast_assign_fsid(fs_info) \
166 memcpy(__entry->fsid, fs_info->fs_devices->fsid, \
169 memset(__entry->fsid, 0, BTRFS_FSID_SIZE); \
172 #define TP_STRUCT__entry_btrfs(args...) \
174 TP_STRUCT__entry_fsid \
176 #define TP_fast_assign_btrfs(fs_info, args...) \
178 TP_fast_assign_fsid(fs_info); \
180 #define TP_printk_btrfs(fmt, args...) \
181 TP_printk("%pU: " fmt, __entry->fsid, args)
183 TRACE_EVENT(btrfs_transaction_commit,
185 TP_PROTO(const struct btrfs_root *root),
189 TP_STRUCT__entry_btrfs(
190 __field( u64, generation )
191 __field( u64, root_objectid )
194 TP_fast_assign_btrfs(root->fs_info,
195 __entry->generation = root->fs_info->generation;
196 __entry->root_objectid = root->root_key.objectid;
199 TP_printk_btrfs("root=%llu(%s) gen=%llu",
200 show_root_type(__entry->root_objectid),
204 DECLARE_EVENT_CLASS(btrfs__inode,
206 TP_PROTO(const struct inode *inode),
210 TP_STRUCT__entry_btrfs(
212 __field( u64, blocks )
213 __field( u64, disk_i_size )
214 __field( u64, generation )
215 __field( u64, last_trans )
216 __field( u64, logged_trans )
217 __field( u64, root_objectid )
220 TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
221 __entry->ino = btrfs_ino(BTRFS_I(inode));
222 __entry->blocks = inode->i_blocks;
223 __entry->disk_i_size = BTRFS_I(inode)->disk_i_size;
224 __entry->generation = BTRFS_I(inode)->generation;
225 __entry->last_trans = BTRFS_I(inode)->last_trans;
226 __entry->logged_trans = BTRFS_I(inode)->logged_trans;
227 __entry->root_objectid =
228 BTRFS_I(inode)->root->root_key.objectid;
231 TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%llu blocks=%llu "
232 "disk_i_size=%llu last_trans=%llu logged_trans=%llu",
233 show_root_type(__entry->root_objectid),
237 __entry->disk_i_size,
239 __entry->logged_trans)
242 DEFINE_EVENT(btrfs__inode, btrfs_inode_new,
244 TP_PROTO(const struct inode *inode),
249 DEFINE_EVENT(btrfs__inode, btrfs_inode_request,
251 TP_PROTO(const struct inode *inode),
256 DEFINE_EVENT(btrfs__inode, btrfs_inode_evict,
258 TP_PROTO(const struct inode *inode),
263 #define __show_map_type(type) \
264 __print_symbolic_u64(type, \
265 { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \
266 { EXTENT_MAP_HOLE, "HOLE" }, \
267 { EXTENT_MAP_INLINE, "INLINE" }, \
268 { EXTENT_MAP_DELALLOC, "DELALLOC" })
270 #define show_map_type(type) \
271 type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type)
273 #define show_map_flags(flag) \
274 __print_flags(flag, "|", \
275 { (1 << EXTENT_FLAG_PINNED), "PINNED" },\
276 { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\
277 { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\
278 { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\
279 { (1 << EXTENT_FLAG_FILLING), "FILLING" },\
280 { (1 << EXTENT_FLAG_FS_MAPPING), "FS_MAPPING" })
282 TRACE_EVENT_CONDITION(btrfs_get_extent,
284 TP_PROTO(const struct btrfs_root *root, const struct btrfs_inode *inode,
285 const struct extent_map *map),
287 TP_ARGS(root, inode, map),
291 TP_STRUCT__entry_btrfs(
292 __field( u64, root_objectid )
294 __field( u64, start )
296 __field( u64, orig_start )
297 __field( u64, block_start )
298 __field( u64, block_len )
299 __field( unsigned long, flags )
301 __field( unsigned int, compress_type )
304 TP_fast_assign_btrfs(root->fs_info,
305 __entry->root_objectid = root->root_key.objectid;
306 __entry->ino = btrfs_ino(inode);
307 __entry->start = map->start;
308 __entry->len = map->len;
309 __entry->orig_start = map->orig_start;
310 __entry->block_start = map->block_start;
311 __entry->block_len = map->block_len;
312 __entry->flags = map->flags;
313 __entry->refs = refcount_read(&map->refs);
314 __entry->compress_type = map->compress_type;
317 TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu "
318 "orig_start=%llu block_start=%llu(%s) "
319 "block_len=%llu flags=%s refs=%u "
321 show_root_type(__entry->root_objectid),
326 show_map_type(__entry->block_start),
328 show_map_flags(__entry->flags),
329 __entry->refs, __entry->compress_type)
332 TRACE_EVENT(btrfs_handle_em_exist,
334 TP_PROTO(const struct btrfs_fs_info *fs_info,
335 const struct extent_map *existing, const struct extent_map *map,
338 TP_ARGS(fs_info, existing, map, start, len),
340 TP_STRUCT__entry_btrfs(
341 __field( u64, e_start )
342 __field( u64, e_len )
343 __field( u64, map_start )
344 __field( u64, map_len )
345 __field( u64, start )
349 TP_fast_assign_btrfs(fs_info,
350 __entry->e_start = existing->start;
351 __entry->e_len = existing->len;
352 __entry->map_start = map->start;
353 __entry->map_len = map->len;
354 __entry->start = start;
358 TP_printk_btrfs("start=%llu len=%llu "
359 "existing(start=%llu len=%llu) "
360 "em(start=%llu len=%llu)",
369 /* file extent item */
370 DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular,
372 TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l,
373 const struct btrfs_file_extent_item *fi, u64 start),
375 TP_ARGS(bi, l, fi, start),
377 TP_STRUCT__entry_btrfs(
378 __field( u64, root_obj )
380 __field( loff_t, isize )
381 __field( u64, disk_isize )
382 __field( u64, num_bytes )
383 __field( u64, ram_bytes )
384 __field( u64, disk_bytenr )
385 __field( u64, disk_num_bytes )
386 __field( u64, extent_offset )
387 __field( u8, extent_type )
388 __field( u8, compression )
389 __field( u64, extent_start )
390 __field( u64, extent_end )
393 TP_fast_assign_btrfs(bi->root->fs_info,
394 __entry->root_obj = bi->root->root_key.objectid;
395 __entry->ino = btrfs_ino(bi);
396 __entry->isize = bi->vfs_inode.i_size;
397 __entry->disk_isize = bi->disk_i_size;
398 __entry->num_bytes = btrfs_file_extent_num_bytes(l, fi);
399 __entry->ram_bytes = btrfs_file_extent_ram_bytes(l, fi);
400 __entry->disk_bytenr = btrfs_file_extent_disk_bytenr(l, fi);
401 __entry->disk_num_bytes = btrfs_file_extent_disk_num_bytes(l, fi);
402 __entry->extent_offset = btrfs_file_extent_offset(l, fi);
403 __entry->extent_type = btrfs_file_extent_type(l, fi);
404 __entry->compression = btrfs_file_extent_compression(l, fi);
405 __entry->extent_start = start;
406 __entry->extent_end = (start + __entry->num_bytes);
410 "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu "
411 "file extent range=[%llu %llu] "
412 "(num_bytes=%llu ram_bytes=%llu disk_bytenr=%llu "
413 "disk_num_bytes=%llu extent_offset=%llu type=%s "
415 show_root_type(__entry->root_obj), __entry->ino,
417 __entry->disk_isize, __entry->extent_start,
418 __entry->extent_end, __entry->num_bytes, __entry->ram_bytes,
419 __entry->disk_bytenr, __entry->disk_num_bytes,
420 __entry->extent_offset, __print_symbolic(__entry->extent_type, FI_TYPES),
421 __entry->compression)
425 btrfs__file_extent_item_inline,
427 TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l,
428 const struct btrfs_file_extent_item *fi, int slot, u64 start),
430 TP_ARGS(bi, l, fi, slot, start),
432 TP_STRUCT__entry_btrfs(
433 __field( u64, root_obj )
435 __field( loff_t, isize )
436 __field( u64, disk_isize )
437 __field( u8, extent_type )
438 __field( u8, compression )
439 __field( u64, extent_start )
440 __field( u64, extent_end )
443 TP_fast_assign_btrfs(
445 __entry->root_obj = bi->root->root_key.objectid;
446 __entry->ino = btrfs_ino(bi);
447 __entry->isize = bi->vfs_inode.i_size;
448 __entry->disk_isize = bi->disk_i_size;
449 __entry->extent_type = btrfs_file_extent_type(l, fi);
450 __entry->compression = btrfs_file_extent_compression(l, fi);
451 __entry->extent_start = start;
452 __entry->extent_end = (start + btrfs_file_extent_ram_bytes(l, fi));
456 "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu "
457 "file extent range=[%llu %llu] "
458 "extent_type=%s compression=%u",
459 show_root_type(__entry->root_obj), __entry->ino, __entry->isize,
460 __entry->disk_isize, __entry->extent_start,
461 __entry->extent_end, __print_symbolic(__entry->extent_type, FI_TYPES),
462 __entry->compression)
466 btrfs__file_extent_item_regular, btrfs_get_extent_show_fi_regular,
468 TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l,
469 const struct btrfs_file_extent_item *fi, u64 start),
471 TP_ARGS(bi, l, fi, start)
475 btrfs__file_extent_item_regular, btrfs_truncate_show_fi_regular,
477 TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l,
478 const struct btrfs_file_extent_item *fi, u64 start),
480 TP_ARGS(bi, l, fi, start)
484 btrfs__file_extent_item_inline, btrfs_get_extent_show_fi_inline,
486 TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l,
487 const struct btrfs_file_extent_item *fi, int slot, u64 start),
489 TP_ARGS(bi, l, fi, slot, start)
493 btrfs__file_extent_item_inline, btrfs_truncate_show_fi_inline,
495 TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l,
496 const struct btrfs_file_extent_item *fi, int slot, u64 start),
498 TP_ARGS(bi, l, fi, slot, start)
501 #define show_ordered_flags(flags) \
502 __print_flags(flags, "|", \
503 { (1 << BTRFS_ORDERED_REGULAR), "REGULAR" }, \
504 { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \
505 { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \
506 { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \
507 { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \
508 { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \
509 { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \
510 { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \
511 { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" })
514 DECLARE_EVENT_CLASS(btrfs__ordered_extent,
516 TP_PROTO(const struct btrfs_inode *inode,
517 const struct btrfs_ordered_extent *ordered),
519 TP_ARGS(inode, ordered),
521 TP_STRUCT__entry_btrfs(
523 __field( u64, file_offset )
524 __field( u64, start )
526 __field( u64, disk_len )
527 __field( u64, bytes_left )
528 __field( unsigned long, flags )
529 __field( int, compress_type )
531 __field( u64, root_objectid )
532 __field( u64, truncated_len )
535 TP_fast_assign_btrfs(inode->root->fs_info,
536 __entry->ino = btrfs_ino(inode);
537 __entry->file_offset = ordered->file_offset;
538 __entry->start = ordered->disk_bytenr;
539 __entry->len = ordered->num_bytes;
540 __entry->disk_len = ordered->disk_num_bytes;
541 __entry->bytes_left = ordered->bytes_left;
542 __entry->flags = ordered->flags;
543 __entry->compress_type = ordered->compress_type;
544 __entry->refs = refcount_read(&ordered->refs);
545 __entry->root_objectid = inode->root->root_key.objectid;
546 __entry->truncated_len = ordered->truncated_len;
549 TP_printk_btrfs("root=%llu(%s) ino=%llu file_offset=%llu "
550 "start=%llu len=%llu disk_len=%llu "
551 "truncated_len=%llu "
552 "bytes_left=%llu flags=%s compress_type=%d "
554 show_root_type(__entry->root_objectid),
556 __entry->file_offset,
560 __entry->truncated_len,
562 show_ordered_flags(__entry->flags),
563 __entry->compress_type, __entry->refs)
566 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add,
568 TP_PROTO(const struct btrfs_inode *inode,
569 const struct btrfs_ordered_extent *ordered),
571 TP_ARGS(inode, ordered)
574 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove,
576 TP_PROTO(const struct btrfs_inode *inode,
577 const struct btrfs_ordered_extent *ordered),
579 TP_ARGS(inode, ordered)
582 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start,
584 TP_PROTO(const struct btrfs_inode *inode,
585 const struct btrfs_ordered_extent *ordered),
587 TP_ARGS(inode, ordered)
590 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put,
592 TP_PROTO(const struct btrfs_inode *inode,
593 const struct btrfs_ordered_extent *ordered),
595 TP_ARGS(inode, ordered)
598 DECLARE_EVENT_CLASS(btrfs__writepage,
600 TP_PROTO(const struct page *page, const struct inode *inode,
601 const struct writeback_control *wbc),
603 TP_ARGS(page, inode, wbc),
605 TP_STRUCT__entry_btrfs(
607 __field( pgoff_t, index )
608 __field( long, nr_to_write )
609 __field( long, pages_skipped )
610 __field( loff_t, range_start )
611 __field( loff_t, range_end )
612 __field( char, for_kupdate )
613 __field( char, for_reclaim )
614 __field( char, range_cyclic )
615 __field( unsigned long, writeback_index )
616 __field( u64, root_objectid )
619 TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
620 __entry->ino = btrfs_ino(BTRFS_I(inode));
621 __entry->index = page->index;
622 __entry->nr_to_write = wbc->nr_to_write;
623 __entry->pages_skipped = wbc->pages_skipped;
624 __entry->range_start = wbc->range_start;
625 __entry->range_end = wbc->range_end;
626 __entry->for_kupdate = wbc->for_kupdate;
627 __entry->for_reclaim = wbc->for_reclaim;
628 __entry->range_cyclic = wbc->range_cyclic;
629 __entry->writeback_index = inode->i_mapping->writeback_index;
630 __entry->root_objectid =
631 BTRFS_I(inode)->root->root_key.objectid;
634 TP_printk_btrfs("root=%llu(%s) ino=%llu page_index=%lu "
635 "nr_to_write=%ld pages_skipped=%ld range_start=%llu "
636 "range_end=%llu for_kupdate=%d "
637 "for_reclaim=%d range_cyclic=%d writeback_index=%lu",
638 show_root_type(__entry->root_objectid),
639 __entry->ino, __entry->index,
640 __entry->nr_to_write, __entry->pages_skipped,
641 __entry->range_start, __entry->range_end,
642 __entry->for_kupdate,
643 __entry->for_reclaim, __entry->range_cyclic,
644 __entry->writeback_index)
647 DEFINE_EVENT(btrfs__writepage, __extent_writepage,
649 TP_PROTO(const struct page *page, const struct inode *inode,
650 const struct writeback_control *wbc),
652 TP_ARGS(page, inode, wbc)
655 TRACE_EVENT(btrfs_writepage_end_io_hook,
657 TP_PROTO(const struct page *page, u64 start, u64 end, int uptodate),
659 TP_ARGS(page, start, end, uptodate),
661 TP_STRUCT__entry_btrfs(
663 __field( unsigned long, index )
664 __field( u64, start )
666 __field( int, uptodate )
667 __field( u64, root_objectid )
670 TP_fast_assign_btrfs(btrfs_sb(page->mapping->host->i_sb),
671 __entry->ino = btrfs_ino(BTRFS_I(page->mapping->host));
672 __entry->index = page->index;
673 __entry->start = start;
675 __entry->uptodate = uptodate;
676 __entry->root_objectid =
677 BTRFS_I(page->mapping->host)->root->root_key.objectid;
680 TP_printk_btrfs("root=%llu(%s) ino=%llu page_index=%lu start=%llu "
681 "end=%llu uptodate=%d",
682 show_root_type(__entry->root_objectid),
683 __entry->ino, __entry->index,
685 __entry->end, __entry->uptodate)
688 TRACE_EVENT(btrfs_sync_file,
690 TP_PROTO(const struct file *file, int datasync),
692 TP_ARGS(file, datasync),
694 TP_STRUCT__entry_btrfs(
696 __field( u64, parent )
697 __field( int, datasync )
698 __field( u64, root_objectid )
702 const struct dentry *dentry = file->f_path.dentry;
703 const struct inode *inode = d_inode(dentry);
705 TP_fast_assign_fsid(btrfs_sb(file->f_path.dentry->d_sb));
706 __entry->ino = btrfs_ino(BTRFS_I(inode));
707 __entry->parent = btrfs_ino(BTRFS_I(d_inode(dentry->d_parent)));
708 __entry->datasync = datasync;
709 __entry->root_objectid =
710 BTRFS_I(inode)->root->root_key.objectid;
713 TP_printk_btrfs("root=%llu(%s) ino=%llu parent=%llu datasync=%d",
714 show_root_type(__entry->root_objectid),
720 TRACE_EVENT(btrfs_sync_fs,
722 TP_PROTO(const struct btrfs_fs_info *fs_info, int wait),
724 TP_ARGS(fs_info, wait),
726 TP_STRUCT__entry_btrfs(
730 TP_fast_assign_btrfs(fs_info,
731 __entry->wait = wait;
734 TP_printk_btrfs("wait=%d", __entry->wait)
737 TRACE_EVENT(btrfs_add_block_group,
739 TP_PROTO(const struct btrfs_fs_info *fs_info,
740 const struct btrfs_block_group *block_group, int create),
742 TP_ARGS(fs_info, block_group, create),
744 TP_STRUCT__entry_btrfs(
745 __field( u64, offset )
747 __field( u64, flags )
748 __field( u64, bytes_used )
749 __field( u64, bytes_super )
750 __field( int, create )
753 TP_fast_assign_btrfs(fs_info,
754 __entry->offset = block_group->start;
755 __entry->size = block_group->length;
756 __entry->flags = block_group->flags;
757 __entry->bytes_used = block_group->used;
758 __entry->bytes_super = block_group->bytes_super;
759 __entry->create = create;
762 TP_printk_btrfs("block_group offset=%llu size=%llu "
763 "flags=%llu(%s) bytes_used=%llu bytes_super=%llu "
768 __print_flags((unsigned long)__entry->flags, "|",
771 __entry->bytes_super, __entry->create)
774 #define show_ref_action(action) \
775 __print_symbolic(action, \
776 { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \
777 { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \
778 { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \
779 { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
782 DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref,
784 TP_PROTO(const struct btrfs_fs_info *fs_info,
785 const struct btrfs_delayed_ref_node *ref,
786 const struct btrfs_delayed_tree_ref *full_ref,
789 TP_ARGS(fs_info, ref, full_ref, action),
791 TP_STRUCT__entry_btrfs(
792 __field( u64, bytenr )
793 __field( u64, num_bytes )
794 __field( int, action )
795 __field( u64, parent )
796 __field( u64, ref_root )
797 __field( int, level )
802 TP_fast_assign_btrfs(fs_info,
803 __entry->bytenr = ref->bytenr;
804 __entry->num_bytes = ref->num_bytes;
805 __entry->action = action;
806 __entry->parent = full_ref->parent;
807 __entry->ref_root = full_ref->root;
808 __entry->level = full_ref->level;
809 __entry->type = ref->type;
810 __entry->seq = ref->seq;
813 TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s "
814 "parent=%llu(%s) ref_root=%llu(%s) level=%d "
818 show_ref_action(__entry->action),
819 show_root_type(__entry->parent),
820 show_root_type(__entry->ref_root),
821 __entry->level, show_ref_type(__entry->type),
825 DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref,
827 TP_PROTO(const struct btrfs_fs_info *fs_info,
828 const struct btrfs_delayed_ref_node *ref,
829 const struct btrfs_delayed_tree_ref *full_ref,
832 TP_ARGS(fs_info, ref, full_ref, action)
835 DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref,
837 TP_PROTO(const struct btrfs_fs_info *fs_info,
838 const struct btrfs_delayed_ref_node *ref,
839 const struct btrfs_delayed_tree_ref *full_ref,
842 TP_ARGS(fs_info, ref, full_ref, action)
845 DECLARE_EVENT_CLASS(btrfs_delayed_data_ref,
847 TP_PROTO(const struct btrfs_fs_info *fs_info,
848 const struct btrfs_delayed_ref_node *ref,
849 const struct btrfs_delayed_data_ref *full_ref,
852 TP_ARGS(fs_info, ref, full_ref, action),
854 TP_STRUCT__entry_btrfs(
855 __field( u64, bytenr )
856 __field( u64, num_bytes )
857 __field( int, action )
858 __field( u64, parent )
859 __field( u64, ref_root )
860 __field( u64, owner )
861 __field( u64, offset )
866 TP_fast_assign_btrfs(fs_info,
867 __entry->bytenr = ref->bytenr;
868 __entry->num_bytes = ref->num_bytes;
869 __entry->action = action;
870 __entry->parent = full_ref->parent;
871 __entry->ref_root = full_ref->root;
872 __entry->owner = full_ref->objectid;
873 __entry->offset = full_ref->offset;
874 __entry->type = ref->type;
875 __entry->seq = ref->seq;
878 TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s "
879 "parent=%llu(%s) ref_root=%llu(%s) owner=%llu "
880 "offset=%llu type=%s seq=%llu",
883 show_ref_action(__entry->action),
884 show_root_type(__entry->parent),
885 show_root_type(__entry->ref_root),
888 show_ref_type(__entry->type),
892 DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref,
894 TP_PROTO(const struct btrfs_fs_info *fs_info,
895 const struct btrfs_delayed_ref_node *ref,
896 const struct btrfs_delayed_data_ref *full_ref,
899 TP_ARGS(fs_info, ref, full_ref, action)
902 DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref,
904 TP_PROTO(const struct btrfs_fs_info *fs_info,
905 const struct btrfs_delayed_ref_node *ref,
906 const struct btrfs_delayed_data_ref *full_ref,
909 TP_ARGS(fs_info, ref, full_ref, action)
912 DECLARE_EVENT_CLASS(btrfs_delayed_ref_head,
914 TP_PROTO(const struct btrfs_fs_info *fs_info,
915 const struct btrfs_delayed_ref_head *head_ref,
918 TP_ARGS(fs_info, head_ref, action),
920 TP_STRUCT__entry_btrfs(
921 __field( u64, bytenr )
922 __field( u64, num_bytes )
923 __field( int, action )
924 __field( int, is_data )
927 TP_fast_assign_btrfs(fs_info,
928 __entry->bytenr = head_ref->bytenr;
929 __entry->num_bytes = head_ref->num_bytes;
930 __entry->action = action;
931 __entry->is_data = head_ref->is_data;
934 TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d",
937 show_ref_action(__entry->action),
941 DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head,
943 TP_PROTO(const struct btrfs_fs_info *fs_info,
944 const struct btrfs_delayed_ref_head *head_ref,
947 TP_ARGS(fs_info, head_ref, action)
950 DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head,
952 TP_PROTO(const struct btrfs_fs_info *fs_info,
953 const struct btrfs_delayed_ref_head *head_ref,
956 TP_ARGS(fs_info, head_ref, action)
959 #define show_chunk_type(type) \
960 __print_flags(type, "|", \
961 { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \
962 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
963 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
964 { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \
965 { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \
966 { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \
967 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
968 { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \
969 { BTRFS_BLOCK_GROUP_RAID6, "RAID6" })
971 DECLARE_EVENT_CLASS(btrfs__chunk,
973 TP_PROTO(const struct btrfs_fs_info *fs_info,
974 const struct map_lookup *map, u64 offset, u64 size),
976 TP_ARGS(fs_info, map, offset, size),
978 TP_STRUCT__entry_btrfs(
979 __field( int, num_stripes )
981 __field( int, sub_stripes )
982 __field( u64, offset )
984 __field( u64, root_objectid )
987 TP_fast_assign_btrfs(fs_info,
988 __entry->num_stripes = map->num_stripes;
989 __entry->type = map->type;
990 __entry->sub_stripes = map->sub_stripes;
991 __entry->offset = offset;
992 __entry->size = size;
993 __entry->root_objectid = fs_info->chunk_root->root_key.objectid;
996 TP_printk_btrfs("root=%llu(%s) offset=%llu size=%llu "
997 "num_stripes=%d sub_stripes=%d type=%s",
998 show_root_type(__entry->root_objectid),
1001 __entry->num_stripes, __entry->sub_stripes,
1002 show_chunk_type(__entry->type))
1005 DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc,
1007 TP_PROTO(const struct btrfs_fs_info *fs_info,
1008 const struct map_lookup *map, u64 offset, u64 size),
1010 TP_ARGS(fs_info, map, offset, size)
1013 DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free,
1015 TP_PROTO(const struct btrfs_fs_info *fs_info,
1016 const struct map_lookup *map, u64 offset, u64 size),
1018 TP_ARGS(fs_info, map, offset, size)
1021 TRACE_EVENT(btrfs_cow_block,
1023 TP_PROTO(const struct btrfs_root *root, const struct extent_buffer *buf,
1024 const struct extent_buffer *cow),
1026 TP_ARGS(root, buf, cow),
1028 TP_STRUCT__entry_btrfs(
1029 __field( u64, root_objectid )
1030 __field( u64, buf_start )
1031 __field( int, refs )
1032 __field( u64, cow_start )
1033 __field( int, buf_level )
1034 __field( int, cow_level )
1037 TP_fast_assign_btrfs(root->fs_info,
1038 __entry->root_objectid = root->root_key.objectid;
1039 __entry->buf_start = buf->start;
1040 __entry->refs = atomic_read(&buf->refs);
1041 __entry->cow_start = cow->start;
1042 __entry->buf_level = btrfs_header_level(buf);
1043 __entry->cow_level = btrfs_header_level(cow);
1046 TP_printk_btrfs("root=%llu(%s) refs=%d orig_buf=%llu "
1047 "(orig_level=%d) cow_buf=%llu (cow_level=%d)",
1048 show_root_type(__entry->root_objectid),
1056 TRACE_EVENT(btrfs_space_reservation,
1058 TP_PROTO(const struct btrfs_fs_info *fs_info, const char *type, u64 val,
1059 u64 bytes, int reserve),
1061 TP_ARGS(fs_info, type, val, bytes, reserve),
1063 TP_STRUCT__entry_btrfs(
1064 __string( type, type )
1066 __field( u64, bytes )
1067 __field( int, reserve )
1070 TP_fast_assign_btrfs(fs_info,
1071 __assign_str(type, type);
1073 __entry->bytes = bytes;
1074 __entry->reserve = reserve;
1077 TP_printk_btrfs("%s: %llu %s %llu", __get_str(type), __entry->val,
1078 __entry->reserve ? "reserve" : "release",
1082 TRACE_EVENT(btrfs_trigger_flush,
1084 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes,
1085 int flush, const char *reason),
1087 TP_ARGS(fs_info, flags, bytes, flush, reason),
1089 TP_STRUCT__entry_btrfs(
1090 __field( u64, flags )
1091 __field( u64, bytes )
1092 __field( int, flush )
1093 __string( reason, reason )
1096 TP_fast_assign_btrfs(fs_info,
1097 __entry->flags = flags;
1098 __entry->bytes = bytes;
1099 __entry->flush = flush;
1100 __assign_str(reason, reason)
1103 TP_printk_btrfs("%s: flush=%d(%s) flags=%llu(%s) bytes=%llu",
1104 __get_str(reason), __entry->flush,
1105 __print_symbolic(__entry->flush, FLUSH_ACTIONS),
1107 __print_flags((unsigned long)__entry->flags, "|",
1113 TRACE_EVENT(btrfs_flush_space,
1115 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 num_bytes,
1116 int state, int ret, bool for_preempt),
1118 TP_ARGS(fs_info, flags, num_bytes, state, ret, for_preempt),
1120 TP_STRUCT__entry_btrfs(
1121 __field( u64, flags )
1122 __field( u64, num_bytes )
1123 __field( int, state )
1125 __field( bool, for_preempt )
1128 TP_fast_assign_btrfs(fs_info,
1129 __entry->flags = flags;
1130 __entry->num_bytes = num_bytes;
1131 __entry->state = state;
1133 __entry->for_preempt = for_preempt;
1136 TP_printk_btrfs("state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d for_preempt=%d",
1138 __print_symbolic(__entry->state, FLUSH_STATES),
1140 __print_flags((unsigned long)__entry->flags, "|",
1142 __entry->num_bytes, __entry->ret, __entry->for_preempt)
1145 DECLARE_EVENT_CLASS(btrfs__reserved_extent,
1147 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
1149 TP_ARGS(fs_info, start, len),
1151 TP_STRUCT__entry_btrfs(
1152 __field( u64, start )
1156 TP_fast_assign_btrfs(fs_info,
1157 __entry->start = start;
1161 TP_printk_btrfs("root=%llu(%s) start=%llu len=%llu",
1162 show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
1167 DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc,
1169 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
1171 TP_ARGS(fs_info, start, len)
1174 DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free,
1176 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
1178 TP_ARGS(fs_info, start, len)
1181 TRACE_EVENT(find_free_extent,
1183 TP_PROTO(const struct btrfs_root *root, u64 num_bytes,
1184 u64 empty_size, u64 data),
1186 TP_ARGS(root, num_bytes, empty_size, data),
1188 TP_STRUCT__entry_btrfs(
1189 __field( u64, root_objectid )
1190 __field( u64, num_bytes )
1191 __field( u64, empty_size )
1192 __field( u64, data )
1195 TP_fast_assign_btrfs(root->fs_info,
1196 __entry->root_objectid = root->root_key.objectid;
1197 __entry->num_bytes = num_bytes;
1198 __entry->empty_size = empty_size;
1199 __entry->data = data;
1202 TP_printk_btrfs("root=%llu(%s) len=%llu empty_size=%llu flags=%llu(%s)",
1203 show_root_type(__entry->root_objectid),
1204 __entry->num_bytes, __entry->empty_size, __entry->data,
1205 __print_flags((unsigned long)__entry->data, "|",
1209 DECLARE_EVENT_CLASS(btrfs__reserve_extent,
1211 TP_PROTO(const struct btrfs_block_group *block_group, u64 start,
1214 TP_ARGS(block_group, start, len),
1216 TP_STRUCT__entry_btrfs(
1217 __field( u64, bg_objectid )
1218 __field( u64, flags )
1219 __field( u64, start )
1223 TP_fast_assign_btrfs(block_group->fs_info,
1224 __entry->bg_objectid = block_group->start;
1225 __entry->flags = block_group->flags;
1226 __entry->start = start;
1230 TP_printk_btrfs("root=%llu(%s) block_group=%llu flags=%llu(%s) "
1231 "start=%llu len=%llu",
1232 show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
1233 __entry->bg_objectid,
1234 __entry->flags, __print_flags((unsigned long)__entry->flags,
1235 "|", BTRFS_GROUP_FLAGS),
1236 __entry->start, __entry->len)
1239 DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent,
1241 TP_PROTO(const struct btrfs_block_group *block_group, u64 start,
1244 TP_ARGS(block_group, start, len)
1247 DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
1249 TP_PROTO(const struct btrfs_block_group *block_group, u64 start,
1252 TP_ARGS(block_group, start, len)
1255 TRACE_EVENT(btrfs_find_cluster,
1257 TP_PROTO(const struct btrfs_block_group *block_group, u64 start,
1258 u64 bytes, u64 empty_size, u64 min_bytes),
1260 TP_ARGS(block_group, start, bytes, empty_size, min_bytes),
1262 TP_STRUCT__entry_btrfs(
1263 __field( u64, bg_objectid )
1264 __field( u64, flags )
1265 __field( u64, start )
1266 __field( u64, bytes )
1267 __field( u64, empty_size )
1268 __field( u64, min_bytes )
1271 TP_fast_assign_btrfs(block_group->fs_info,
1272 __entry->bg_objectid = block_group->start;
1273 __entry->flags = block_group->flags;
1274 __entry->start = start;
1275 __entry->bytes = bytes;
1276 __entry->empty_size = empty_size;
1277 __entry->min_bytes = min_bytes;
1280 TP_printk_btrfs("block_group=%llu flags=%llu(%s) start=%llu len=%llu "
1281 "empty_size=%llu min_bytes=%llu", __entry->bg_objectid,
1283 __print_flags((unsigned long)__entry->flags, "|",
1284 BTRFS_GROUP_FLAGS), __entry->start,
1285 __entry->bytes, __entry->empty_size, __entry->min_bytes)
1288 TRACE_EVENT(btrfs_failed_cluster_setup,
1290 TP_PROTO(const struct btrfs_block_group *block_group),
1292 TP_ARGS(block_group),
1294 TP_STRUCT__entry_btrfs(
1295 __field( u64, bg_objectid )
1298 TP_fast_assign_btrfs(block_group->fs_info,
1299 __entry->bg_objectid = block_group->start;
1302 TP_printk_btrfs("block_group=%llu", __entry->bg_objectid)
1305 TRACE_EVENT(btrfs_setup_cluster,
1307 TP_PROTO(const struct btrfs_block_group *block_group,
1308 const struct btrfs_free_cluster *cluster,
1309 u64 size, int bitmap),
1311 TP_ARGS(block_group, cluster, size, bitmap),
1313 TP_STRUCT__entry_btrfs(
1314 __field( u64, bg_objectid )
1315 __field( u64, flags )
1316 __field( u64, start )
1317 __field( u64, max_size )
1318 __field( u64, size )
1319 __field( int, bitmap )
1322 TP_fast_assign_btrfs(block_group->fs_info,
1323 __entry->bg_objectid = block_group->start;
1324 __entry->flags = block_group->flags;
1325 __entry->start = cluster->window_start;
1326 __entry->max_size = cluster->max_size;
1327 __entry->size = size;
1328 __entry->bitmap = bitmap;
1331 TP_printk_btrfs("block_group=%llu flags=%llu(%s) window_start=%llu "
1332 "size=%llu max_size=%llu bitmap=%d",
1333 __entry->bg_objectid,
1335 __print_flags((unsigned long)__entry->flags, "|",
1336 BTRFS_GROUP_FLAGS), __entry->start,
1337 __entry->size, __entry->max_size, __entry->bitmap)
1340 struct extent_state;
1341 TRACE_EVENT(alloc_extent_state,
1343 TP_PROTO(const struct extent_state *state,
1344 gfp_t mask, unsigned long IP),
1346 TP_ARGS(state, mask, IP),
1349 __field(const struct extent_state *, state)
1350 __field(gfp_t, mask)
1351 __field(const void*, ip)
1355 __entry->state = state,
1356 __entry->mask = mask,
1357 __entry->ip = (const void *)IP
1360 TP_printk("state=%p mask=%s caller=%pS", __entry->state,
1361 show_gfp_flags(__entry->mask), __entry->ip)
1364 TRACE_EVENT(free_extent_state,
1366 TP_PROTO(const struct extent_state *state, unsigned long IP),
1371 __field(const struct extent_state *, state)
1372 __field(const void*, ip)
1376 __entry->state = state,
1377 __entry->ip = (const void *)IP
1380 TP_printk("state=%p caller=%pS", __entry->state, __entry->ip)
1383 DECLARE_EVENT_CLASS(btrfs__work,
1385 TP_PROTO(const struct btrfs_work *work),
1389 TP_STRUCT__entry_btrfs(
1390 __field( const void *, work )
1391 __field( const void *, wq )
1392 __field( const void *, func )
1393 __field( const void *, ordered_func )
1394 __field( const void *, ordered_free )
1395 __field( const void *, normal_work )
1398 TP_fast_assign_btrfs(btrfs_work_owner(work),
1399 __entry->work = work;
1400 __entry->wq = work->wq;
1401 __entry->func = work->func;
1402 __entry->ordered_func = work->ordered_func;
1403 __entry->ordered_free = work->ordered_free;
1404 __entry->normal_work = &work->normal_work;
1407 TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%ps ordered_func=%p "
1409 __entry->work, __entry->normal_work, __entry->wq,
1410 __entry->func, __entry->ordered_func, __entry->ordered_free)
1414 * For situations when the work is freed, we pass fs_info and a tag that matches
1415 * the address of the work structure so it can be paired with the scheduling
1416 * event. DO NOT add anything here that dereferences wtag.
1418 DECLARE_EVENT_CLASS(btrfs__work__done,
1420 TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag),
1422 TP_ARGS(fs_info, wtag),
1424 TP_STRUCT__entry_btrfs(
1425 __field( const void *, wtag )
1428 TP_fast_assign_btrfs(fs_info,
1429 __entry->wtag = wtag;
1432 TP_printk_btrfs("work->%p", __entry->wtag)
1435 DEFINE_EVENT(btrfs__work, btrfs_work_queued,
1437 TP_PROTO(const struct btrfs_work *work),
1442 DEFINE_EVENT(btrfs__work, btrfs_work_sched,
1444 TP_PROTO(const struct btrfs_work *work),
1449 DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done,
1451 TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag),
1453 TP_ARGS(fs_info, wtag)
1456 DEFINE_EVENT(btrfs__work, btrfs_ordered_sched,
1458 TP_PROTO(const struct btrfs_work *work),
1463 DECLARE_EVENT_CLASS(btrfs__workqueue,
1465 TP_PROTO(const struct __btrfs_workqueue *wq,
1466 const char *name, int high),
1468 TP_ARGS(wq, name, high),
1470 TP_STRUCT__entry_btrfs(
1471 __field( const void *, wq )
1472 __string( name, name )
1473 __field( int , high )
1476 TP_fast_assign_btrfs(btrfs_workqueue_owner(wq),
1478 __assign_str(name, name);
1479 __entry->high = high;
1482 TP_printk_btrfs("name=%s%s wq=%p", __get_str(name),
1483 __print_flags(__entry->high, "",
1484 {(WQ_HIGHPRI), "-high"}),
1488 DEFINE_EVENT(btrfs__workqueue, btrfs_workqueue_alloc,
1490 TP_PROTO(const struct __btrfs_workqueue *wq,
1491 const char *name, int high),
1493 TP_ARGS(wq, name, high)
1496 DECLARE_EVENT_CLASS(btrfs__workqueue_done,
1498 TP_PROTO(const struct __btrfs_workqueue *wq),
1502 TP_STRUCT__entry_btrfs(
1503 __field( const void *, wq )
1506 TP_fast_assign_btrfs(btrfs_workqueue_owner(wq),
1510 TP_printk_btrfs("wq=%p", __entry->wq)
1513 DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy,
1515 TP_PROTO(const struct __btrfs_workqueue *wq),
1520 #define BTRFS_QGROUP_OPERATIONS \
1521 { QGROUP_RESERVE, "reserve" }, \
1522 { QGROUP_RELEASE, "release" }, \
1523 { QGROUP_FREE, "free" }
1525 DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data,
1527 TP_PROTO(const struct inode *inode, u64 start, u64 len,
1528 u64 reserved, int op),
1530 TP_ARGS(inode, start, len, reserved, op),
1532 TP_STRUCT__entry_btrfs(
1533 __field( u64, rootid )
1535 __field( u64, start )
1537 __field( u64, reserved )
1541 TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
1543 BTRFS_I(inode)->root->root_key.objectid;
1544 __entry->ino = btrfs_ino(BTRFS_I(inode));
1545 __entry->start = start;
1547 __entry->reserved = reserved;
1551 TP_printk_btrfs("root=%llu ino=%llu start=%llu len=%llu reserved=%llu op=%s",
1552 __entry->rootid, __entry->ino, __entry->start, __entry->len,
1554 __print_flags((unsigned long)__entry->op, "",
1555 BTRFS_QGROUP_OPERATIONS)
1559 DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_reserve_data,
1561 TP_PROTO(const struct inode *inode, u64 start, u64 len,
1562 u64 reserved, int op),
1564 TP_ARGS(inode, start, len, reserved, op)
1567 DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_release_data,
1569 TP_PROTO(const struct inode *inode, u64 start, u64 len,
1570 u64 reserved, int op),
1572 TP_ARGS(inode, start, len, reserved, op)
1575 DECLARE_EVENT_CLASS(btrfs_qgroup_extent,
1576 TP_PROTO(const struct btrfs_fs_info *fs_info,
1577 const struct btrfs_qgroup_extent_record *rec),
1579 TP_ARGS(fs_info, rec),
1581 TP_STRUCT__entry_btrfs(
1582 __field( u64, bytenr )
1583 __field( u64, num_bytes )
1586 TP_fast_assign_btrfs(fs_info,
1587 __entry->bytenr = rec->bytenr,
1588 __entry->num_bytes = rec->num_bytes;
1591 TP_printk_btrfs("bytenr=%llu num_bytes=%llu",
1592 __entry->bytenr, __entry->num_bytes)
1595 DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents,
1597 TP_PROTO(const struct btrfs_fs_info *fs_info,
1598 const struct btrfs_qgroup_extent_record *rec),
1600 TP_ARGS(fs_info, rec)
1603 DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_trace_extent,
1605 TP_PROTO(const struct btrfs_fs_info *fs_info,
1606 const struct btrfs_qgroup_extent_record *rec),
1608 TP_ARGS(fs_info, rec)
1611 TRACE_EVENT(qgroup_num_dirty_extents,
1613 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 transid,
1614 u64 num_dirty_extents),
1616 TP_ARGS(fs_info, transid, num_dirty_extents),
1618 TP_STRUCT__entry_btrfs(
1619 __field( u64, transid )
1620 __field( u64, num_dirty_extents )
1623 TP_fast_assign_btrfs(fs_info,
1624 __entry->transid = transid;
1625 __entry->num_dirty_extents = num_dirty_extents;
1628 TP_printk_btrfs("transid=%llu num_dirty_extents=%llu",
1629 __entry->transid, __entry->num_dirty_extents)
1632 TRACE_EVENT(btrfs_qgroup_account_extent,
1634 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 transid, u64 bytenr,
1635 u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots),
1637 TP_ARGS(fs_info, transid, bytenr, num_bytes, nr_old_roots,
1640 TP_STRUCT__entry_btrfs(
1641 __field( u64, transid )
1642 __field( u64, bytenr )
1643 __field( u64, num_bytes )
1644 __field( u64, nr_old_roots )
1645 __field( u64, nr_new_roots )
1648 TP_fast_assign_btrfs(fs_info,
1649 __entry->transid = transid;
1650 __entry->bytenr = bytenr;
1651 __entry->num_bytes = num_bytes;
1652 __entry->nr_old_roots = nr_old_roots;
1653 __entry->nr_new_roots = nr_new_roots;
1657 "transid=%llu bytenr=%llu num_bytes=%llu nr_old_roots=%llu nr_new_roots=%llu",
1661 __entry->nr_old_roots,
1662 __entry->nr_new_roots)
1665 TRACE_EVENT(qgroup_update_counters,
1667 TP_PROTO(const struct btrfs_fs_info *fs_info,
1668 const struct btrfs_qgroup *qgroup,
1669 u64 cur_old_count, u64 cur_new_count),
1671 TP_ARGS(fs_info, qgroup, cur_old_count, cur_new_count),
1673 TP_STRUCT__entry_btrfs(
1674 __field( u64, qgid )
1675 __field( u64, old_rfer )
1676 __field( u64, old_excl )
1677 __field( u64, cur_old_count )
1678 __field( u64, cur_new_count )
1681 TP_fast_assign_btrfs(fs_info,
1682 __entry->qgid = qgroup->qgroupid;
1683 __entry->old_rfer = qgroup->rfer;
1684 __entry->old_excl = qgroup->excl;
1685 __entry->cur_old_count = cur_old_count;
1686 __entry->cur_new_count = cur_new_count;
1689 TP_printk_btrfs("qgid=%llu old_rfer=%llu old_excl=%llu cur_old_count=%llu cur_new_count=%llu",
1690 __entry->qgid, __entry->old_rfer, __entry->old_excl,
1691 __entry->cur_old_count, __entry->cur_new_count)
1694 TRACE_EVENT(qgroup_update_reserve,
1696 TP_PROTO(struct btrfs_fs_info *fs_info, struct btrfs_qgroup *qgroup,
1697 s64 diff, int type),
1699 TP_ARGS(fs_info, qgroup, diff, type),
1701 TP_STRUCT__entry_btrfs(
1702 __field( u64, qgid )
1703 __field( u64, cur_reserved )
1704 __field( s64, diff )
1705 __field( int, type )
1708 TP_fast_assign_btrfs(fs_info,
1709 __entry->qgid = qgroup->qgroupid;
1710 __entry->cur_reserved = qgroup->rsv.values[type];
1711 __entry->diff = diff;
1712 __entry->type = type;
1715 TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld",
1716 __entry->qgid, __print_symbolic(__entry->type, QGROUP_RSV_TYPES),
1717 __entry->cur_reserved, __entry->diff)
1720 TRACE_EVENT(qgroup_meta_reserve,
1722 TP_PROTO(struct btrfs_root *root, s64 diff, int type),
1724 TP_ARGS(root, diff, type),
1726 TP_STRUCT__entry_btrfs(
1727 __field( u64, refroot )
1728 __field( s64, diff )
1729 __field( int, type )
1732 TP_fast_assign_btrfs(root->fs_info,
1733 __entry->refroot = root->root_key.objectid;
1734 __entry->diff = diff;
1735 __entry->type = type;
1738 TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld",
1739 show_root_type(__entry->refroot),
1740 __print_symbolic(__entry->type, QGROUP_RSV_TYPES), __entry->diff)
1743 TRACE_EVENT(qgroup_meta_convert,
1745 TP_PROTO(struct btrfs_root *root, s64 diff),
1747 TP_ARGS(root, diff),
1749 TP_STRUCT__entry_btrfs(
1750 __field( u64, refroot )
1751 __field( s64, diff )
1754 TP_fast_assign_btrfs(root->fs_info,
1755 __entry->refroot = root->root_key.objectid;
1756 __entry->diff = diff;
1759 TP_printk_btrfs("refroot=%llu(%s) type=%s->%s diff=%lld",
1760 show_root_type(__entry->refroot),
1761 __print_symbolic(BTRFS_QGROUP_RSV_META_PREALLOC, QGROUP_RSV_TYPES),
1762 __print_symbolic(BTRFS_QGROUP_RSV_META_PERTRANS, QGROUP_RSV_TYPES),
1766 TRACE_EVENT(qgroup_meta_free_all_pertrans,
1768 TP_PROTO(struct btrfs_root *root),
1772 TP_STRUCT__entry_btrfs(
1773 __field( u64, refroot )
1774 __field( s64, diff )
1775 __field( int, type )
1778 TP_fast_assign_btrfs(root->fs_info,
1779 __entry->refroot = root->root_key.objectid;
1780 spin_lock(&root->qgroup_meta_rsv_lock);
1781 __entry->diff = -(s64)root->qgroup_meta_rsv_pertrans;
1782 spin_unlock(&root->qgroup_meta_rsv_lock);
1783 __entry->type = BTRFS_QGROUP_RSV_META_PERTRANS;
1786 TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld",
1787 show_root_type(__entry->refroot),
1788 __print_symbolic(__entry->type, QGROUP_RSV_TYPES), __entry->diff)
1791 DECLARE_EVENT_CLASS(btrfs__prelim_ref,
1792 TP_PROTO(const struct btrfs_fs_info *fs_info,
1793 const struct prelim_ref *oldref,
1794 const struct prelim_ref *newref, u64 tree_size),
1795 TP_ARGS(fs_info, newref, oldref, tree_size),
1797 TP_STRUCT__entry_btrfs(
1798 __field( u64, root_id )
1799 __field( u64, objectid )
1801 __field( u64, offset )
1802 __field( int, level )
1803 __field( int, old_count )
1804 __field( u64, parent )
1805 __field( u64, bytenr )
1806 __field( int, mod_count )
1807 __field( u64, tree_size )
1810 TP_fast_assign_btrfs(fs_info,
1811 __entry->root_id = oldref->root_id;
1812 __entry->objectid = oldref->key_for_search.objectid;
1813 __entry->type = oldref->key_for_search.type;
1814 __entry->offset = oldref->key_for_search.offset;
1815 __entry->level = oldref->level;
1816 __entry->old_count = oldref->count;
1817 __entry->parent = oldref->parent;
1818 __entry->bytenr = oldref->wanted_disk_byte;
1819 __entry->mod_count = newref ? newref->count : 0;
1820 __entry->tree_size = tree_size;
1823 TP_printk_btrfs("root_id=%llu key=[%llu,%u,%llu] level=%d count=[%d+%d=%d] parent=%llu wanted_disk_byte=%llu nodes=%llu",
1825 __entry->objectid, __entry->type,
1826 __entry->offset, __entry->level,
1827 __entry->old_count, __entry->mod_count,
1828 __entry->old_count + __entry->mod_count,
1834 DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_merge,
1835 TP_PROTO(const struct btrfs_fs_info *fs_info,
1836 const struct prelim_ref *oldref,
1837 const struct prelim_ref *newref, u64 tree_size),
1838 TP_ARGS(fs_info, oldref, newref, tree_size)
1841 DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_insert,
1842 TP_PROTO(const struct btrfs_fs_info *fs_info,
1843 const struct prelim_ref *oldref,
1844 const struct prelim_ref *newref, u64 tree_size),
1845 TP_ARGS(fs_info, oldref, newref, tree_size)
1848 TRACE_EVENT(btrfs_inode_mod_outstanding_extents,
1849 TP_PROTO(const struct btrfs_root *root, u64 ino, int mod),
1851 TP_ARGS(root, ino, mod),
1853 TP_STRUCT__entry_btrfs(
1854 __field( u64, root_objectid )
1859 TP_fast_assign_btrfs(root->fs_info,
1860 __entry->root_objectid = root->root_key.objectid;
1865 TP_printk_btrfs("root=%llu(%s) ino=%llu mod=%d",
1866 show_root_type(__entry->root_objectid),
1867 __entry->ino, __entry->mod)
1870 DECLARE_EVENT_CLASS(btrfs__block_group,
1871 TP_PROTO(const struct btrfs_block_group *bg_cache),
1875 TP_STRUCT__entry_btrfs(
1876 __field( u64, bytenr )
1878 __field( u64, used )
1879 __field( u64, flags )
1882 TP_fast_assign_btrfs(bg_cache->fs_info,
1883 __entry->bytenr = bg_cache->start,
1884 __entry->len = bg_cache->length,
1885 __entry->used = bg_cache->used;
1886 __entry->flags = bg_cache->flags;
1889 TP_printk_btrfs("bg bytenr=%llu len=%llu used=%llu flags=%llu(%s)",
1890 __entry->bytenr, __entry->len, __entry->used, __entry->flags,
1891 __print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS))
1894 DEFINE_EVENT(btrfs__block_group, btrfs_remove_block_group,
1895 TP_PROTO(const struct btrfs_block_group *bg_cache),
1900 DEFINE_EVENT(btrfs__block_group, btrfs_add_unused_block_group,
1901 TP_PROTO(const struct btrfs_block_group *bg_cache),
1906 DEFINE_EVENT(btrfs__block_group, btrfs_skip_unused_block_group,
1907 TP_PROTO(const struct btrfs_block_group *bg_cache),
1912 TRACE_EVENT(btrfs_set_extent_bit,
1913 TP_PROTO(const struct extent_io_tree *tree,
1914 u64 start, u64 len, unsigned set_bits),
1916 TP_ARGS(tree, start, len, set_bits),
1918 TP_STRUCT__entry_btrfs(
1919 __field( unsigned, owner )
1921 __field( u64, rootid )
1922 __field( u64, start )
1924 __field( unsigned, set_bits)
1927 TP_fast_assign_btrfs(tree->fs_info,
1928 __entry->owner = tree->owner;
1929 if (tree->private_data) {
1930 const struct inode *inode = tree->private_data;
1932 __entry->ino = btrfs_ino(BTRFS_I(inode));
1934 BTRFS_I(inode)->root->root_key.objectid;
1937 __entry->rootid = 0;
1939 __entry->start = start;
1941 __entry->set_bits = set_bits;
1945 "io_tree=%s ino=%llu root=%llu start=%llu len=%llu set_bits=%s",
1946 __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino,
1947 __entry->rootid, __entry->start, __entry->len,
1948 __print_flags(__entry->set_bits, "|", EXTENT_FLAGS))
1951 TRACE_EVENT(btrfs_clear_extent_bit,
1952 TP_PROTO(const struct extent_io_tree *tree,
1953 u64 start, u64 len, unsigned clear_bits),
1955 TP_ARGS(tree, start, len, clear_bits),
1957 TP_STRUCT__entry_btrfs(
1958 __field( unsigned, owner )
1960 __field( u64, rootid )
1961 __field( u64, start )
1963 __field( unsigned, clear_bits)
1966 TP_fast_assign_btrfs(tree->fs_info,
1967 __entry->owner = tree->owner;
1968 if (tree->private_data) {
1969 const struct inode *inode = tree->private_data;
1971 __entry->ino = btrfs_ino(BTRFS_I(inode));
1973 BTRFS_I(inode)->root->root_key.objectid;
1976 __entry->rootid = 0;
1978 __entry->start = start;
1980 __entry->clear_bits = clear_bits;
1984 "io_tree=%s ino=%llu root=%llu start=%llu len=%llu clear_bits=%s",
1985 __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino,
1986 __entry->rootid, __entry->start, __entry->len,
1987 __print_flags(__entry->clear_bits, "|", EXTENT_FLAGS))
1990 TRACE_EVENT(btrfs_convert_extent_bit,
1991 TP_PROTO(const struct extent_io_tree *tree,
1992 u64 start, u64 len, unsigned set_bits, unsigned clear_bits),
1994 TP_ARGS(tree, start, len, set_bits, clear_bits),
1996 TP_STRUCT__entry_btrfs(
1997 __field( unsigned, owner )
1999 __field( u64, rootid )
2000 __field( u64, start )
2002 __field( unsigned, set_bits)
2003 __field( unsigned, clear_bits)
2006 TP_fast_assign_btrfs(tree->fs_info,
2007 __entry->owner = tree->owner;
2008 if (tree->private_data) {
2009 const struct inode *inode = tree->private_data;
2011 __entry->ino = btrfs_ino(BTRFS_I(inode));
2013 BTRFS_I(inode)->root->root_key.objectid;
2016 __entry->rootid = 0;
2018 __entry->start = start;
2020 __entry->set_bits = set_bits;
2021 __entry->clear_bits = clear_bits;
2025 "io_tree=%s ino=%llu root=%llu start=%llu len=%llu set_bits=%s clear_bits=%s",
2026 __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino,
2027 __entry->rootid, __entry->start, __entry->len,
2028 __print_flags(__entry->set_bits , "|", EXTENT_FLAGS),
2029 __print_flags(__entry->clear_bits, "|", EXTENT_FLAGS))
2032 TRACE_EVENT(btrfs_reserve_ticket,
2033 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes,
2034 u64 start_ns, int flush, int error),
2036 TP_ARGS(fs_info, flags, bytes, start_ns, flush, error),
2038 TP_STRUCT__entry_btrfs(
2039 __field( u64, flags )
2040 __field( u64, bytes )
2041 __field( u64, start_ns )
2042 __field( int, flush )
2043 __field( int, error )
2046 TP_fast_assign_btrfs(fs_info,
2047 __entry->flags = flags;
2048 __entry->bytes = bytes;
2049 __entry->start_ns = start_ns;
2050 __entry->flush = flush;
2051 __entry->error = error;
2054 TP_printk_btrfs("flags=%s bytes=%llu start_ns=%llu flush=%s error=%d",
2055 __print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS),
2056 __entry->bytes, __entry->start_ns,
2057 __print_symbolic(__entry->flush, FLUSH_ACTIONS),
2061 DECLARE_EVENT_CLASS(btrfs_sleep_tree_lock,
2062 TP_PROTO(const struct extent_buffer *eb, u64 start_ns),
2064 TP_ARGS(eb, start_ns),
2066 TP_STRUCT__entry_btrfs(
2067 __field( u64, block )
2068 __field( u64, generation )
2069 __field( u64, start_ns )
2070 __field( u64, end_ns )
2071 __field( u64, diff_ns )
2072 __field( u64, owner )
2073 __field( int, is_log_tree )
2076 TP_fast_assign_btrfs(eb->fs_info,
2077 __entry->block = eb->start;
2078 __entry->generation = btrfs_header_generation(eb);
2079 __entry->start_ns = start_ns;
2080 __entry->end_ns = ktime_get_ns();
2081 __entry->diff_ns = __entry->end_ns - start_ns;
2082 __entry->owner = btrfs_header_owner(eb);
2083 __entry->is_log_tree = (eb->log_index >= 0);
2087 "block=%llu generation=%llu start_ns=%llu end_ns=%llu diff_ns=%llu owner=%llu is_log_tree=%d",
2088 __entry->block, __entry->generation,
2089 __entry->start_ns, __entry->end_ns, __entry->diff_ns,
2090 __entry->owner, __entry->is_log_tree)
2093 DEFINE_EVENT(btrfs_sleep_tree_lock, btrfs_tree_read_lock,
2094 TP_PROTO(const struct extent_buffer *eb, u64 start_ns),
2096 TP_ARGS(eb, start_ns)
2099 DEFINE_EVENT(btrfs_sleep_tree_lock, btrfs_tree_lock,
2100 TP_PROTO(const struct extent_buffer *eb, u64 start_ns),
2102 TP_ARGS(eb, start_ns)
2105 DECLARE_EVENT_CLASS(btrfs_locking_events,
2106 TP_PROTO(const struct extent_buffer *eb),
2110 TP_STRUCT__entry_btrfs(
2111 __field( u64, block )
2112 __field( u64, generation )
2113 __field( u64, owner )
2114 __field( int, is_log_tree )
2117 TP_fast_assign_btrfs(eb->fs_info,
2118 __entry->block = eb->start;
2119 __entry->generation = btrfs_header_generation(eb);
2120 __entry->owner = btrfs_header_owner(eb);
2121 __entry->is_log_tree = (eb->log_index >= 0);
2124 TP_printk_btrfs("block=%llu generation=%llu owner=%llu is_log_tree=%d",
2125 __entry->block, __entry->generation,
2126 __entry->owner, __entry->is_log_tree)
2129 #define DEFINE_BTRFS_LOCK_EVENT(name) \
2130 DEFINE_EVENT(btrfs_locking_events, name, \
2131 TP_PROTO(const struct extent_buffer *eb), \
2136 DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_unlock);
2137 DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock);
2138 DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock_blocking);
2139 DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_read);
2140 DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_write);
2141 DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_read_lock);
2142 DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_write_lock);
2143 DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_lock_atomic);
2145 DECLARE_EVENT_CLASS(btrfs__space_info_update,
2147 TP_PROTO(const struct btrfs_fs_info *fs_info,
2148 const struct btrfs_space_info *sinfo, u64 old, s64 diff),
2150 TP_ARGS(fs_info, sinfo, old, diff),
2152 TP_STRUCT__entry_btrfs(
2153 __field( u64, type )
2155 __field( s64, diff )
2158 TP_fast_assign_btrfs(fs_info,
2159 __entry->type = sinfo->flags;
2161 __entry->diff = diff;
2163 TP_printk_btrfs("type=%s old=%llu diff=%lld",
2164 __print_flags(__entry->type, "|", BTRFS_GROUP_FLAGS),
2165 __entry->old, __entry->diff)
2168 DEFINE_EVENT(btrfs__space_info_update, update_bytes_may_use,
2170 TP_PROTO(const struct btrfs_fs_info *fs_info,
2171 const struct btrfs_space_info *sinfo, u64 old, s64 diff),
2173 TP_ARGS(fs_info, sinfo, old, diff)
2176 DEFINE_EVENT(btrfs__space_info_update, update_bytes_pinned,
2178 TP_PROTO(const struct btrfs_fs_info *fs_info,
2179 const struct btrfs_space_info *sinfo, u64 old, s64 diff),
2181 TP_ARGS(fs_info, sinfo, old, diff)
2184 #endif /* _TRACE_BTRFS_H */
2186 /* This part must be outside protection */
2187 #include <trace/define_trace.h>