2 #define TRACE_SYSTEM btrfs
4 #if !defined(_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ)
7 #include <linux/writeback.h>
8 #include <linux/tracepoint.h>
9 #include <trace/events/mmflags.h>
15 struct btrfs_ordered_extent
;
16 struct btrfs_delayed_ref_node
;
17 struct btrfs_delayed_tree_ref
;
18 struct btrfs_delayed_data_ref
;
19 struct btrfs_delayed_ref_head
;
20 struct btrfs_block_group_cache
;
21 struct btrfs_free_cluster
;
25 struct __btrfs_workqueue
;
26 struct btrfs_qgroup_extent_record
;
28 #define show_ref_type(type) \
29 __print_symbolic(type, \
30 { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \
31 { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \
32 { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \
33 { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \
34 { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" })
36 #define __show_root_type(obj) \
37 __print_symbolic_u64(obj, \
38 { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \
39 { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \
40 { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \
41 { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \
42 { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \
43 { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \
44 { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \
45 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \
46 { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \
47 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \
48 { BTRFS_UUID_TREE_OBJECTID, "UUID_TREE" }, \
49 { BTRFS_FREE_SPACE_TREE_OBJECTID, "FREE_SPACE_TREE" }, \
50 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
52 #define show_root_type(obj) \
53 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
54 (obj >= BTRFS_ROOT_TREE_OBJECTID && \
55 obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
57 #define BTRFS_GROUP_FLAGS \
58 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \
59 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
60 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
61 { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \
62 { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \
63 { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \
64 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
65 { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \
66 { BTRFS_BLOCK_GROUP_RAID6, "RAID6"}
68 #define BTRFS_UUID_SIZE 16
70 TRACE_EVENT(btrfs_transaction_commit
,
72 TP_PROTO(struct btrfs_root
*root
),
77 __field( u64
, generation
)
78 __field( u64
, root_objectid
)
82 __entry
->generation
= root
->fs_info
->generation
;
83 __entry
->root_objectid
= root
->root_key
.objectid
;
86 TP_printk("root = %llu(%s), gen = %llu",
87 show_root_type(__entry
->root_objectid
),
88 (unsigned long long)__entry
->generation
)
91 DECLARE_EVENT_CLASS(btrfs__inode
,
93 TP_PROTO(struct inode
*inode
),
99 __field( blkcnt_t
, blocks
)
100 __field( u64
, disk_i_size
)
101 __field( u64
, generation
)
102 __field( u64
, last_trans
)
103 __field( u64
, logged_trans
)
104 __field( u64
, root_objectid
)
108 __entry
->ino
= inode
->i_ino
;
109 __entry
->blocks
= inode
->i_blocks
;
110 __entry
->disk_i_size
= BTRFS_I(inode
)->disk_i_size
;
111 __entry
->generation
= BTRFS_I(inode
)->generation
;
112 __entry
->last_trans
= BTRFS_I(inode
)->last_trans
;
113 __entry
->logged_trans
= BTRFS_I(inode
)->logged_trans
;
114 __entry
->root_objectid
=
115 BTRFS_I(inode
)->root
->root_key
.objectid
;
118 TP_printk("root = %llu(%s), gen = %llu, ino = %lu, blocks = %llu, "
119 "disk_i_size = %llu, last_trans = %llu, logged_trans = %llu",
120 show_root_type(__entry
->root_objectid
),
121 (unsigned long long)__entry
->generation
,
122 (unsigned long)__entry
->ino
,
123 (unsigned long long)__entry
->blocks
,
124 (unsigned long long)__entry
->disk_i_size
,
125 (unsigned long long)__entry
->last_trans
,
126 (unsigned long long)__entry
->logged_trans
)
129 DEFINE_EVENT(btrfs__inode
, btrfs_inode_new
,
131 TP_PROTO(struct inode
*inode
),
136 DEFINE_EVENT(btrfs__inode
, btrfs_inode_request
,
138 TP_PROTO(struct inode
*inode
),
143 DEFINE_EVENT(btrfs__inode
, btrfs_inode_evict
,
145 TP_PROTO(struct inode
*inode
),
150 #define __show_map_type(type) \
151 __print_symbolic_u64(type, \
152 { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \
153 { EXTENT_MAP_HOLE, "HOLE" }, \
154 { EXTENT_MAP_INLINE, "INLINE" }, \
155 { EXTENT_MAP_DELALLOC, "DELALLOC" })
157 #define show_map_type(type) \
158 type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type)
160 #define show_map_flags(flag) \
161 __print_flags(flag, "|", \
162 { (1 << EXTENT_FLAG_PINNED), "PINNED" },\
163 { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\
164 { (1 << EXTENT_FLAG_VACANCY), "VACANCY" },\
165 { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\
166 { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\
167 { (1 << EXTENT_FLAG_FILLING), "FILLING" },\
168 { (1 << EXTENT_FLAG_FS_MAPPING), "FS_MAPPING" })
170 TRACE_EVENT_CONDITION(btrfs_get_extent
,
172 TP_PROTO(struct btrfs_root
*root
, struct extent_map
*map
),
179 __field( u64
, root_objectid
)
180 __field( u64
, start
)
182 __field( u64
, orig_start
)
183 __field( u64
, block_start
)
184 __field( u64
, block_len
)
185 __field( unsigned long, flags
)
187 __field( unsigned int, compress_type
)
191 __entry
->root_objectid
= root
->root_key
.objectid
;
192 __entry
->start
= map
->start
;
193 __entry
->len
= map
->len
;
194 __entry
->orig_start
= map
->orig_start
;
195 __entry
->block_start
= map
->block_start
;
196 __entry
->block_len
= map
->block_len
;
197 __entry
->flags
= map
->flags
;
198 __entry
->refs
= atomic_read(&map
->refs
);
199 __entry
->compress_type
= map
->compress_type
;
202 TP_printk("root = %llu(%s), start = %llu, len = %llu, "
203 "orig_start = %llu, block_start = %llu(%s), "
204 "block_len = %llu, flags = %s, refs = %u, "
205 "compress_type = %u",
206 show_root_type(__entry
->root_objectid
),
207 (unsigned long long)__entry
->start
,
208 (unsigned long long)__entry
->len
,
209 (unsigned long long)__entry
->orig_start
,
210 show_map_type(__entry
->block_start
),
211 (unsigned long long)__entry
->block_len
,
212 show_map_flags(__entry
->flags
),
213 __entry
->refs
, __entry
->compress_type
)
216 #define show_ordered_flags(flags) \
217 __print_flags(flags, "|", \
218 { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \
219 { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \
220 { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \
221 { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \
222 { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \
223 { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \
224 { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \
225 { (1 << BTRFS_ORDERED_UPDATED_ISIZE), "UPDATED_ISIZE" }, \
226 { (1 << BTRFS_ORDERED_LOGGED_CSUM), "LOGGED_CSUM" }, \
227 { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" })
230 DECLARE_EVENT_CLASS(btrfs__ordered_extent
,
232 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
234 TP_ARGS(inode
, ordered
),
237 __field( ino_t
, ino
)
238 __field( u64
, file_offset
)
239 __field( u64
, start
)
241 __field( u64
, disk_len
)
242 __field( u64
, bytes_left
)
243 __field( unsigned long, flags
)
244 __field( int, compress_type
)
246 __field( u64
, root_objectid
)
250 __entry
->ino
= inode
->i_ino
;
251 __entry
->file_offset
= ordered
->file_offset
;
252 __entry
->start
= ordered
->start
;
253 __entry
->len
= ordered
->len
;
254 __entry
->disk_len
= ordered
->disk_len
;
255 __entry
->bytes_left
= ordered
->bytes_left
;
256 __entry
->flags
= ordered
->flags
;
257 __entry
->compress_type
= ordered
->compress_type
;
258 __entry
->refs
= atomic_read(&ordered
->refs
);
259 __entry
->root_objectid
=
260 BTRFS_I(inode
)->root
->root_key
.objectid
;
263 TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, "
264 "start = %llu, len = %llu, disk_len = %llu, "
265 "bytes_left = %llu, flags = %s, compress_type = %d, "
267 show_root_type(__entry
->root_objectid
),
268 (unsigned long long)__entry
->ino
,
269 (unsigned long long)__entry
->file_offset
,
270 (unsigned long long)__entry
->start
,
271 (unsigned long long)__entry
->len
,
272 (unsigned long long)__entry
->disk_len
,
273 (unsigned long long)__entry
->bytes_left
,
274 show_ordered_flags(__entry
->flags
),
275 __entry
->compress_type
, __entry
->refs
)
278 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_add
,
280 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
282 TP_ARGS(inode
, ordered
)
285 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_remove
,
287 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
289 TP_ARGS(inode
, ordered
)
292 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_start
,
294 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
296 TP_ARGS(inode
, ordered
)
299 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_put
,
301 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
303 TP_ARGS(inode
, ordered
)
306 DECLARE_EVENT_CLASS(btrfs__writepage
,
308 TP_PROTO(struct page
*page
, struct inode
*inode
,
309 struct writeback_control
*wbc
),
311 TP_ARGS(page
, inode
, wbc
),
314 __field( ino_t
, ino
)
315 __field( pgoff_t
, index
)
316 __field( long, nr_to_write
)
317 __field( long, pages_skipped
)
318 __field( loff_t
, range_start
)
319 __field( loff_t
, range_end
)
320 __field( char, for_kupdate
)
321 __field( char, for_reclaim
)
322 __field( char, range_cyclic
)
323 __field( pgoff_t
, writeback_index
)
324 __field( u64
, root_objectid
)
328 __entry
->ino
= inode
->i_ino
;
329 __entry
->index
= page
->index
;
330 __entry
->nr_to_write
= wbc
->nr_to_write
;
331 __entry
->pages_skipped
= wbc
->pages_skipped
;
332 __entry
->range_start
= wbc
->range_start
;
333 __entry
->range_end
= wbc
->range_end
;
334 __entry
->for_kupdate
= wbc
->for_kupdate
;
335 __entry
->for_reclaim
= wbc
->for_reclaim
;
336 __entry
->range_cyclic
= wbc
->range_cyclic
;
337 __entry
->writeback_index
= inode
->i_mapping
->writeback_index
;
338 __entry
->root_objectid
=
339 BTRFS_I(inode
)->root
->root_key
.objectid
;
342 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, "
343 "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, "
344 "range_end = %llu, for_kupdate = %d, "
345 "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu",
346 show_root_type(__entry
->root_objectid
),
347 (unsigned long)__entry
->ino
, __entry
->index
,
348 __entry
->nr_to_write
, __entry
->pages_skipped
,
349 __entry
->range_start
, __entry
->range_end
,
350 __entry
->for_kupdate
,
351 __entry
->for_reclaim
, __entry
->range_cyclic
,
352 (unsigned long)__entry
->writeback_index
)
355 DEFINE_EVENT(btrfs__writepage
, __extent_writepage
,
357 TP_PROTO(struct page
*page
, struct inode
*inode
,
358 struct writeback_control
*wbc
),
360 TP_ARGS(page
, inode
, wbc
)
363 TRACE_EVENT(btrfs_writepage_end_io_hook
,
365 TP_PROTO(struct page
*page
, u64 start
, u64 end
, int uptodate
),
367 TP_ARGS(page
, start
, end
, uptodate
),
370 __field( ino_t
, ino
)
371 __field( pgoff_t
, index
)
372 __field( u64
, start
)
374 __field( int, uptodate
)
375 __field( u64
, root_objectid
)
379 __entry
->ino
= page
->mapping
->host
->i_ino
;
380 __entry
->index
= page
->index
;
381 __entry
->start
= start
;
383 __entry
->uptodate
= uptodate
;
384 __entry
->root_objectid
=
385 BTRFS_I(page
->mapping
->host
)->root
->root_key
.objectid
;
388 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, "
389 "end = %llu, uptodate = %d",
390 show_root_type(__entry
->root_objectid
),
391 (unsigned long)__entry
->ino
, (unsigned long)__entry
->index
,
392 (unsigned long long)__entry
->start
,
393 (unsigned long long)__entry
->end
, __entry
->uptodate
)
396 TRACE_EVENT(btrfs_sync_file
,
398 TP_PROTO(struct file
*file
, int datasync
),
400 TP_ARGS(file
, datasync
),
403 __field( ino_t
, ino
)
404 __field( ino_t
, parent
)
405 __field( int, datasync
)
406 __field( u64
, root_objectid
)
410 struct dentry
*dentry
= file
->f_path
.dentry
;
411 struct inode
*inode
= d_inode(dentry
);
413 __entry
->ino
= inode
->i_ino
;
414 __entry
->parent
= d_inode(dentry
->d_parent
)->i_ino
;
415 __entry
->datasync
= datasync
;
416 __entry
->root_objectid
=
417 BTRFS_I(inode
)->root
->root_key
.objectid
;
420 TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d",
421 show_root_type(__entry
->root_objectid
),
422 (unsigned long)__entry
->ino
, (unsigned long)__entry
->parent
,
426 TRACE_EVENT(btrfs_sync_fs
,
437 __entry
->wait
= wait
;
440 TP_printk("wait = %d", __entry
->wait
)
443 #define show_ref_action(action) \
444 __print_symbolic(action, \
445 { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \
446 { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \
447 { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \
448 { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
451 DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref
,
453 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
454 struct btrfs_delayed_tree_ref
*full_ref
,
457 TP_ARGS(ref
, full_ref
, action
),
460 __field( u64
, bytenr
)
461 __field( u64
, num_bytes
)
462 __field( int, action
)
463 __field( u64
, parent
)
464 __field( u64
, ref_root
)
465 __field( int, level
)
471 __entry
->bytenr
= ref
->bytenr
;
472 __entry
->num_bytes
= ref
->num_bytes
;
473 __entry
->action
= action
;
474 __entry
->parent
= full_ref
->parent
;
475 __entry
->ref_root
= full_ref
->root
;
476 __entry
->level
= full_ref
->level
;
477 __entry
->type
= ref
->type
;
478 __entry
->seq
= ref
->seq
;
481 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
482 "parent = %llu(%s), ref_root = %llu(%s), level = %d, "
483 "type = %s, seq = %llu",
484 (unsigned long long)__entry
->bytenr
,
485 (unsigned long long)__entry
->num_bytes
,
486 show_ref_action(__entry
->action
),
487 show_root_type(__entry
->parent
),
488 show_root_type(__entry
->ref_root
),
489 __entry
->level
, show_ref_type(__entry
->type
),
490 (unsigned long long)__entry
->seq
)
493 DEFINE_EVENT(btrfs_delayed_tree_ref
, add_delayed_tree_ref
,
495 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
496 struct btrfs_delayed_tree_ref
*full_ref
,
499 TP_ARGS(ref
, full_ref
, action
)
502 DEFINE_EVENT(btrfs_delayed_tree_ref
, run_delayed_tree_ref
,
504 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
505 struct btrfs_delayed_tree_ref
*full_ref
,
508 TP_ARGS(ref
, full_ref
, action
)
511 DECLARE_EVENT_CLASS(btrfs_delayed_data_ref
,
513 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
514 struct btrfs_delayed_data_ref
*full_ref
,
517 TP_ARGS(ref
, full_ref
, action
),
520 __field( u64
, bytenr
)
521 __field( u64
, num_bytes
)
522 __field( int, action
)
523 __field( u64
, parent
)
524 __field( u64
, ref_root
)
525 __field( u64
, owner
)
526 __field( u64
, offset
)
532 __entry
->bytenr
= ref
->bytenr
;
533 __entry
->num_bytes
= ref
->num_bytes
;
534 __entry
->action
= action
;
535 __entry
->parent
= full_ref
->parent
;
536 __entry
->ref_root
= full_ref
->root
;
537 __entry
->owner
= full_ref
->objectid
;
538 __entry
->offset
= full_ref
->offset
;
539 __entry
->type
= ref
->type
;
540 __entry
->seq
= ref
->seq
;
543 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
544 "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, "
545 "offset = %llu, type = %s, seq = %llu",
546 (unsigned long long)__entry
->bytenr
,
547 (unsigned long long)__entry
->num_bytes
,
548 show_ref_action(__entry
->action
),
549 show_root_type(__entry
->parent
),
550 show_root_type(__entry
->ref_root
),
551 (unsigned long long)__entry
->owner
,
552 (unsigned long long)__entry
->offset
,
553 show_ref_type(__entry
->type
),
554 (unsigned long long)__entry
->seq
)
557 DEFINE_EVENT(btrfs_delayed_data_ref
, add_delayed_data_ref
,
559 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
560 struct btrfs_delayed_data_ref
*full_ref
,
563 TP_ARGS(ref
, full_ref
, action
)
566 DEFINE_EVENT(btrfs_delayed_data_ref
, run_delayed_data_ref
,
568 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
569 struct btrfs_delayed_data_ref
*full_ref
,
572 TP_ARGS(ref
, full_ref
, action
)
575 DECLARE_EVENT_CLASS(btrfs_delayed_ref_head
,
577 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
578 struct btrfs_delayed_ref_head
*head_ref
,
581 TP_ARGS(ref
, head_ref
, action
),
584 __field( u64
, bytenr
)
585 __field( u64
, num_bytes
)
586 __field( int, action
)
587 __field( int, is_data
)
591 __entry
->bytenr
= ref
->bytenr
;
592 __entry
->num_bytes
= ref
->num_bytes
;
593 __entry
->action
= action
;
594 __entry
->is_data
= head_ref
->is_data
;
597 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d",
598 (unsigned long long)__entry
->bytenr
,
599 (unsigned long long)__entry
->num_bytes
,
600 show_ref_action(__entry
->action
),
604 DEFINE_EVENT(btrfs_delayed_ref_head
, add_delayed_ref_head
,
606 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
607 struct btrfs_delayed_ref_head
*head_ref
,
610 TP_ARGS(ref
, head_ref
, action
)
613 DEFINE_EVENT(btrfs_delayed_ref_head
, run_delayed_ref_head
,
615 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
616 struct btrfs_delayed_ref_head
*head_ref
,
619 TP_ARGS(ref
, head_ref
, action
)
622 #define show_chunk_type(type) \
623 __print_flags(type, "|", \
624 { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \
625 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
626 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
627 { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \
628 { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \
629 { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \
630 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
631 { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \
632 { BTRFS_BLOCK_GROUP_RAID6, "RAID6" })
634 DECLARE_EVENT_CLASS(btrfs__chunk
,
636 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
637 u64 offset
, u64 size
),
639 TP_ARGS(root
, map
, offset
, size
),
642 __field( int, num_stripes
)
644 __field( int, sub_stripes
)
645 __field( u64
, offset
)
647 __field( u64
, root_objectid
)
651 __entry
->num_stripes
= map
->num_stripes
;
652 __entry
->type
= map
->type
;
653 __entry
->sub_stripes
= map
->sub_stripes
;
654 __entry
->offset
= offset
;
655 __entry
->size
= size
;
656 __entry
->root_objectid
= root
->root_key
.objectid
;
659 TP_printk("root = %llu(%s), offset = %llu, size = %llu, "
660 "num_stripes = %d, sub_stripes = %d, type = %s",
661 show_root_type(__entry
->root_objectid
),
662 (unsigned long long)__entry
->offset
,
663 (unsigned long long)__entry
->size
,
664 __entry
->num_stripes
, __entry
->sub_stripes
,
665 show_chunk_type(__entry
->type
))
668 DEFINE_EVENT(btrfs__chunk
, btrfs_chunk_alloc
,
670 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
671 u64 offset
, u64 size
),
673 TP_ARGS(root
, map
, offset
, size
)
676 DEFINE_EVENT(btrfs__chunk
, btrfs_chunk_free
,
678 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
679 u64 offset
, u64 size
),
681 TP_ARGS(root
, map
, offset
, size
)
684 TRACE_EVENT(btrfs_cow_block
,
686 TP_PROTO(struct btrfs_root
*root
, struct extent_buffer
*buf
,
687 struct extent_buffer
*cow
),
689 TP_ARGS(root
, buf
, cow
),
692 __field( u64
, root_objectid
)
693 __field( u64
, buf_start
)
695 __field( u64
, cow_start
)
696 __field( int, buf_level
)
697 __field( int, cow_level
)
701 __entry
->root_objectid
= root
->root_key
.objectid
;
702 __entry
->buf_start
= buf
->start
;
703 __entry
->refs
= atomic_read(&buf
->refs
);
704 __entry
->cow_start
= cow
->start
;
705 __entry
->buf_level
= btrfs_header_level(buf
);
706 __entry
->cow_level
= btrfs_header_level(cow
);
709 TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu "
710 "(orig_level = %d), cow_buf = %llu (cow_level = %d)",
711 show_root_type(__entry
->root_objectid
),
713 (unsigned long long)__entry
->buf_start
,
715 (unsigned long long)__entry
->cow_start
,
719 TRACE_EVENT(btrfs_space_reservation
,
721 TP_PROTO(struct btrfs_fs_info
*fs_info
, char *type
, u64 val
,
722 u64 bytes
, int reserve
),
724 TP_ARGS(fs_info
, type
, val
, bytes
, reserve
),
727 __array( u8
, fsid
, BTRFS_UUID_SIZE
)
728 __string( type
, type
)
730 __field( u64
, bytes
)
731 __field( int, reserve
)
735 memcpy(__entry
->fsid
, fs_info
->fsid
, BTRFS_UUID_SIZE
);
736 __assign_str(type
, type
);
738 __entry
->bytes
= bytes
;
739 __entry
->reserve
= reserve
;
742 TP_printk("%pU: %s: %Lu %s %Lu", __entry
->fsid
, __get_str(type
),
743 __entry
->val
, __entry
->reserve
? "reserve" : "release",
747 DECLARE_EVENT_CLASS(btrfs__reserved_extent
,
749 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
751 TP_ARGS(root
, start
, len
),
754 __field( u64
, root_objectid
)
755 __field( u64
, start
)
760 __entry
->root_objectid
= root
->root_key
.objectid
;
761 __entry
->start
= start
;
765 TP_printk("root = %llu(%s), start = %llu, len = %llu",
766 show_root_type(__entry
->root_objectid
),
767 (unsigned long long)__entry
->start
,
768 (unsigned long long)__entry
->len
)
771 DEFINE_EVENT(btrfs__reserved_extent
, btrfs_reserved_extent_alloc
,
773 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
775 TP_ARGS(root
, start
, len
)
778 DEFINE_EVENT(btrfs__reserved_extent
, btrfs_reserved_extent_free
,
780 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
782 TP_ARGS(root
, start
, len
)
785 TRACE_EVENT(find_free_extent
,
787 TP_PROTO(struct btrfs_root
*root
, u64 num_bytes
, u64 empty_size
,
790 TP_ARGS(root
, num_bytes
, empty_size
, data
),
793 __field( u64
, root_objectid
)
794 __field( u64
, num_bytes
)
795 __field( u64
, empty_size
)
800 __entry
->root_objectid
= root
->root_key
.objectid
;
801 __entry
->num_bytes
= num_bytes
;
802 __entry
->empty_size
= empty_size
;
803 __entry
->data
= data
;
806 TP_printk("root = %Lu(%s), len = %Lu, empty_size = %Lu, "
807 "flags = %Lu(%s)", show_root_type(__entry
->root_objectid
),
808 __entry
->num_bytes
, __entry
->empty_size
, __entry
->data
,
809 __print_flags((unsigned long)__entry
->data
, "|",
813 DECLARE_EVENT_CLASS(btrfs__reserve_extent
,
815 TP_PROTO(struct btrfs_root
*root
,
816 struct btrfs_block_group_cache
*block_group
, u64 start
,
819 TP_ARGS(root
, block_group
, start
, len
),
822 __field( u64
, root_objectid
)
823 __field( u64
, bg_objectid
)
824 __field( u64
, flags
)
825 __field( u64
, start
)
830 __entry
->root_objectid
= root
->root_key
.objectid
;
831 __entry
->bg_objectid
= block_group
->key
.objectid
;
832 __entry
->flags
= block_group
->flags
;
833 __entry
->start
= start
;
837 TP_printk("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), "
838 "start = %Lu, len = %Lu",
839 show_root_type(__entry
->root_objectid
), __entry
->bg_objectid
,
840 __entry
->flags
, __print_flags((unsigned long)__entry
->flags
,
841 "|", BTRFS_GROUP_FLAGS
),
842 __entry
->start
, __entry
->len
)
845 DEFINE_EVENT(btrfs__reserve_extent
, btrfs_reserve_extent
,
847 TP_PROTO(struct btrfs_root
*root
,
848 struct btrfs_block_group_cache
*block_group
, u64 start
,
851 TP_ARGS(root
, block_group
, start
, len
)
854 DEFINE_EVENT(btrfs__reserve_extent
, btrfs_reserve_extent_cluster
,
856 TP_PROTO(struct btrfs_root
*root
,
857 struct btrfs_block_group_cache
*block_group
, u64 start
,
860 TP_ARGS(root
, block_group
, start
, len
)
863 TRACE_EVENT(btrfs_find_cluster
,
865 TP_PROTO(struct btrfs_block_group_cache
*block_group
, u64 start
,
866 u64 bytes
, u64 empty_size
, u64 min_bytes
),
868 TP_ARGS(block_group
, start
, bytes
, empty_size
, min_bytes
),
871 __field( u64
, bg_objectid
)
872 __field( u64
, flags
)
873 __field( u64
, start
)
874 __field( u64
, bytes
)
875 __field( u64
, empty_size
)
876 __field( u64
, min_bytes
)
880 __entry
->bg_objectid
= block_group
->key
.objectid
;
881 __entry
->flags
= block_group
->flags
;
882 __entry
->start
= start
;
883 __entry
->bytes
= bytes
;
884 __entry
->empty_size
= empty_size
;
885 __entry
->min_bytes
= min_bytes
;
888 TP_printk("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu,"
889 " empty_size = %Lu, min_bytes = %Lu", __entry
->bg_objectid
,
891 __print_flags((unsigned long)__entry
->flags
, "|",
892 BTRFS_GROUP_FLAGS
), __entry
->start
,
893 __entry
->bytes
, __entry
->empty_size
, __entry
->min_bytes
)
896 TRACE_EVENT(btrfs_failed_cluster_setup
,
898 TP_PROTO(struct btrfs_block_group_cache
*block_group
),
900 TP_ARGS(block_group
),
903 __field( u64
, bg_objectid
)
907 __entry
->bg_objectid
= block_group
->key
.objectid
;
910 TP_printk("block_group = %Lu", __entry
->bg_objectid
)
913 TRACE_EVENT(btrfs_setup_cluster
,
915 TP_PROTO(struct btrfs_block_group_cache
*block_group
,
916 struct btrfs_free_cluster
*cluster
, u64 size
, int bitmap
),
918 TP_ARGS(block_group
, cluster
, size
, bitmap
),
921 __field( u64
, bg_objectid
)
922 __field( u64
, flags
)
923 __field( u64
, start
)
924 __field( u64
, max_size
)
926 __field( int, bitmap
)
930 __entry
->bg_objectid
= block_group
->key
.objectid
;
931 __entry
->flags
= block_group
->flags
;
932 __entry
->start
= cluster
->window_start
;
933 __entry
->max_size
= cluster
->max_size
;
934 __entry
->size
= size
;
935 __entry
->bitmap
= bitmap
;
938 TP_printk("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, "
939 "size = %Lu, max_size = %Lu, bitmap = %d",
940 __entry
->bg_objectid
,
942 __print_flags((unsigned long)__entry
->flags
, "|",
943 BTRFS_GROUP_FLAGS
), __entry
->start
,
944 __entry
->size
, __entry
->max_size
, __entry
->bitmap
)
948 TRACE_EVENT(alloc_extent_state
,
950 TP_PROTO(struct extent_state
*state
, gfp_t mask
, unsigned long IP
),
952 TP_ARGS(state
, mask
, IP
),
955 __field(struct extent_state
*, state
)
957 __field(unsigned long, ip
)
961 __entry
->state
= state
,
962 __entry
->mask
= mask
,
966 TP_printk("state=%p; mask = %s; caller = %pS", __entry
->state
,
967 show_gfp_flags(__entry
->mask
), (void *)__entry
->ip
)
970 TRACE_EVENT(free_extent_state
,
972 TP_PROTO(struct extent_state
*state
, unsigned long IP
),
977 __field(struct extent_state
*, state
)
978 __field(unsigned long, ip
)
982 __entry
->state
= state
,
986 TP_printk(" state=%p; caller = %pS", __entry
->state
,
990 DECLARE_EVENT_CLASS(btrfs__work
,
992 TP_PROTO(struct btrfs_work
*work
),
997 __field( void *, work
)
998 __field( void *, wq
)
999 __field( void *, func
)
1000 __field( void *, ordered_func
)
1001 __field( void *, ordered_free
)
1002 __field( void *, normal_work
)
1006 __entry
->work
= work
;
1007 __entry
->wq
= work
->wq
;
1008 __entry
->func
= work
->func
;
1009 __entry
->ordered_func
= work
->ordered_func
;
1010 __entry
->ordered_free
= work
->ordered_free
;
1011 __entry
->normal_work
= &work
->normal_work
;
1014 TP_printk("work=%p (normal_work=%p), wq=%p, func=%pf, ordered_func=%p,"
1016 __entry
->work
, __entry
->normal_work
, __entry
->wq
,
1017 __entry
->func
, __entry
->ordered_func
, __entry
->ordered_free
)
1020 /* For situiations that the work is freed */
1021 DECLARE_EVENT_CLASS(btrfs__work__done
,
1023 TP_PROTO(struct btrfs_work
*work
),
1028 __field( void *, work
)
1032 __entry
->work
= work
;
1035 TP_printk("work->%p", __entry
->work
)
1038 DEFINE_EVENT(btrfs__work
, btrfs_work_queued
,
1040 TP_PROTO(struct btrfs_work
*work
),
1045 DEFINE_EVENT(btrfs__work
, btrfs_work_sched
,
1047 TP_PROTO(struct btrfs_work
*work
),
1052 DEFINE_EVENT(btrfs__work__done
, btrfs_all_work_done
,
1054 TP_PROTO(struct btrfs_work
*work
),
1059 DEFINE_EVENT(btrfs__work
, btrfs_ordered_sched
,
1061 TP_PROTO(struct btrfs_work
*work
),
1066 DECLARE_EVENT_CLASS(btrfs__workqueue
,
1068 TP_PROTO(struct __btrfs_workqueue
*wq
, const char *name
, int high
),
1070 TP_ARGS(wq
, name
, high
),
1073 __field( void *, wq
)
1074 __string( name
, name
)
1075 __field( int , high
)
1080 __assign_str(name
, name
);
1081 __entry
->high
= high
;
1084 TP_printk("name=%s%s, wq=%p", __get_str(name
),
1085 __print_flags(__entry
->high
, "",
1086 {(WQ_HIGHPRI
), "-high"}),
1090 DEFINE_EVENT(btrfs__workqueue
, btrfs_workqueue_alloc
,
1092 TP_PROTO(struct __btrfs_workqueue
*wq
, const char *name
, int high
),
1094 TP_ARGS(wq
, name
, high
)
1097 DECLARE_EVENT_CLASS(btrfs__workqueue_done
,
1099 TP_PROTO(struct __btrfs_workqueue
*wq
),
1104 __field( void *, wq
)
1111 TP_printk("wq=%p", __entry
->wq
)
1114 DEFINE_EVENT(btrfs__workqueue_done
, btrfs_workqueue_destroy
,
1116 TP_PROTO(struct __btrfs_workqueue
*wq
),
1121 DECLARE_EVENT_CLASS(btrfs__qgroup_data_map
,
1123 TP_PROTO(struct inode
*inode
, u64 free_reserved
),
1125 TP_ARGS(inode
, free_reserved
),
1128 __field( u64
, rootid
)
1129 __field( unsigned long, ino
)
1130 __field( u64
, free_reserved
)
1134 __entry
->rootid
= BTRFS_I(inode
)->root
->objectid
;
1135 __entry
->ino
= inode
->i_ino
;
1136 __entry
->free_reserved
= free_reserved
;
1139 TP_printk("rootid=%llu, ino=%lu, free_reserved=%llu",
1140 __entry
->rootid
, __entry
->ino
, __entry
->free_reserved
)
1143 DEFINE_EVENT(btrfs__qgroup_data_map
, btrfs_qgroup_init_data_rsv_map
,
1145 TP_PROTO(struct inode
*inode
, u64 free_reserved
),
1147 TP_ARGS(inode
, free_reserved
)
1150 DEFINE_EVENT(btrfs__qgroup_data_map
, btrfs_qgroup_free_data_rsv_map
,
1152 TP_PROTO(struct inode
*inode
, u64 free_reserved
),
1154 TP_ARGS(inode
, free_reserved
)
1157 #define BTRFS_QGROUP_OPERATIONS \
1158 { QGROUP_RESERVE, "reserve" }, \
1159 { QGROUP_RELEASE, "release" }, \
1160 { QGROUP_FREE, "free" }
1162 DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data
,
1164 TP_PROTO(struct inode
*inode
, u64 start
, u64 len
, u64 reserved
, int op
),
1166 TP_ARGS(inode
, start
, len
, reserved
, op
),
1169 __field( u64
, rootid
)
1170 __field( unsigned long, ino
)
1171 __field( u64
, start
)
1173 __field( u64
, reserved
)
1178 __entry
->rootid
= BTRFS_I(inode
)->root
->objectid
;
1179 __entry
->ino
= inode
->i_ino
;
1180 __entry
->start
= start
;
1182 __entry
->reserved
= reserved
;
1186 TP_printk("root=%llu, ino=%lu, start=%llu, len=%llu, reserved=%llu, op=%s",
1187 __entry
->rootid
, __entry
->ino
, __entry
->start
, __entry
->len
,
1189 __print_flags((unsigned long)__entry
->op
, "",
1190 BTRFS_QGROUP_OPERATIONS
)
1194 DEFINE_EVENT(btrfs__qgroup_rsv_data
, btrfs_qgroup_reserve_data
,
1196 TP_PROTO(struct inode
*inode
, u64 start
, u64 len
, u64 reserved
, int op
),
1198 TP_ARGS(inode
, start
, len
, reserved
, op
)
1201 DEFINE_EVENT(btrfs__qgroup_rsv_data
, btrfs_qgroup_release_data
,
1203 TP_PROTO(struct inode
*inode
, u64 start
, u64 len
, u64 reserved
, int op
),
1205 TP_ARGS(inode
, start
, len
, reserved
, op
)
1208 DECLARE_EVENT_CLASS(btrfs__qgroup_delayed_ref
,
1210 TP_PROTO(u64 ref_root
, u64 reserved
),
1212 TP_ARGS(ref_root
, reserved
),
1215 __field( u64
, ref_root
)
1216 __field( u64
, reserved
)
1220 __entry
->ref_root
= ref_root
;
1221 __entry
->reserved
= reserved
;
1224 TP_printk("root=%llu, reserved=%llu, op=free",
1225 __entry
->ref_root
, __entry
->reserved
)
1228 DEFINE_EVENT(btrfs__qgroup_delayed_ref
, btrfs_qgroup_free_delayed_ref
,
1230 TP_PROTO(u64 ref_root
, u64 reserved
),
1232 TP_ARGS(ref_root
, reserved
)
1235 DECLARE_EVENT_CLASS(btrfs_qgroup_extent
,
1236 TP_PROTO(struct btrfs_qgroup_extent_record
*rec
),
1241 __field( u64
, bytenr
)
1242 __field( u64
, num_bytes
)
1246 __entry
->bytenr
= rec
->bytenr
,
1247 __entry
->num_bytes
= rec
->num_bytes
;
1250 TP_printk("bytenr = %llu, num_bytes = %llu",
1251 (unsigned long long)__entry
->bytenr
,
1252 (unsigned long long)__entry
->num_bytes
)
1255 DEFINE_EVENT(btrfs_qgroup_extent
, btrfs_qgroup_account_extents
,
1257 TP_PROTO(struct btrfs_qgroup_extent_record
*rec
),
1262 DEFINE_EVENT(btrfs_qgroup_extent
, btrfs_qgroup_insert_dirty_extent
,
1264 TP_PROTO(struct btrfs_qgroup_extent_record
*rec
),
1269 TRACE_EVENT(btrfs_qgroup_account_extent
,
1271 TP_PROTO(u64 bytenr
, u64 num_bytes
, u64 nr_old_roots
, u64 nr_new_roots
),
1273 TP_ARGS(bytenr
, num_bytes
, nr_old_roots
, nr_new_roots
),
1276 __field( u64
, bytenr
)
1277 __field( u64
, num_bytes
)
1278 __field( u64
, nr_old_roots
)
1279 __field( u64
, nr_new_roots
)
1283 __entry
->bytenr
= bytenr
;
1284 __entry
->num_bytes
= num_bytes
;
1285 __entry
->nr_old_roots
= nr_old_roots
;
1286 __entry
->nr_new_roots
= nr_new_roots
;
1289 TP_printk("bytenr = %llu, num_bytes = %llu, nr_old_roots = %llu, "
1290 "nr_new_roots = %llu",
1293 __entry
->nr_old_roots
,
1294 __entry
->nr_new_roots
)
1297 TRACE_EVENT(qgroup_update_counters
,
1299 TP_PROTO(u64 qgid
, u64 cur_old_count
, u64 cur_new_count
),
1301 TP_ARGS(qgid
, cur_old_count
, cur_new_count
),
1304 __field( u64
, qgid
)
1305 __field( u64
, cur_old_count
)
1306 __field( u64
, cur_new_count
)
1310 __entry
->qgid
= qgid
;
1311 __entry
->cur_old_count
= cur_old_count
;
1312 __entry
->cur_new_count
= cur_new_count
;
1315 TP_printk("qgid = %llu, cur_old_count = %llu, cur_new_count = %llu",
1317 __entry
->cur_old_count
,
1318 __entry
->cur_new_count
)
1321 #endif /* _TRACE_BTRFS_H */
1323 /* This part must be outside protection */
1324 #include <trace/define_trace.h>