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 TRACE_DEFINE_ENUM(FLUSH_DELAYED_ITEMS_NR
);
35 TRACE_DEFINE_ENUM(FLUSH_DELAYED_ITEMS
);
36 TRACE_DEFINE_ENUM(FLUSH_DELALLOC
);
37 TRACE_DEFINE_ENUM(FLUSH_DELALLOC_WAIT
);
38 TRACE_DEFINE_ENUM(ALLOC_CHUNK
);
39 TRACE_DEFINE_ENUM(COMMIT_TRANS
);
41 #define show_ref_type(type) \
42 __print_symbolic(type, \
43 { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \
44 { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \
45 { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \
46 { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \
47 { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" })
49 #define __show_root_type(obj) \
50 __print_symbolic_u64(obj, \
51 { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \
52 { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \
53 { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \
54 { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \
55 { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \
56 { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \
57 { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \
58 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \
59 { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \
60 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \
61 { BTRFS_UUID_TREE_OBJECTID, "UUID_TREE" }, \
62 { BTRFS_FREE_SPACE_TREE_OBJECTID, "FREE_SPACE_TREE" }, \
63 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
65 #define show_root_type(obj) \
66 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
67 (obj >= BTRFS_ROOT_TREE_OBJECTID && \
68 obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
70 #define show_fi_type(type) \
71 __print_symbolic(type, \
72 { BTRFS_FILE_EXTENT_INLINE, "INLINE" }, \
73 { BTRFS_FILE_EXTENT_REG, "REG" }, \
74 { BTRFS_FILE_EXTENT_PREALLOC, "PREALLOC"})
76 #define show_qgroup_rsv_type(type) \
77 __print_symbolic(type, \
78 { BTRFS_QGROUP_RSV_DATA, "DATA" }, \
79 { BTRFS_QGROUP_RSV_META_PERTRANS, "META_PERTRANS" }, \
80 { BTRFS_QGROUP_RSV_META_PREALLOC, "META_PREALLOC" })
82 #define show_extent_io_tree_owner(owner) \
83 __print_symbolic(owner, \
84 { IO_TREE_FS_INFO_FREED_EXTENTS0, "FREED_EXTENTS0" }, \
85 { IO_TREE_FS_INFO_FREED_EXTENTS1, "FREED_EXTENTS1" }, \
86 { IO_TREE_INODE_IO, "INODE_IO" }, \
87 { IO_TREE_INODE_IO_FAILURE, "INODE_IO_FAILURE" }, \
88 { IO_TREE_RELOC_BLOCKS, "RELOC_BLOCKS" }, \
89 { IO_TREE_TRANS_DIRTY_PAGES, "TRANS_DIRTY_PAGES" }, \
90 { IO_TREE_ROOT_DIRTY_LOG_PAGES, "ROOT_DIRTY_LOG_PAGES" }, \
91 { IO_TREE_SELFTEST, "SELFTEST" })
93 #define BTRFS_GROUP_FLAGS \
94 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \
95 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
96 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
97 { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \
98 { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \
99 { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \
100 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
101 { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \
102 { BTRFS_BLOCK_GROUP_RAID6, "RAID6"}
104 #define EXTENT_FLAGS \
105 { EXTENT_DIRTY, "DIRTY"}, \
106 { EXTENT_UPTODATE, "UPTODATE"}, \
107 { EXTENT_LOCKED, "LOCKED"}, \
108 { EXTENT_NEW, "NEW"}, \
109 { EXTENT_DELALLOC, "DELALLOC"}, \
110 { EXTENT_DEFRAG, "DEFRAG"}, \
111 { EXTENT_BOUNDARY, "BOUNDARY"}, \
112 { EXTENT_NODATASUM, "NODATASUM"}, \
113 { EXTENT_CLEAR_META_RESV, "CLEAR_META_RESV"}, \
114 { EXTENT_NEED_WAIT, "NEED_WAIT"}, \
115 { EXTENT_DAMAGED, "DAMAGED"}, \
116 { EXTENT_NORESERVE, "NORESERVE"}, \
117 { EXTENT_QGROUP_RESERVED, "QGROUP_RESERVED"}, \
118 { EXTENT_CLEAR_DATA_RESV, "CLEAR_DATA_RESV"}, \
119 { EXTENT_DELALLOC_NEW, "DELALLOC_NEW"}
121 #define BTRFS_FSID_SIZE 16
122 #define TP_STRUCT__entry_fsid __array(u8, fsid, BTRFS_FSID_SIZE)
124 #define TP_fast_assign_fsid(fs_info) \
127 memcpy(__entry->fsid, fs_info->fs_devices->fsid, \
130 memset(__entry->fsid, 0, BTRFS_FSID_SIZE); \
133 #define TP_STRUCT__entry_btrfs(args...) \
135 TP_STRUCT__entry_fsid \
137 #define TP_fast_assign_btrfs(fs_info, args...) \
139 TP_fast_assign_fsid(fs_info); \
141 #define TP_printk_btrfs(fmt, args...) \
142 TP_printk("%pU: " fmt, __entry->fsid, args)
144 TRACE_EVENT(btrfs_transaction_commit
,
146 TP_PROTO(const struct btrfs_root
*root
),
150 TP_STRUCT__entry_btrfs(
151 __field( u64
, generation
)
152 __field( u64
, root_objectid
)
155 TP_fast_assign_btrfs(root
->fs_info
,
156 __entry
->generation
= root
->fs_info
->generation
;
157 __entry
->root_objectid
= root
->root_key
.objectid
;
160 TP_printk_btrfs("root=%llu(%s) gen=%llu",
161 show_root_type(__entry
->root_objectid
),
165 DECLARE_EVENT_CLASS(btrfs__inode
,
167 TP_PROTO(const struct inode
*inode
),
171 TP_STRUCT__entry_btrfs(
173 __field( u64
, blocks
)
174 __field( u64
, disk_i_size
)
175 __field( u64
, generation
)
176 __field( u64
, last_trans
)
177 __field( u64
, logged_trans
)
178 __field( u64
, root_objectid
)
181 TP_fast_assign_btrfs(btrfs_sb(inode
->i_sb
),
182 __entry
->ino
= btrfs_ino(BTRFS_I(inode
));
183 __entry
->blocks
= inode
->i_blocks
;
184 __entry
->disk_i_size
= BTRFS_I(inode
)->disk_i_size
;
185 __entry
->generation
= BTRFS_I(inode
)->generation
;
186 __entry
->last_trans
= BTRFS_I(inode
)->last_trans
;
187 __entry
->logged_trans
= BTRFS_I(inode
)->logged_trans
;
188 __entry
->root_objectid
=
189 BTRFS_I(inode
)->root
->root_key
.objectid
;
192 TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%llu blocks=%llu "
193 "disk_i_size=%llu last_trans=%llu logged_trans=%llu",
194 show_root_type(__entry
->root_objectid
),
198 __entry
->disk_i_size
,
200 __entry
->logged_trans
)
203 DEFINE_EVENT(btrfs__inode
, btrfs_inode_new
,
205 TP_PROTO(const struct inode
*inode
),
210 DEFINE_EVENT(btrfs__inode
, btrfs_inode_request
,
212 TP_PROTO(const struct inode
*inode
),
217 DEFINE_EVENT(btrfs__inode
, btrfs_inode_evict
,
219 TP_PROTO(const struct inode
*inode
),
224 #define __show_map_type(type) \
225 __print_symbolic_u64(type, \
226 { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \
227 { EXTENT_MAP_HOLE, "HOLE" }, \
228 { EXTENT_MAP_INLINE, "INLINE" }, \
229 { EXTENT_MAP_DELALLOC, "DELALLOC" })
231 #define show_map_type(type) \
232 type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type)
234 #define show_map_flags(flag) \
235 __print_flags(flag, "|", \
236 { (1 << EXTENT_FLAG_PINNED), "PINNED" },\
237 { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\
238 { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\
239 { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\
240 { (1 << EXTENT_FLAG_FILLING), "FILLING" },\
241 { (1 << EXTENT_FLAG_FS_MAPPING), "FS_MAPPING" })
243 TRACE_EVENT_CONDITION(btrfs_get_extent
,
245 TP_PROTO(const struct btrfs_root
*root
, const struct btrfs_inode
*inode
,
246 const struct extent_map
*map
),
248 TP_ARGS(root
, inode
, map
),
252 TP_STRUCT__entry_btrfs(
253 __field( u64
, root_objectid
)
255 __field( u64
, start
)
257 __field( u64
, orig_start
)
258 __field( u64
, block_start
)
259 __field( u64
, block_len
)
260 __field( unsigned long, flags
)
262 __field( unsigned int, compress_type
)
265 TP_fast_assign_btrfs(root
->fs_info
,
266 __entry
->root_objectid
= root
->root_key
.objectid
;
267 __entry
->ino
= btrfs_ino(inode
);
268 __entry
->start
= map
->start
;
269 __entry
->len
= map
->len
;
270 __entry
->orig_start
= map
->orig_start
;
271 __entry
->block_start
= map
->block_start
;
272 __entry
->block_len
= map
->block_len
;
273 __entry
->flags
= map
->flags
;
274 __entry
->refs
= refcount_read(&map
->refs
);
275 __entry
->compress_type
= map
->compress_type
;
278 TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu "
279 "orig_start=%llu block_start=%llu(%s) "
280 "block_len=%llu flags=%s refs=%u "
282 show_root_type(__entry
->root_objectid
),
287 show_map_type(__entry
->block_start
),
289 show_map_flags(__entry
->flags
),
290 __entry
->refs
, __entry
->compress_type
)
293 TRACE_EVENT(btrfs_handle_em_exist
,
295 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
296 const struct extent_map
*existing
, const struct extent_map
*map
,
299 TP_ARGS(fs_info
, existing
, map
, start
, len
),
301 TP_STRUCT__entry_btrfs(
302 __field( u64
, e_start
)
303 __field( u64
, e_len
)
304 __field( u64
, map_start
)
305 __field( u64
, map_len
)
306 __field( u64
, start
)
310 TP_fast_assign_btrfs(fs_info
,
311 __entry
->e_start
= existing
->start
;
312 __entry
->e_len
= existing
->len
;
313 __entry
->map_start
= map
->start
;
314 __entry
->map_len
= map
->len
;
315 __entry
->start
= start
;
319 TP_printk_btrfs("start=%llu len=%llu "
320 "existing(start=%llu len=%llu) "
321 "em(start=%llu len=%llu)",
330 /* file extent item */
331 DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular
,
333 TP_PROTO(const struct btrfs_inode
*bi
, const struct extent_buffer
*l
,
334 const struct btrfs_file_extent_item
*fi
, u64 start
),
336 TP_ARGS(bi
, l
, fi
, start
),
338 TP_STRUCT__entry_btrfs(
339 __field( u64
, root_obj
)
341 __field( loff_t
, isize
)
342 __field( u64
, disk_isize
)
343 __field( u64
, num_bytes
)
344 __field( u64
, ram_bytes
)
345 __field( u64
, disk_bytenr
)
346 __field( u64
, disk_num_bytes
)
347 __field( u64
, extent_offset
)
348 __field( u8
, extent_type
)
349 __field( u8
, compression
)
350 __field( u64
, extent_start
)
351 __field( u64
, extent_end
)
354 TP_fast_assign_btrfs(bi
->root
->fs_info
,
355 __entry
->root_obj
= bi
->root
->root_key
.objectid
;
356 __entry
->ino
= btrfs_ino(bi
);
357 __entry
->isize
= bi
->vfs_inode
.i_size
;
358 __entry
->disk_isize
= bi
->disk_i_size
;
359 __entry
->num_bytes
= btrfs_file_extent_num_bytes(l
, fi
);
360 __entry
->ram_bytes
= btrfs_file_extent_ram_bytes(l
, fi
);
361 __entry
->disk_bytenr
= btrfs_file_extent_disk_bytenr(l
, fi
);
362 __entry
->disk_num_bytes
= btrfs_file_extent_disk_num_bytes(l
, fi
);
363 __entry
->extent_offset
= btrfs_file_extent_offset(l
, fi
);
364 __entry
->extent_type
= btrfs_file_extent_type(l
, fi
);
365 __entry
->compression
= btrfs_file_extent_compression(l
, fi
);
366 __entry
->extent_start
= start
;
367 __entry
->extent_end
= (start
+ __entry
->num_bytes
);
371 "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu "
372 "file extent range=[%llu %llu] "
373 "(num_bytes=%llu ram_bytes=%llu disk_bytenr=%llu "
374 "disk_num_bytes=%llu extent_offset=%llu type=%s "
376 show_root_type(__entry
->root_obj
), __entry
->ino
,
378 __entry
->disk_isize
, __entry
->extent_start
,
379 __entry
->extent_end
, __entry
->num_bytes
, __entry
->ram_bytes
,
380 __entry
->disk_bytenr
, __entry
->disk_num_bytes
,
381 __entry
->extent_offset
, show_fi_type(__entry
->extent_type
),
382 __entry
->compression
)
386 btrfs__file_extent_item_inline
,
388 TP_PROTO(const struct btrfs_inode
*bi
, const struct extent_buffer
*l
,
389 const struct btrfs_file_extent_item
*fi
, int slot
, u64 start
),
391 TP_ARGS(bi
, l
, fi
, slot
, start
),
393 TP_STRUCT__entry_btrfs(
394 __field( u64
, root_obj
)
396 __field( loff_t
, isize
)
397 __field( u64
, disk_isize
)
398 __field( u8
, extent_type
)
399 __field( u8
, compression
)
400 __field( u64
, extent_start
)
401 __field( u64
, extent_end
)
404 TP_fast_assign_btrfs(
406 __entry
->root_obj
= bi
->root
->root_key
.objectid
;
407 __entry
->ino
= btrfs_ino(bi
);
408 __entry
->isize
= bi
->vfs_inode
.i_size
;
409 __entry
->disk_isize
= bi
->disk_i_size
;
410 __entry
->extent_type
= btrfs_file_extent_type(l
, fi
);
411 __entry
->compression
= btrfs_file_extent_compression(l
, fi
);
412 __entry
->extent_start
= start
;
413 __entry
->extent_end
= (start
+ btrfs_file_extent_ram_bytes(l
, fi
));
417 "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu "
418 "file extent range=[%llu %llu] "
419 "extent_type=%s compression=%u",
420 show_root_type(__entry
->root_obj
), __entry
->ino
, __entry
->isize
,
421 __entry
->disk_isize
, __entry
->extent_start
,
422 __entry
->extent_end
, show_fi_type(__entry
->extent_type
),
423 __entry
->compression
)
427 btrfs__file_extent_item_regular
, btrfs_get_extent_show_fi_regular
,
429 TP_PROTO(const struct btrfs_inode
*bi
, const struct extent_buffer
*l
,
430 const struct btrfs_file_extent_item
*fi
, u64 start
),
432 TP_ARGS(bi
, l
, fi
, start
)
436 btrfs__file_extent_item_regular
, btrfs_truncate_show_fi_regular
,
438 TP_PROTO(const struct btrfs_inode
*bi
, const struct extent_buffer
*l
,
439 const struct btrfs_file_extent_item
*fi
, u64 start
),
441 TP_ARGS(bi
, l
, fi
, start
)
445 btrfs__file_extent_item_inline
, btrfs_get_extent_show_fi_inline
,
447 TP_PROTO(const struct btrfs_inode
*bi
, const struct extent_buffer
*l
,
448 const struct btrfs_file_extent_item
*fi
, int slot
, u64 start
),
450 TP_ARGS(bi
, l
, fi
, slot
, start
)
454 btrfs__file_extent_item_inline
, btrfs_truncate_show_fi_inline
,
456 TP_PROTO(const struct btrfs_inode
*bi
, const struct extent_buffer
*l
,
457 const struct btrfs_file_extent_item
*fi
, int slot
, u64 start
),
459 TP_ARGS(bi
, l
, fi
, slot
, start
)
462 #define show_ordered_flags(flags) \
463 __print_flags(flags, "|", \
464 { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \
465 { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \
466 { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \
467 { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \
468 { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \
469 { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \
470 { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \
471 { (1 << BTRFS_ORDERED_UPDATED_ISIZE), "UPDATED_ISIZE" }, \
472 { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" })
475 DECLARE_EVENT_CLASS(btrfs__ordered_extent
,
477 TP_PROTO(const struct inode
*inode
,
478 const struct btrfs_ordered_extent
*ordered
),
480 TP_ARGS(inode
, ordered
),
482 TP_STRUCT__entry_btrfs(
484 __field( u64
, file_offset
)
485 __field( u64
, start
)
487 __field( u64
, disk_len
)
488 __field( u64
, bytes_left
)
489 __field( unsigned long, flags
)
490 __field( int, compress_type
)
492 __field( u64
, root_objectid
)
493 __field( u64
, truncated_len
)
496 TP_fast_assign_btrfs(btrfs_sb(inode
->i_sb
),
497 __entry
->ino
= btrfs_ino(BTRFS_I(inode
));
498 __entry
->file_offset
= ordered
->file_offset
;
499 __entry
->start
= ordered
->disk_bytenr
;
500 __entry
->len
= ordered
->num_bytes
;
501 __entry
->disk_len
= ordered
->disk_num_bytes
;
502 __entry
->bytes_left
= ordered
->bytes_left
;
503 __entry
->flags
= ordered
->flags
;
504 __entry
->compress_type
= ordered
->compress_type
;
505 __entry
->refs
= refcount_read(&ordered
->refs
);
506 __entry
->root_objectid
=
507 BTRFS_I(inode
)->root
->root_key
.objectid
;
508 __entry
->truncated_len
= ordered
->truncated_len
;
511 TP_printk_btrfs("root=%llu(%s) ino=%llu file_offset=%llu "
512 "start=%llu len=%llu disk_len=%llu "
513 "truncated_len=%llu "
514 "bytes_left=%llu flags=%s compress_type=%d "
516 show_root_type(__entry
->root_objectid
),
518 __entry
->file_offset
,
522 __entry
->truncated_len
,
524 show_ordered_flags(__entry
->flags
),
525 __entry
->compress_type
, __entry
->refs
)
528 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_add
,
530 TP_PROTO(const struct inode
*inode
,
531 const struct btrfs_ordered_extent
*ordered
),
533 TP_ARGS(inode
, ordered
)
536 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_remove
,
538 TP_PROTO(const struct inode
*inode
,
539 const struct btrfs_ordered_extent
*ordered
),
541 TP_ARGS(inode
, ordered
)
544 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_start
,
546 TP_PROTO(const struct inode
*inode
,
547 const struct btrfs_ordered_extent
*ordered
),
549 TP_ARGS(inode
, ordered
)
552 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_put
,
554 TP_PROTO(const struct inode
*inode
,
555 const struct btrfs_ordered_extent
*ordered
),
557 TP_ARGS(inode
, ordered
)
560 DECLARE_EVENT_CLASS(btrfs__writepage
,
562 TP_PROTO(const struct page
*page
, const struct inode
*inode
,
563 const struct writeback_control
*wbc
),
565 TP_ARGS(page
, inode
, wbc
),
567 TP_STRUCT__entry_btrfs(
569 __field( pgoff_t
, index
)
570 __field( long, nr_to_write
)
571 __field( long, pages_skipped
)
572 __field( loff_t
, range_start
)
573 __field( loff_t
, range_end
)
574 __field( char, for_kupdate
)
575 __field( char, for_reclaim
)
576 __field( char, range_cyclic
)
577 __field( unsigned long, writeback_index
)
578 __field( u64
, root_objectid
)
581 TP_fast_assign_btrfs(btrfs_sb(inode
->i_sb
),
582 __entry
->ino
= btrfs_ino(BTRFS_I(inode
));
583 __entry
->index
= page
->index
;
584 __entry
->nr_to_write
= wbc
->nr_to_write
;
585 __entry
->pages_skipped
= wbc
->pages_skipped
;
586 __entry
->range_start
= wbc
->range_start
;
587 __entry
->range_end
= wbc
->range_end
;
588 __entry
->for_kupdate
= wbc
->for_kupdate
;
589 __entry
->for_reclaim
= wbc
->for_reclaim
;
590 __entry
->range_cyclic
= wbc
->range_cyclic
;
591 __entry
->writeback_index
= inode
->i_mapping
->writeback_index
;
592 __entry
->root_objectid
=
593 BTRFS_I(inode
)->root
->root_key
.objectid
;
596 TP_printk_btrfs("root=%llu(%s) ino=%llu page_index=%lu "
597 "nr_to_write=%ld pages_skipped=%ld range_start=%llu "
598 "range_end=%llu for_kupdate=%d "
599 "for_reclaim=%d range_cyclic=%d writeback_index=%lu",
600 show_root_type(__entry
->root_objectid
),
601 __entry
->ino
, __entry
->index
,
602 __entry
->nr_to_write
, __entry
->pages_skipped
,
603 __entry
->range_start
, __entry
->range_end
,
604 __entry
->for_kupdate
,
605 __entry
->for_reclaim
, __entry
->range_cyclic
,
606 __entry
->writeback_index
)
609 DEFINE_EVENT(btrfs__writepage
, __extent_writepage
,
611 TP_PROTO(const struct page
*page
, const struct inode
*inode
,
612 const struct writeback_control
*wbc
),
614 TP_ARGS(page
, inode
, wbc
)
617 TRACE_EVENT(btrfs_writepage_end_io_hook
,
619 TP_PROTO(const struct page
*page
, u64 start
, u64 end
, int uptodate
),
621 TP_ARGS(page
, start
, end
, uptodate
),
623 TP_STRUCT__entry_btrfs(
625 __field( unsigned long, index
)
626 __field( u64
, start
)
628 __field( int, uptodate
)
629 __field( u64
, root_objectid
)
632 TP_fast_assign_btrfs(btrfs_sb(page
->mapping
->host
->i_sb
),
633 __entry
->ino
= btrfs_ino(BTRFS_I(page
->mapping
->host
));
634 __entry
->index
= page
->index
;
635 __entry
->start
= start
;
637 __entry
->uptodate
= uptodate
;
638 __entry
->root_objectid
=
639 BTRFS_I(page
->mapping
->host
)->root
->root_key
.objectid
;
642 TP_printk_btrfs("root=%llu(%s) ino=%llu page_index=%lu start=%llu "
643 "end=%llu uptodate=%d",
644 show_root_type(__entry
->root_objectid
),
645 __entry
->ino
, __entry
->index
,
647 __entry
->end
, __entry
->uptodate
)
650 TRACE_EVENT(btrfs_sync_file
,
652 TP_PROTO(const struct file
*file
, int datasync
),
654 TP_ARGS(file
, datasync
),
656 TP_STRUCT__entry_btrfs(
658 __field( u64
, parent
)
659 __field( int, datasync
)
660 __field( u64
, root_objectid
)
664 const struct dentry
*dentry
= file
->f_path
.dentry
;
665 const struct inode
*inode
= d_inode(dentry
);
667 TP_fast_assign_fsid(btrfs_sb(file
->f_path
.dentry
->d_sb
));
668 __entry
->ino
= btrfs_ino(BTRFS_I(inode
));
669 __entry
->parent
= btrfs_ino(BTRFS_I(d_inode(dentry
->d_parent
)));
670 __entry
->datasync
= datasync
;
671 __entry
->root_objectid
=
672 BTRFS_I(inode
)->root
->root_key
.objectid
;
675 TP_printk_btrfs("root=%llu(%s) ino=%llu parent=%llu datasync=%d",
676 show_root_type(__entry
->root_objectid
),
682 TRACE_EVENT(btrfs_sync_fs
,
684 TP_PROTO(const struct btrfs_fs_info
*fs_info
, int wait
),
686 TP_ARGS(fs_info
, wait
),
688 TP_STRUCT__entry_btrfs(
692 TP_fast_assign_btrfs(fs_info
,
693 __entry
->wait
= wait
;
696 TP_printk_btrfs("wait=%d", __entry
->wait
)
699 TRACE_EVENT(btrfs_add_block_group
,
701 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
702 const struct btrfs_block_group
*block_group
, int create
),
704 TP_ARGS(fs_info
, block_group
, create
),
706 TP_STRUCT__entry_btrfs(
707 __field( u64
, offset
)
709 __field( u64
, flags
)
710 __field( u64
, bytes_used
)
711 __field( u64
, bytes_super
)
712 __field( int, create
)
715 TP_fast_assign_btrfs(fs_info
,
716 __entry
->offset
= block_group
->start
;
717 __entry
->size
= block_group
->length
;
718 __entry
->flags
= block_group
->flags
;
719 __entry
->bytes_used
= block_group
->used
;
720 __entry
->bytes_super
= block_group
->bytes_super
;
721 __entry
->create
= create
;
724 TP_printk_btrfs("block_group offset=%llu size=%llu "
725 "flags=%llu(%s) bytes_used=%llu bytes_super=%llu "
730 __print_flags((unsigned long)__entry
->flags
, "|",
733 __entry
->bytes_super
, __entry
->create
)
736 #define show_ref_action(action) \
737 __print_symbolic(action, \
738 { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \
739 { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \
740 { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \
741 { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
744 DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref
,
746 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
747 const struct btrfs_delayed_ref_node
*ref
,
748 const struct btrfs_delayed_tree_ref
*full_ref
,
751 TP_ARGS(fs_info
, ref
, full_ref
, action
),
753 TP_STRUCT__entry_btrfs(
754 __field( u64
, bytenr
)
755 __field( u64
, num_bytes
)
756 __field( int, action
)
757 __field( u64
, parent
)
758 __field( u64
, ref_root
)
759 __field( int, level
)
764 TP_fast_assign_btrfs(fs_info
,
765 __entry
->bytenr
= ref
->bytenr
;
766 __entry
->num_bytes
= ref
->num_bytes
;
767 __entry
->action
= action
;
768 __entry
->parent
= full_ref
->parent
;
769 __entry
->ref_root
= full_ref
->root
;
770 __entry
->level
= full_ref
->level
;
771 __entry
->type
= ref
->type
;
772 __entry
->seq
= ref
->seq
;
775 TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s "
776 "parent=%llu(%s) ref_root=%llu(%s) level=%d "
780 show_ref_action(__entry
->action
),
781 show_root_type(__entry
->parent
),
782 show_root_type(__entry
->ref_root
),
783 __entry
->level
, show_ref_type(__entry
->type
),
787 DEFINE_EVENT(btrfs_delayed_tree_ref
, add_delayed_tree_ref
,
789 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
790 const struct btrfs_delayed_ref_node
*ref
,
791 const struct btrfs_delayed_tree_ref
*full_ref
,
794 TP_ARGS(fs_info
, ref
, full_ref
, action
)
797 DEFINE_EVENT(btrfs_delayed_tree_ref
, run_delayed_tree_ref
,
799 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
800 const struct btrfs_delayed_ref_node
*ref
,
801 const struct btrfs_delayed_tree_ref
*full_ref
,
804 TP_ARGS(fs_info
, ref
, full_ref
, action
)
807 DECLARE_EVENT_CLASS(btrfs_delayed_data_ref
,
809 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
810 const struct btrfs_delayed_ref_node
*ref
,
811 const struct btrfs_delayed_data_ref
*full_ref
,
814 TP_ARGS(fs_info
, ref
, full_ref
, action
),
816 TP_STRUCT__entry_btrfs(
817 __field( u64
, bytenr
)
818 __field( u64
, num_bytes
)
819 __field( int, action
)
820 __field( u64
, parent
)
821 __field( u64
, ref_root
)
822 __field( u64
, owner
)
823 __field( u64
, offset
)
828 TP_fast_assign_btrfs(fs_info
,
829 __entry
->bytenr
= ref
->bytenr
;
830 __entry
->num_bytes
= ref
->num_bytes
;
831 __entry
->action
= action
;
832 __entry
->parent
= full_ref
->parent
;
833 __entry
->ref_root
= full_ref
->root
;
834 __entry
->owner
= full_ref
->objectid
;
835 __entry
->offset
= full_ref
->offset
;
836 __entry
->type
= ref
->type
;
837 __entry
->seq
= ref
->seq
;
840 TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s "
841 "parent=%llu(%s) ref_root=%llu(%s) owner=%llu "
842 "offset=%llu type=%s seq=%llu",
845 show_ref_action(__entry
->action
),
846 show_root_type(__entry
->parent
),
847 show_root_type(__entry
->ref_root
),
850 show_ref_type(__entry
->type
),
854 DEFINE_EVENT(btrfs_delayed_data_ref
, add_delayed_data_ref
,
856 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
857 const struct btrfs_delayed_ref_node
*ref
,
858 const struct btrfs_delayed_data_ref
*full_ref
,
861 TP_ARGS(fs_info
, ref
, full_ref
, action
)
864 DEFINE_EVENT(btrfs_delayed_data_ref
, run_delayed_data_ref
,
866 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
867 const struct btrfs_delayed_ref_node
*ref
,
868 const struct btrfs_delayed_data_ref
*full_ref
,
871 TP_ARGS(fs_info
, ref
, full_ref
, action
)
874 DECLARE_EVENT_CLASS(btrfs_delayed_ref_head
,
876 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
877 const struct btrfs_delayed_ref_head
*head_ref
,
880 TP_ARGS(fs_info
, head_ref
, action
),
882 TP_STRUCT__entry_btrfs(
883 __field( u64
, bytenr
)
884 __field( u64
, num_bytes
)
885 __field( int, action
)
886 __field( int, is_data
)
889 TP_fast_assign_btrfs(fs_info
,
890 __entry
->bytenr
= head_ref
->bytenr
;
891 __entry
->num_bytes
= head_ref
->num_bytes
;
892 __entry
->action
= action
;
893 __entry
->is_data
= head_ref
->is_data
;
896 TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d",
899 show_ref_action(__entry
->action
),
903 DEFINE_EVENT(btrfs_delayed_ref_head
, add_delayed_ref_head
,
905 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
906 const struct btrfs_delayed_ref_head
*head_ref
,
909 TP_ARGS(fs_info
, head_ref
, action
)
912 DEFINE_EVENT(btrfs_delayed_ref_head
, run_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
)
921 #define show_chunk_type(type) \
922 __print_flags(type, "|", \
923 { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \
924 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
925 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
926 { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \
927 { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \
928 { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \
929 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
930 { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \
931 { BTRFS_BLOCK_GROUP_RAID6, "RAID6" })
933 DECLARE_EVENT_CLASS(btrfs__chunk
,
935 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
936 const struct map_lookup
*map
, u64 offset
, u64 size
),
938 TP_ARGS(fs_info
, map
, offset
, size
),
940 TP_STRUCT__entry_btrfs(
941 __field( int, num_stripes
)
943 __field( int, sub_stripes
)
944 __field( u64
, offset
)
946 __field( u64
, root_objectid
)
949 TP_fast_assign_btrfs(fs_info
,
950 __entry
->num_stripes
= map
->num_stripes
;
951 __entry
->type
= map
->type
;
952 __entry
->sub_stripes
= map
->sub_stripes
;
953 __entry
->offset
= offset
;
954 __entry
->size
= size
;
955 __entry
->root_objectid
= fs_info
->chunk_root
->root_key
.objectid
;
958 TP_printk_btrfs("root=%llu(%s) offset=%llu size=%llu "
959 "num_stripes=%d sub_stripes=%d type=%s",
960 show_root_type(__entry
->root_objectid
),
963 __entry
->num_stripes
, __entry
->sub_stripes
,
964 show_chunk_type(__entry
->type
))
967 DEFINE_EVENT(btrfs__chunk
, btrfs_chunk_alloc
,
969 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
970 const struct map_lookup
*map
, u64 offset
, u64 size
),
972 TP_ARGS(fs_info
, map
, offset
, size
)
975 DEFINE_EVENT(btrfs__chunk
, btrfs_chunk_free
,
977 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
978 const struct map_lookup
*map
, u64 offset
, u64 size
),
980 TP_ARGS(fs_info
, map
, offset
, size
)
983 TRACE_EVENT(btrfs_cow_block
,
985 TP_PROTO(const struct btrfs_root
*root
, const struct extent_buffer
*buf
,
986 const struct extent_buffer
*cow
),
988 TP_ARGS(root
, buf
, cow
),
990 TP_STRUCT__entry_btrfs(
991 __field( u64
, root_objectid
)
992 __field( u64
, buf_start
)
994 __field( u64
, cow_start
)
995 __field( int, buf_level
)
996 __field( int, cow_level
)
999 TP_fast_assign_btrfs(root
->fs_info
,
1000 __entry
->root_objectid
= root
->root_key
.objectid
;
1001 __entry
->buf_start
= buf
->start
;
1002 __entry
->refs
= atomic_read(&buf
->refs
);
1003 __entry
->cow_start
= cow
->start
;
1004 __entry
->buf_level
= btrfs_header_level(buf
);
1005 __entry
->cow_level
= btrfs_header_level(cow
);
1008 TP_printk_btrfs("root=%llu(%s) refs=%d orig_buf=%llu "
1009 "(orig_level=%d) cow_buf=%llu (cow_level=%d)",
1010 show_root_type(__entry
->root_objectid
),
1018 TRACE_EVENT(btrfs_space_reservation
,
1020 TP_PROTO(const struct btrfs_fs_info
*fs_info
, const char *type
, u64 val
,
1021 u64 bytes
, int reserve
),
1023 TP_ARGS(fs_info
, type
, val
, bytes
, reserve
),
1025 TP_STRUCT__entry_btrfs(
1026 __string( type
, type
)
1028 __field( u64
, bytes
)
1029 __field( int, reserve
)
1032 TP_fast_assign_btrfs(fs_info
,
1033 __assign_str(type
, type
);
1035 __entry
->bytes
= bytes
;
1036 __entry
->reserve
= reserve
;
1039 TP_printk_btrfs("%s: %llu %s %llu", __get_str(type
), __entry
->val
,
1040 __entry
->reserve
? "reserve" : "release",
1044 #define show_flush_action(action) \
1045 __print_symbolic(action, \
1046 { BTRFS_RESERVE_NO_FLUSH, "BTRFS_RESERVE_NO_FLUSH"}, \
1047 { BTRFS_RESERVE_FLUSH_LIMIT, "BTRFS_RESERVE_FLUSH_LIMIT"}, \
1048 { BTRFS_RESERVE_FLUSH_ALL, "BTRFS_RESERVE_FLUSH_ALL"})
1050 TRACE_EVENT(btrfs_trigger_flush
,
1052 TP_PROTO(const struct btrfs_fs_info
*fs_info
, u64 flags
, u64 bytes
,
1053 int flush
, const char *reason
),
1055 TP_ARGS(fs_info
, flags
, bytes
, flush
, reason
),
1057 TP_STRUCT__entry_btrfs(
1058 __field( u64
, flags
)
1059 __field( u64
, bytes
)
1060 __field( int, flush
)
1061 __string( reason
, reason
)
1064 TP_fast_assign_btrfs(fs_info
,
1065 __entry
->flags
= flags
;
1066 __entry
->bytes
= bytes
;
1067 __entry
->flush
= flush
;
1068 __assign_str(reason
, reason
)
1071 TP_printk_btrfs("%s: flush=%d(%s) flags=%llu(%s) bytes=%llu",
1072 __get_str(reason
), __entry
->flush
,
1073 show_flush_action(__entry
->flush
),
1075 __print_flags((unsigned long)__entry
->flags
, "|",
1080 #define show_flush_state(state) \
1081 __print_symbolic(state, \
1082 { FLUSH_DELAYED_ITEMS_NR, "FLUSH_DELAYED_ITEMS_NR"}, \
1083 { FLUSH_DELAYED_ITEMS, "FLUSH_DELAYED_ITEMS"}, \
1084 { FLUSH_DELALLOC, "FLUSH_DELALLOC"}, \
1085 { FLUSH_DELALLOC_WAIT, "FLUSH_DELALLOC_WAIT"}, \
1086 { FLUSH_DELAYED_REFS_NR, "FLUSH_DELAYED_REFS_NR"}, \
1087 { FLUSH_DELAYED_REFS, "FLUSH_ELAYED_REFS"}, \
1088 { ALLOC_CHUNK, "ALLOC_CHUNK"}, \
1089 { ALLOC_CHUNK_FORCE, "ALLOC_CHUNK_FORCE"}, \
1090 { RUN_DELAYED_IPUTS, "RUN_DELAYED_IPUTS"}, \
1091 { COMMIT_TRANS, "COMMIT_TRANS"})
1093 TRACE_EVENT(btrfs_flush_space
,
1095 TP_PROTO(const struct btrfs_fs_info
*fs_info
, u64 flags
, u64 num_bytes
,
1096 int state
, int ret
),
1098 TP_ARGS(fs_info
, flags
, num_bytes
, state
, ret
),
1100 TP_STRUCT__entry_btrfs(
1101 __field( u64
, flags
)
1102 __field( u64
, num_bytes
)
1103 __field( int, state
)
1107 TP_fast_assign_btrfs(fs_info
,
1108 __entry
->flags
= flags
;
1109 __entry
->num_bytes
= num_bytes
;
1110 __entry
->state
= state
;
1114 TP_printk_btrfs("state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d",
1116 show_flush_state(__entry
->state
),
1118 __print_flags((unsigned long)__entry
->flags
, "|",
1120 __entry
->num_bytes
, __entry
->ret
)
1123 DECLARE_EVENT_CLASS(btrfs__reserved_extent
,
1125 TP_PROTO(const struct btrfs_fs_info
*fs_info
, u64 start
, u64 len
),
1127 TP_ARGS(fs_info
, start
, len
),
1129 TP_STRUCT__entry_btrfs(
1130 __field( u64
, start
)
1134 TP_fast_assign_btrfs(fs_info
,
1135 __entry
->start
= start
;
1139 TP_printk_btrfs("root=%llu(%s) start=%llu len=%llu",
1140 show_root_type(BTRFS_EXTENT_TREE_OBJECTID
),
1145 DEFINE_EVENT(btrfs__reserved_extent
, btrfs_reserved_extent_alloc
,
1147 TP_PROTO(const struct btrfs_fs_info
*fs_info
, u64 start
, u64 len
),
1149 TP_ARGS(fs_info
, start
, len
)
1152 DEFINE_EVENT(btrfs__reserved_extent
, btrfs_reserved_extent_free
,
1154 TP_PROTO(const struct btrfs_fs_info
*fs_info
, u64 start
, u64 len
),
1156 TP_ARGS(fs_info
, start
, len
)
1159 TRACE_EVENT(find_free_extent
,
1161 TP_PROTO(const struct btrfs_fs_info
*fs_info
, u64 num_bytes
,
1162 u64 empty_size
, u64 data
),
1164 TP_ARGS(fs_info
, num_bytes
, empty_size
, data
),
1166 TP_STRUCT__entry_btrfs(
1167 __field( u64
, num_bytes
)
1168 __field( u64
, empty_size
)
1169 __field( u64
, data
)
1172 TP_fast_assign_btrfs(fs_info
,
1173 __entry
->num_bytes
= num_bytes
;
1174 __entry
->empty_size
= empty_size
;
1175 __entry
->data
= data
;
1178 TP_printk_btrfs("root=%llu(%s) len=%llu empty_size=%llu flags=%llu(%s)",
1179 show_root_type(BTRFS_EXTENT_TREE_OBJECTID
),
1180 __entry
->num_bytes
, __entry
->empty_size
, __entry
->data
,
1181 __print_flags((unsigned long)__entry
->data
, "|",
1185 DECLARE_EVENT_CLASS(btrfs__reserve_extent
,
1187 TP_PROTO(const struct btrfs_block_group
*block_group
, u64 start
,
1190 TP_ARGS(block_group
, start
, len
),
1192 TP_STRUCT__entry_btrfs(
1193 __field( u64
, bg_objectid
)
1194 __field( u64
, flags
)
1195 __field( u64
, start
)
1199 TP_fast_assign_btrfs(block_group
->fs_info
,
1200 __entry
->bg_objectid
= block_group
->start
;
1201 __entry
->flags
= block_group
->flags
;
1202 __entry
->start
= start
;
1206 TP_printk_btrfs("root=%llu(%s) block_group=%llu flags=%llu(%s) "
1207 "start=%llu len=%llu",
1208 show_root_type(BTRFS_EXTENT_TREE_OBJECTID
),
1209 __entry
->bg_objectid
,
1210 __entry
->flags
, __print_flags((unsigned long)__entry
->flags
,
1211 "|", BTRFS_GROUP_FLAGS
),
1212 __entry
->start
, __entry
->len
)
1215 DEFINE_EVENT(btrfs__reserve_extent
, btrfs_reserve_extent
,
1217 TP_PROTO(const struct btrfs_block_group
*block_group
, u64 start
,
1220 TP_ARGS(block_group
, start
, len
)
1223 DEFINE_EVENT(btrfs__reserve_extent
, btrfs_reserve_extent_cluster
,
1225 TP_PROTO(const struct btrfs_block_group
*block_group
, u64 start
,
1228 TP_ARGS(block_group
, start
, len
)
1231 TRACE_EVENT(btrfs_find_cluster
,
1233 TP_PROTO(const struct btrfs_block_group
*block_group
, u64 start
,
1234 u64 bytes
, u64 empty_size
, u64 min_bytes
),
1236 TP_ARGS(block_group
, start
, bytes
, empty_size
, min_bytes
),
1238 TP_STRUCT__entry_btrfs(
1239 __field( u64
, bg_objectid
)
1240 __field( u64
, flags
)
1241 __field( u64
, start
)
1242 __field( u64
, bytes
)
1243 __field( u64
, empty_size
)
1244 __field( u64
, min_bytes
)
1247 TP_fast_assign_btrfs(block_group
->fs_info
,
1248 __entry
->bg_objectid
= block_group
->start
;
1249 __entry
->flags
= block_group
->flags
;
1250 __entry
->start
= start
;
1251 __entry
->bytes
= bytes
;
1252 __entry
->empty_size
= empty_size
;
1253 __entry
->min_bytes
= min_bytes
;
1256 TP_printk_btrfs("block_group=%llu flags=%llu(%s) start=%llu len=%llu "
1257 "empty_size=%llu min_bytes=%llu", __entry
->bg_objectid
,
1259 __print_flags((unsigned long)__entry
->flags
, "|",
1260 BTRFS_GROUP_FLAGS
), __entry
->start
,
1261 __entry
->bytes
, __entry
->empty_size
, __entry
->min_bytes
)
1264 TRACE_EVENT(btrfs_failed_cluster_setup
,
1266 TP_PROTO(const struct btrfs_block_group
*block_group
),
1268 TP_ARGS(block_group
),
1270 TP_STRUCT__entry_btrfs(
1271 __field( u64
, bg_objectid
)
1274 TP_fast_assign_btrfs(block_group
->fs_info
,
1275 __entry
->bg_objectid
= block_group
->start
;
1278 TP_printk_btrfs("block_group=%llu", __entry
->bg_objectid
)
1281 TRACE_EVENT(btrfs_setup_cluster
,
1283 TP_PROTO(const struct btrfs_block_group
*block_group
,
1284 const struct btrfs_free_cluster
*cluster
,
1285 u64 size
, int bitmap
),
1287 TP_ARGS(block_group
, cluster
, size
, bitmap
),
1289 TP_STRUCT__entry_btrfs(
1290 __field( u64
, bg_objectid
)
1291 __field( u64
, flags
)
1292 __field( u64
, start
)
1293 __field( u64
, max_size
)
1294 __field( u64
, size
)
1295 __field( int, bitmap
)
1298 TP_fast_assign_btrfs(block_group
->fs_info
,
1299 __entry
->bg_objectid
= block_group
->start
;
1300 __entry
->flags
= block_group
->flags
;
1301 __entry
->start
= cluster
->window_start
;
1302 __entry
->max_size
= cluster
->max_size
;
1303 __entry
->size
= size
;
1304 __entry
->bitmap
= bitmap
;
1307 TP_printk_btrfs("block_group=%llu flags=%llu(%s) window_start=%llu "
1308 "size=%llu max_size=%llu bitmap=%d",
1309 __entry
->bg_objectid
,
1311 __print_flags((unsigned long)__entry
->flags
, "|",
1312 BTRFS_GROUP_FLAGS
), __entry
->start
,
1313 __entry
->size
, __entry
->max_size
, __entry
->bitmap
)
1316 struct extent_state
;
1317 TRACE_EVENT(alloc_extent_state
,
1319 TP_PROTO(const struct extent_state
*state
,
1320 gfp_t mask
, unsigned long IP
),
1322 TP_ARGS(state
, mask
, IP
),
1325 __field(const struct extent_state
*, state
)
1326 __field(gfp_t
, mask
)
1327 __field(const void*, ip
)
1331 __entry
->state
= state
,
1332 __entry
->mask
= mask
,
1333 __entry
->ip
= (const void *)IP
1336 TP_printk("state=%p mask=%s caller=%pS", __entry
->state
,
1337 show_gfp_flags(__entry
->mask
), __entry
->ip
)
1340 TRACE_EVENT(free_extent_state
,
1342 TP_PROTO(const struct extent_state
*state
, unsigned long IP
),
1347 __field(const struct extent_state
*, state
)
1348 __field(const void*, ip
)
1352 __entry
->state
= state
,
1353 __entry
->ip
= (const void *)IP
1356 TP_printk("state=%p caller=%pS", __entry
->state
, __entry
->ip
)
1359 DECLARE_EVENT_CLASS(btrfs__work
,
1361 TP_PROTO(const struct btrfs_work
*work
),
1365 TP_STRUCT__entry_btrfs(
1366 __field( const void *, work
)
1367 __field( const void *, wq
)
1368 __field( const void *, func
)
1369 __field( const void *, ordered_func
)
1370 __field( const void *, ordered_free
)
1371 __field( const void *, normal_work
)
1374 TP_fast_assign_btrfs(btrfs_work_owner(work
),
1375 __entry
->work
= work
;
1376 __entry
->wq
= work
->wq
;
1377 __entry
->func
= work
->func
;
1378 __entry
->ordered_func
= work
->ordered_func
;
1379 __entry
->ordered_free
= work
->ordered_free
;
1380 __entry
->normal_work
= &work
->normal_work
;
1383 TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%ps ordered_func=%p "
1385 __entry
->work
, __entry
->normal_work
, __entry
->wq
,
1386 __entry
->func
, __entry
->ordered_func
, __entry
->ordered_free
)
1390 * For situations when the work is freed, we pass fs_info and a tag that matches
1391 * the address of the work structure so it can be paired with the scheduling
1392 * event. DO NOT add anything here that dereferences wtag.
1394 DECLARE_EVENT_CLASS(btrfs__work__done
,
1396 TP_PROTO(const struct btrfs_fs_info
*fs_info
, const void *wtag
),
1398 TP_ARGS(fs_info
, wtag
),
1400 TP_STRUCT__entry_btrfs(
1401 __field( const void *, wtag
)
1404 TP_fast_assign_btrfs(fs_info
,
1405 __entry
->wtag
= wtag
;
1408 TP_printk_btrfs("work->%p", __entry
->wtag
)
1411 DEFINE_EVENT(btrfs__work
, btrfs_work_queued
,
1413 TP_PROTO(const struct btrfs_work
*work
),
1418 DEFINE_EVENT(btrfs__work
, btrfs_work_sched
,
1420 TP_PROTO(const struct btrfs_work
*work
),
1425 DEFINE_EVENT(btrfs__work__done
, btrfs_all_work_done
,
1427 TP_PROTO(const struct btrfs_fs_info
*fs_info
, const void *wtag
),
1429 TP_ARGS(fs_info
, wtag
)
1432 DEFINE_EVENT(btrfs__work
, btrfs_ordered_sched
,
1434 TP_PROTO(const struct btrfs_work
*work
),
1439 DECLARE_EVENT_CLASS(btrfs__workqueue
,
1441 TP_PROTO(const struct __btrfs_workqueue
*wq
,
1442 const char *name
, int high
),
1444 TP_ARGS(wq
, name
, high
),
1446 TP_STRUCT__entry_btrfs(
1447 __field( const void *, wq
)
1448 __string( name
, name
)
1449 __field( int , high
)
1452 TP_fast_assign_btrfs(btrfs_workqueue_owner(wq
),
1454 __assign_str(name
, name
);
1455 __entry
->high
= high
;
1458 TP_printk_btrfs("name=%s%s wq=%p", __get_str(name
),
1459 __print_flags(__entry
->high
, "",
1460 {(WQ_HIGHPRI
), "-high"}),
1464 DEFINE_EVENT(btrfs__workqueue
, btrfs_workqueue_alloc
,
1466 TP_PROTO(const struct __btrfs_workqueue
*wq
,
1467 const char *name
, int high
),
1469 TP_ARGS(wq
, name
, high
)
1472 DECLARE_EVENT_CLASS(btrfs__workqueue_done
,
1474 TP_PROTO(const struct __btrfs_workqueue
*wq
),
1478 TP_STRUCT__entry_btrfs(
1479 __field( const void *, wq
)
1482 TP_fast_assign_btrfs(btrfs_workqueue_owner(wq
),
1486 TP_printk_btrfs("wq=%p", __entry
->wq
)
1489 DEFINE_EVENT(btrfs__workqueue_done
, btrfs_workqueue_destroy
,
1491 TP_PROTO(const struct __btrfs_workqueue
*wq
),
1496 #define BTRFS_QGROUP_OPERATIONS \
1497 { QGROUP_RESERVE, "reserve" }, \
1498 { QGROUP_RELEASE, "release" }, \
1499 { QGROUP_FREE, "free" }
1501 DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data
,
1503 TP_PROTO(const struct inode
*inode
, u64 start
, u64 len
,
1504 u64 reserved
, int op
),
1506 TP_ARGS(inode
, start
, len
, reserved
, op
),
1508 TP_STRUCT__entry_btrfs(
1509 __field( u64
, rootid
)
1511 __field( u64
, start
)
1513 __field( u64
, reserved
)
1517 TP_fast_assign_btrfs(btrfs_sb(inode
->i_sb
),
1519 BTRFS_I(inode
)->root
->root_key
.objectid
;
1520 __entry
->ino
= btrfs_ino(BTRFS_I(inode
));
1521 __entry
->start
= start
;
1523 __entry
->reserved
= reserved
;
1527 TP_printk_btrfs("root=%llu ino=%llu start=%llu len=%llu reserved=%llu op=%s",
1528 __entry
->rootid
, __entry
->ino
, __entry
->start
, __entry
->len
,
1530 __print_flags((unsigned long)__entry
->op
, "",
1531 BTRFS_QGROUP_OPERATIONS
)
1535 DEFINE_EVENT(btrfs__qgroup_rsv_data
, btrfs_qgroup_reserve_data
,
1537 TP_PROTO(const struct inode
*inode
, u64 start
, u64 len
,
1538 u64 reserved
, int op
),
1540 TP_ARGS(inode
, start
, len
, reserved
, op
)
1543 DEFINE_EVENT(btrfs__qgroup_rsv_data
, btrfs_qgroup_release_data
,
1545 TP_PROTO(const struct inode
*inode
, u64 start
, u64 len
,
1546 u64 reserved
, int op
),
1548 TP_ARGS(inode
, start
, len
, reserved
, op
)
1551 DECLARE_EVENT_CLASS(btrfs_qgroup_extent
,
1552 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
1553 const struct btrfs_qgroup_extent_record
*rec
),
1555 TP_ARGS(fs_info
, rec
),
1557 TP_STRUCT__entry_btrfs(
1558 __field( u64
, bytenr
)
1559 __field( u64
, num_bytes
)
1562 TP_fast_assign_btrfs(fs_info
,
1563 __entry
->bytenr
= rec
->bytenr
,
1564 __entry
->num_bytes
= rec
->num_bytes
;
1567 TP_printk_btrfs("bytenr=%llu num_bytes=%llu",
1568 __entry
->bytenr
, __entry
->num_bytes
)
1571 DEFINE_EVENT(btrfs_qgroup_extent
, btrfs_qgroup_account_extents
,
1573 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
1574 const struct btrfs_qgroup_extent_record
*rec
),
1576 TP_ARGS(fs_info
, rec
)
1579 DEFINE_EVENT(btrfs_qgroup_extent
, btrfs_qgroup_trace_extent
,
1581 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
1582 const struct btrfs_qgroup_extent_record
*rec
),
1584 TP_ARGS(fs_info
, rec
)
1587 TRACE_EVENT(qgroup_num_dirty_extents
,
1589 TP_PROTO(const struct btrfs_fs_info
*fs_info
, u64 transid
,
1590 u64 num_dirty_extents
),
1592 TP_ARGS(fs_info
, transid
, num_dirty_extents
),
1594 TP_STRUCT__entry_btrfs(
1595 __field( u64
, transid
)
1596 __field( u64
, num_dirty_extents
)
1599 TP_fast_assign_btrfs(fs_info
,
1600 __entry
->transid
= transid
;
1601 __entry
->num_dirty_extents
= num_dirty_extents
;
1604 TP_printk_btrfs("transid=%llu num_dirty_extents=%llu",
1605 __entry
->transid
, __entry
->num_dirty_extents
)
1608 TRACE_EVENT(btrfs_qgroup_account_extent
,
1610 TP_PROTO(const struct btrfs_fs_info
*fs_info
, u64 transid
, u64 bytenr
,
1611 u64 num_bytes
, u64 nr_old_roots
, u64 nr_new_roots
),
1613 TP_ARGS(fs_info
, transid
, bytenr
, num_bytes
, nr_old_roots
,
1616 TP_STRUCT__entry_btrfs(
1617 __field( u64
, transid
)
1618 __field( u64
, bytenr
)
1619 __field( u64
, num_bytes
)
1620 __field( u64
, nr_old_roots
)
1621 __field( u64
, nr_new_roots
)
1624 TP_fast_assign_btrfs(fs_info
,
1625 __entry
->transid
= transid
;
1626 __entry
->bytenr
= bytenr
;
1627 __entry
->num_bytes
= num_bytes
;
1628 __entry
->nr_old_roots
= nr_old_roots
;
1629 __entry
->nr_new_roots
= nr_new_roots
;
1633 "transid=%llu bytenr=%llu num_bytes=%llu nr_old_roots=%llu nr_new_roots=%llu",
1637 __entry
->nr_old_roots
,
1638 __entry
->nr_new_roots
)
1641 TRACE_EVENT(qgroup_update_counters
,
1643 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
1644 const struct btrfs_qgroup
*qgroup
,
1645 u64 cur_old_count
, u64 cur_new_count
),
1647 TP_ARGS(fs_info
, qgroup
, cur_old_count
, cur_new_count
),
1649 TP_STRUCT__entry_btrfs(
1650 __field( u64
, qgid
)
1651 __field( u64
, old_rfer
)
1652 __field( u64
, old_excl
)
1653 __field( u64
, cur_old_count
)
1654 __field( u64
, cur_new_count
)
1657 TP_fast_assign_btrfs(fs_info
,
1658 __entry
->qgid
= qgroup
->qgroupid
;
1659 __entry
->old_rfer
= qgroup
->rfer
;
1660 __entry
->old_excl
= qgroup
->excl
;
1661 __entry
->cur_old_count
= cur_old_count
;
1662 __entry
->cur_new_count
= cur_new_count
;
1665 TP_printk_btrfs("qgid=%llu old_rfer=%llu old_excl=%llu cur_old_count=%llu cur_new_count=%llu",
1666 __entry
->qgid
, __entry
->old_rfer
, __entry
->old_excl
,
1667 __entry
->cur_old_count
, __entry
->cur_new_count
)
1670 TRACE_EVENT(qgroup_update_reserve
,
1672 TP_PROTO(struct btrfs_fs_info
*fs_info
, struct btrfs_qgroup
*qgroup
,
1673 s64 diff
, int type
),
1675 TP_ARGS(fs_info
, qgroup
, diff
, type
),
1677 TP_STRUCT__entry_btrfs(
1678 __field( u64
, qgid
)
1679 __field( u64
, cur_reserved
)
1680 __field( s64
, diff
)
1681 __field( int, type
)
1684 TP_fast_assign_btrfs(fs_info
,
1685 __entry
->qgid
= qgroup
->qgroupid
;
1686 __entry
->cur_reserved
= qgroup
->rsv
.values
[type
];
1687 __entry
->diff
= diff
;
1688 __entry
->type
= type
;
1691 TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld",
1692 __entry
->qgid
, show_qgroup_rsv_type(__entry
->type
),
1693 __entry
->cur_reserved
, __entry
->diff
)
1696 TRACE_EVENT(qgroup_meta_reserve
,
1698 TP_PROTO(struct btrfs_root
*root
, s64 diff
, int type
),
1700 TP_ARGS(root
, diff
, type
),
1702 TP_STRUCT__entry_btrfs(
1703 __field( u64
, refroot
)
1704 __field( s64
, diff
)
1705 __field( int, type
)
1708 TP_fast_assign_btrfs(root
->fs_info
,
1709 __entry
->refroot
= root
->root_key
.objectid
;
1710 __entry
->diff
= diff
;
1711 __entry
->type
= type
;
1714 TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld",
1715 show_root_type(__entry
->refroot
),
1716 show_qgroup_rsv_type(__entry
->type
), __entry
->diff
)
1719 TRACE_EVENT(qgroup_meta_convert
,
1721 TP_PROTO(struct btrfs_root
*root
, s64 diff
),
1723 TP_ARGS(root
, diff
),
1725 TP_STRUCT__entry_btrfs(
1726 __field( u64
, refroot
)
1727 __field( s64
, diff
)
1730 TP_fast_assign_btrfs(root
->fs_info
,
1731 __entry
->refroot
= root
->root_key
.objectid
;
1732 __entry
->diff
= diff
;
1735 TP_printk_btrfs("refroot=%llu(%s) type=%s->%s diff=%lld",
1736 show_root_type(__entry
->refroot
),
1737 show_qgroup_rsv_type(BTRFS_QGROUP_RSV_META_PREALLOC
),
1738 show_qgroup_rsv_type(BTRFS_QGROUP_RSV_META_PERTRANS
),
1742 TRACE_EVENT(qgroup_meta_free_all_pertrans
,
1744 TP_PROTO(struct btrfs_root
*root
),
1748 TP_STRUCT__entry_btrfs(
1749 __field( u64
, refroot
)
1750 __field( s64
, diff
)
1751 __field( int, type
)
1754 TP_fast_assign_btrfs(root
->fs_info
,
1755 __entry
->refroot
= root
->root_key
.objectid
;
1756 spin_lock(&root
->qgroup_meta_rsv_lock
);
1757 __entry
->diff
= -(s64
)root
->qgroup_meta_rsv_pertrans
;
1758 spin_unlock(&root
->qgroup_meta_rsv_lock
);
1759 __entry
->type
= BTRFS_QGROUP_RSV_META_PERTRANS
;
1762 TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld",
1763 show_root_type(__entry
->refroot
),
1764 show_qgroup_rsv_type(__entry
->type
), __entry
->diff
)
1767 DECLARE_EVENT_CLASS(btrfs__prelim_ref
,
1768 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
1769 const struct prelim_ref
*oldref
,
1770 const struct prelim_ref
*newref
, u64 tree_size
),
1771 TP_ARGS(fs_info
, newref
, oldref
, tree_size
),
1773 TP_STRUCT__entry_btrfs(
1774 __field( u64
, root_id
)
1775 __field( u64
, objectid
)
1777 __field( u64
, offset
)
1778 __field( int, level
)
1779 __field( int, old_count
)
1780 __field( u64
, parent
)
1781 __field( u64
, bytenr
)
1782 __field( int, mod_count
)
1783 __field( u64
, tree_size
)
1786 TP_fast_assign_btrfs(fs_info
,
1787 __entry
->root_id
= oldref
->root_id
;
1788 __entry
->objectid
= oldref
->key_for_search
.objectid
;
1789 __entry
->type
= oldref
->key_for_search
.type
;
1790 __entry
->offset
= oldref
->key_for_search
.offset
;
1791 __entry
->level
= oldref
->level
;
1792 __entry
->old_count
= oldref
->count
;
1793 __entry
->parent
= oldref
->parent
;
1794 __entry
->bytenr
= oldref
->wanted_disk_byte
;
1795 __entry
->mod_count
= newref
? newref
->count
: 0;
1796 __entry
->tree_size
= tree_size
;
1799 TP_printk_btrfs("root_id=%llu key=[%llu,%u,%llu] level=%d count=[%d+%d=%d] parent=%llu wanted_disk_byte=%llu nodes=%llu",
1801 __entry
->objectid
, __entry
->type
,
1802 __entry
->offset
, __entry
->level
,
1803 __entry
->old_count
, __entry
->mod_count
,
1804 __entry
->old_count
+ __entry
->mod_count
,
1810 DEFINE_EVENT(btrfs__prelim_ref
, btrfs_prelim_ref_merge
,
1811 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
1812 const struct prelim_ref
*oldref
,
1813 const struct prelim_ref
*newref
, u64 tree_size
),
1814 TP_ARGS(fs_info
, oldref
, newref
, tree_size
)
1817 DEFINE_EVENT(btrfs__prelim_ref
, btrfs_prelim_ref_insert
,
1818 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
1819 const struct prelim_ref
*oldref
,
1820 const struct prelim_ref
*newref
, u64 tree_size
),
1821 TP_ARGS(fs_info
, oldref
, newref
, tree_size
)
1824 TRACE_EVENT(btrfs_inode_mod_outstanding_extents
,
1825 TP_PROTO(const struct btrfs_root
*root
, u64 ino
, int mod
),
1827 TP_ARGS(root
, ino
, mod
),
1829 TP_STRUCT__entry_btrfs(
1830 __field( u64
, root_objectid
)
1835 TP_fast_assign_btrfs(root
->fs_info
,
1836 __entry
->root_objectid
= root
->root_key
.objectid
;
1841 TP_printk_btrfs("root=%llu(%s) ino=%llu mod=%d",
1842 show_root_type(__entry
->root_objectid
),
1843 __entry
->ino
, __entry
->mod
)
1846 DECLARE_EVENT_CLASS(btrfs__block_group
,
1847 TP_PROTO(const struct btrfs_block_group
*bg_cache
),
1851 TP_STRUCT__entry_btrfs(
1852 __field( u64
, bytenr
)
1854 __field( u64
, used
)
1855 __field( u64
, flags
)
1858 TP_fast_assign_btrfs(bg_cache
->fs_info
,
1859 __entry
->bytenr
= bg_cache
->start
,
1860 __entry
->len
= bg_cache
->length
,
1861 __entry
->used
= bg_cache
->used
;
1862 __entry
->flags
= bg_cache
->flags
;
1865 TP_printk_btrfs("bg bytenr=%llu len=%llu used=%llu flags=%llu(%s)",
1866 __entry
->bytenr
, __entry
->len
, __entry
->used
, __entry
->flags
,
1867 __print_flags(__entry
->flags
, "|", BTRFS_GROUP_FLAGS
))
1870 DEFINE_EVENT(btrfs__block_group
, btrfs_remove_block_group
,
1871 TP_PROTO(const struct btrfs_block_group
*bg_cache
),
1876 DEFINE_EVENT(btrfs__block_group
, btrfs_add_unused_block_group
,
1877 TP_PROTO(const struct btrfs_block_group
*bg_cache
),
1882 DEFINE_EVENT(btrfs__block_group
, btrfs_skip_unused_block_group
,
1883 TP_PROTO(const struct btrfs_block_group
*bg_cache
),
1888 TRACE_EVENT(btrfs_set_extent_bit
,
1889 TP_PROTO(const struct extent_io_tree
*tree
,
1890 u64 start
, u64 len
, unsigned set_bits
),
1892 TP_ARGS(tree
, start
, len
, set_bits
),
1894 TP_STRUCT__entry_btrfs(
1895 __field( unsigned, owner
)
1897 __field( u64
, rootid
)
1898 __field( u64
, start
)
1900 __field( unsigned, set_bits
)
1903 TP_fast_assign_btrfs(tree
->fs_info
,
1904 __entry
->owner
= tree
->owner
;
1905 if (tree
->private_data
) {
1906 const struct inode
*inode
= tree
->private_data
;
1908 __entry
->ino
= btrfs_ino(BTRFS_I(inode
));
1910 BTRFS_I(inode
)->root
->root_key
.objectid
;
1913 __entry
->rootid
= 0;
1915 __entry
->start
= start
;
1917 __entry
->set_bits
= set_bits
;
1921 "io_tree=%s ino=%llu root=%llu start=%llu len=%llu set_bits=%s",
1922 show_extent_io_tree_owner(__entry
->owner
), __entry
->ino
,
1923 __entry
->rootid
, __entry
->start
, __entry
->len
,
1924 __print_flags(__entry
->set_bits
, "|", EXTENT_FLAGS
))
1927 TRACE_EVENT(btrfs_clear_extent_bit
,
1928 TP_PROTO(const struct extent_io_tree
*tree
,
1929 u64 start
, u64 len
, unsigned clear_bits
),
1931 TP_ARGS(tree
, start
, len
, clear_bits
),
1933 TP_STRUCT__entry_btrfs(
1934 __field( unsigned, owner
)
1936 __field( u64
, rootid
)
1937 __field( u64
, start
)
1939 __field( unsigned, clear_bits
)
1942 TP_fast_assign_btrfs(tree
->fs_info
,
1943 __entry
->owner
= tree
->owner
;
1944 if (tree
->private_data
) {
1945 const struct inode
*inode
= tree
->private_data
;
1947 __entry
->ino
= btrfs_ino(BTRFS_I(inode
));
1949 BTRFS_I(inode
)->root
->root_key
.objectid
;
1952 __entry
->rootid
= 0;
1954 __entry
->start
= start
;
1956 __entry
->clear_bits
= clear_bits
;
1960 "io_tree=%s ino=%llu root=%llu start=%llu len=%llu clear_bits=%s",
1961 show_extent_io_tree_owner(__entry
->owner
), __entry
->ino
,
1962 __entry
->rootid
, __entry
->start
, __entry
->len
,
1963 __print_flags(__entry
->clear_bits
, "|", EXTENT_FLAGS
))
1966 TRACE_EVENT(btrfs_convert_extent_bit
,
1967 TP_PROTO(const struct extent_io_tree
*tree
,
1968 u64 start
, u64 len
, unsigned set_bits
, unsigned clear_bits
),
1970 TP_ARGS(tree
, start
, len
, set_bits
, clear_bits
),
1972 TP_STRUCT__entry_btrfs(
1973 __field( unsigned, owner
)
1975 __field( u64
, rootid
)
1976 __field( u64
, start
)
1978 __field( unsigned, set_bits
)
1979 __field( unsigned, clear_bits
)
1982 TP_fast_assign_btrfs(tree
->fs_info
,
1983 __entry
->owner
= tree
->owner
;
1984 if (tree
->private_data
) {
1985 const struct inode
*inode
= tree
->private_data
;
1987 __entry
->ino
= btrfs_ino(BTRFS_I(inode
));
1989 BTRFS_I(inode
)->root
->root_key
.objectid
;
1992 __entry
->rootid
= 0;
1994 __entry
->start
= start
;
1996 __entry
->set_bits
= set_bits
;
1997 __entry
->clear_bits
= clear_bits
;
2001 "io_tree=%s ino=%llu root=%llu start=%llu len=%llu set_bits=%s clear_bits=%s",
2002 show_extent_io_tree_owner(__entry
->owner
), __entry
->ino
,
2003 __entry
->rootid
, __entry
->start
, __entry
->len
,
2004 __print_flags(__entry
->set_bits
, "|", EXTENT_FLAGS
),
2005 __print_flags(__entry
->clear_bits
, "|", EXTENT_FLAGS
))
2008 DECLARE_EVENT_CLASS(btrfs_sleep_tree_lock
,
2009 TP_PROTO(const struct extent_buffer
*eb
, u64 start_ns
),
2011 TP_ARGS(eb
, start_ns
),
2013 TP_STRUCT__entry_btrfs(
2014 __field( u64
, block
)
2015 __field( u64
, generation
)
2016 __field( u64
, start_ns
)
2017 __field( u64
, end_ns
)
2018 __field( u64
, diff_ns
)
2019 __field( u64
, owner
)
2020 __field( int, is_log_tree
)
2023 TP_fast_assign_btrfs(eb
->fs_info
,
2024 __entry
->block
= eb
->start
;
2025 __entry
->generation
= btrfs_header_generation(eb
);
2026 __entry
->start_ns
= start_ns
;
2027 __entry
->end_ns
= ktime_get_ns();
2028 __entry
->diff_ns
= __entry
->end_ns
- start_ns
;
2029 __entry
->owner
= btrfs_header_owner(eb
);
2030 __entry
->is_log_tree
= (eb
->log_index
>= 0);
2034 "block=%llu generation=%llu start_ns=%llu end_ns=%llu diff_ns=%llu owner=%llu is_log_tree=%d",
2035 __entry
->block
, __entry
->generation
,
2036 __entry
->start_ns
, __entry
->end_ns
, __entry
->diff_ns
,
2037 __entry
->owner
, __entry
->is_log_tree
)
2040 DEFINE_EVENT(btrfs_sleep_tree_lock
, btrfs_tree_read_lock
,
2041 TP_PROTO(const struct extent_buffer
*eb
, u64 start_ns
),
2043 TP_ARGS(eb
, start_ns
)
2046 DEFINE_EVENT(btrfs_sleep_tree_lock
, btrfs_tree_lock
,
2047 TP_PROTO(const struct extent_buffer
*eb
, u64 start_ns
),
2049 TP_ARGS(eb
, start_ns
)
2052 DECLARE_EVENT_CLASS(btrfs_locking_events
,
2053 TP_PROTO(const struct extent_buffer
*eb
),
2057 TP_STRUCT__entry_btrfs(
2058 __field( u64
, block
)
2059 __field( u64
, generation
)
2060 __field( u64
, owner
)
2061 __field( int, is_log_tree
)
2064 TP_fast_assign_btrfs(eb
->fs_info
,
2065 __entry
->block
= eb
->start
;
2066 __entry
->generation
= btrfs_header_generation(eb
);
2067 __entry
->owner
= btrfs_header_owner(eb
);
2068 __entry
->is_log_tree
= (eb
->log_index
>= 0);
2071 TP_printk_btrfs("block=%llu generation=%llu owner=%llu is_log_tree=%d",
2072 __entry
->block
, __entry
->generation
,
2073 __entry
->owner
, __entry
->is_log_tree
)
2076 #define DEFINE_BTRFS_LOCK_EVENT(name) \
2077 DEFINE_EVENT(btrfs_locking_events, name, \
2078 TP_PROTO(const struct extent_buffer *eb), \
2083 DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_unlock
);
2084 DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock
);
2085 DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock_blocking
);
2086 DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_read
);
2087 DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_write
);
2088 DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_read_lock
);
2089 DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_write_lock
);
2090 DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_lock_atomic
);
2092 DECLARE_EVENT_CLASS(btrfs__space_info_update
,
2094 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
2095 const struct btrfs_space_info
*sinfo
, u64 old
, s64 diff
),
2097 TP_ARGS(fs_info
, sinfo
, old
, diff
),
2099 TP_STRUCT__entry_btrfs(
2100 __field( u64
, type
)
2102 __field( s64
, diff
)
2105 TP_fast_assign_btrfs(fs_info
,
2106 __entry
->type
= sinfo
->flags
;
2108 __entry
->diff
= diff
;
2110 TP_printk_btrfs("type=%s old=%llu diff=%lld",
2111 __print_flags(__entry
->type
, "|", BTRFS_GROUP_FLAGS
),
2112 __entry
->old
, __entry
->diff
)
2115 DEFINE_EVENT(btrfs__space_info_update
, update_bytes_may_use
,
2117 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
2118 const struct btrfs_space_info
*sinfo
, u64 old
, s64 diff
),
2120 TP_ARGS(fs_info
, sinfo
, old
, diff
)
2123 DEFINE_EVENT(btrfs__space_info_update
, update_bytes_pinned
,
2125 TP_PROTO(const struct btrfs_fs_info
*fs_info
,
2126 const struct btrfs_space_info
*sinfo
, u64 old
, s64 diff
),
2128 TP_ARGS(fs_info
, sinfo
, old
, diff
)
2131 #endif /* _TRACE_BTRFS_H */
2133 /* This part must be outside protection */
2134 #include <trace/define_trace.h>