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/gfpflags.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 #define show_ref_type(type) \
26 __print_symbolic(type, \
27 { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \
28 { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \
29 { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \
30 { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \
31 { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" })
33 #define __show_root_type(obj) \
34 __print_symbolic_u64(obj, \
35 { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \
36 { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \
37 { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \
38 { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \
39 { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \
40 { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \
41 { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \
42 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \
43 { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \
44 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \
45 { BTRFS_UUID_TREE_OBJECTID, "UUID_RELOC" }, \
46 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
48 #define show_root_type(obj) \
49 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
50 (obj >= BTRFS_ROOT_TREE_OBJECTID && \
51 obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
53 #define BTRFS_GROUP_FLAGS \
54 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \
55 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
56 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
57 { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \
58 { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \
59 { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \
60 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
61 { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \
62 { BTRFS_BLOCK_GROUP_RAID6, "RAID6"}
64 #define BTRFS_UUID_SIZE 16
66 TRACE_EVENT(btrfs_transaction_commit
,
68 TP_PROTO(struct btrfs_root
*root
),
73 __field( u64
, generation
)
74 __field( u64
, root_objectid
)
78 __entry
->generation
= root
->fs_info
->generation
;
79 __entry
->root_objectid
= root
->root_key
.objectid
;
82 TP_printk("root = %llu(%s), gen = %llu",
83 show_root_type(__entry
->root_objectid
),
84 (unsigned long long)__entry
->generation
)
87 DECLARE_EVENT_CLASS(btrfs__inode
,
89 TP_PROTO(struct inode
*inode
),
95 __field( blkcnt_t
, blocks
)
96 __field( u64
, disk_i_size
)
97 __field( u64
, generation
)
98 __field( u64
, last_trans
)
99 __field( u64
, logged_trans
)
100 __field( u64
, root_objectid
)
104 __entry
->ino
= inode
->i_ino
;
105 __entry
->blocks
= inode
->i_blocks
;
106 __entry
->disk_i_size
= BTRFS_I(inode
)->disk_i_size
;
107 __entry
->generation
= BTRFS_I(inode
)->generation
;
108 __entry
->last_trans
= BTRFS_I(inode
)->last_trans
;
109 __entry
->logged_trans
= BTRFS_I(inode
)->logged_trans
;
110 __entry
->root_objectid
=
111 BTRFS_I(inode
)->root
->root_key
.objectid
;
114 TP_printk("root = %llu(%s), gen = %llu, ino = %lu, blocks = %llu, "
115 "disk_i_size = %llu, last_trans = %llu, logged_trans = %llu",
116 show_root_type(__entry
->root_objectid
),
117 (unsigned long long)__entry
->generation
,
118 (unsigned long)__entry
->ino
,
119 (unsigned long long)__entry
->blocks
,
120 (unsigned long long)__entry
->disk_i_size
,
121 (unsigned long long)__entry
->last_trans
,
122 (unsigned long long)__entry
->logged_trans
)
125 DEFINE_EVENT(btrfs__inode
, btrfs_inode_new
,
127 TP_PROTO(struct inode
*inode
),
132 DEFINE_EVENT(btrfs__inode
, btrfs_inode_request
,
134 TP_PROTO(struct inode
*inode
),
139 DEFINE_EVENT(btrfs__inode
, btrfs_inode_evict
,
141 TP_PROTO(struct inode
*inode
),
146 #define __show_map_type(type) \
147 __print_symbolic_u64(type, \
148 { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \
149 { EXTENT_MAP_HOLE, "HOLE" }, \
150 { EXTENT_MAP_INLINE, "INLINE" }, \
151 { EXTENT_MAP_DELALLOC, "DELALLOC" })
153 #define show_map_type(type) \
154 type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type)
156 #define show_map_flags(flag) \
157 __print_flags(flag, "|", \
158 { EXTENT_FLAG_PINNED, "PINNED" }, \
159 { EXTENT_FLAG_COMPRESSED, "COMPRESSED" }, \
160 { EXTENT_FLAG_VACANCY, "VACANCY" }, \
161 { EXTENT_FLAG_PREALLOC, "PREALLOC" }, \
162 { EXTENT_FLAG_LOGGING, "LOGGING" }, \
163 { EXTENT_FLAG_FILLING, "FILLING" })
165 TRACE_EVENT_CONDITION(btrfs_get_extent
,
167 TP_PROTO(struct btrfs_root
*root
, struct extent_map
*map
),
174 __field( u64
, root_objectid
)
175 __field( u64
, start
)
177 __field( u64
, orig_start
)
178 __field( u64
, block_start
)
179 __field( u64
, block_len
)
180 __field( unsigned long, flags
)
182 __field( unsigned int, compress_type
)
186 __entry
->root_objectid
= root
->root_key
.objectid
;
187 __entry
->start
= map
->start
;
188 __entry
->len
= map
->len
;
189 __entry
->orig_start
= map
->orig_start
;
190 __entry
->block_start
= map
->block_start
;
191 __entry
->block_len
= map
->block_len
;
192 __entry
->flags
= map
->flags
;
193 __entry
->refs
= atomic_read(&map
->refs
);
194 __entry
->compress_type
= map
->compress_type
;
197 TP_printk("root = %llu(%s), start = %llu, len = %llu, "
198 "orig_start = %llu, block_start = %llu(%s), "
199 "block_len = %llu, flags = %s, refs = %u, "
200 "compress_type = %u",
201 show_root_type(__entry
->root_objectid
),
202 (unsigned long long)__entry
->start
,
203 (unsigned long long)__entry
->len
,
204 (unsigned long long)__entry
->orig_start
,
205 show_map_type(__entry
->block_start
),
206 (unsigned long long)__entry
->block_len
,
207 show_map_flags(__entry
->flags
),
208 __entry
->refs
, __entry
->compress_type
)
211 #define show_ordered_flags(flags) \
212 __print_flags(flags, "|", \
213 { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \
214 { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \
215 { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \
216 { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \
217 { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \
218 { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \
219 { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \
220 { (1 << BTRFS_ORDERED_UPDATED_ISIZE), "UPDATED_ISIZE" }, \
221 { (1 << BTRFS_ORDERED_LOGGED_CSUM), "LOGGED_CSUM" }, \
222 { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" })
225 DECLARE_EVENT_CLASS(btrfs__ordered_extent
,
227 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
229 TP_ARGS(inode
, ordered
),
232 __field( ino_t
, ino
)
233 __field( u64
, file_offset
)
234 __field( u64
, start
)
236 __field( u64
, disk_len
)
237 __field( u64
, bytes_left
)
238 __field( unsigned long, flags
)
239 __field( int, compress_type
)
241 __field( u64
, root_objectid
)
245 __entry
->ino
= inode
->i_ino
;
246 __entry
->file_offset
= ordered
->file_offset
;
247 __entry
->start
= ordered
->start
;
248 __entry
->len
= ordered
->len
;
249 __entry
->disk_len
= ordered
->disk_len
;
250 __entry
->bytes_left
= ordered
->bytes_left
;
251 __entry
->flags
= ordered
->flags
;
252 __entry
->compress_type
= ordered
->compress_type
;
253 __entry
->refs
= atomic_read(&ordered
->refs
);
254 __entry
->root_objectid
=
255 BTRFS_I(inode
)->root
->root_key
.objectid
;
258 TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, "
259 "start = %llu, len = %llu, disk_len = %llu, "
260 "bytes_left = %llu, flags = %s, compress_type = %d, "
262 show_root_type(__entry
->root_objectid
),
263 (unsigned long long)__entry
->ino
,
264 (unsigned long long)__entry
->file_offset
,
265 (unsigned long long)__entry
->start
,
266 (unsigned long long)__entry
->len
,
267 (unsigned long long)__entry
->disk_len
,
268 (unsigned long long)__entry
->bytes_left
,
269 show_ordered_flags(__entry
->flags
),
270 __entry
->compress_type
, __entry
->refs
)
273 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_add
,
275 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
277 TP_ARGS(inode
, ordered
)
280 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_remove
,
282 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
284 TP_ARGS(inode
, ordered
)
287 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_start
,
289 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
291 TP_ARGS(inode
, ordered
)
294 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_put
,
296 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
298 TP_ARGS(inode
, ordered
)
301 DECLARE_EVENT_CLASS(btrfs__writepage
,
303 TP_PROTO(struct page
*page
, struct inode
*inode
,
304 struct writeback_control
*wbc
),
306 TP_ARGS(page
, inode
, wbc
),
309 __field( ino_t
, ino
)
310 __field( pgoff_t
, index
)
311 __field( long, nr_to_write
)
312 __field( long, pages_skipped
)
313 __field( loff_t
, range_start
)
314 __field( loff_t
, range_end
)
315 __field( char, for_kupdate
)
316 __field( char, for_reclaim
)
317 __field( char, range_cyclic
)
318 __field( pgoff_t
, writeback_index
)
319 __field( u64
, root_objectid
)
323 __entry
->ino
= inode
->i_ino
;
324 __entry
->index
= page
->index
;
325 __entry
->nr_to_write
= wbc
->nr_to_write
;
326 __entry
->pages_skipped
= wbc
->pages_skipped
;
327 __entry
->range_start
= wbc
->range_start
;
328 __entry
->range_end
= wbc
->range_end
;
329 __entry
->for_kupdate
= wbc
->for_kupdate
;
330 __entry
->for_reclaim
= wbc
->for_reclaim
;
331 __entry
->range_cyclic
= wbc
->range_cyclic
;
332 __entry
->writeback_index
= inode
->i_mapping
->writeback_index
;
333 __entry
->root_objectid
=
334 BTRFS_I(inode
)->root
->root_key
.objectid
;
337 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, "
338 "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, "
339 "range_end = %llu, for_kupdate = %d, "
340 "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu",
341 show_root_type(__entry
->root_objectid
),
342 (unsigned long)__entry
->ino
, __entry
->index
,
343 __entry
->nr_to_write
, __entry
->pages_skipped
,
344 __entry
->range_start
, __entry
->range_end
,
345 __entry
->for_kupdate
,
346 __entry
->for_reclaim
, __entry
->range_cyclic
,
347 (unsigned long)__entry
->writeback_index
)
350 DEFINE_EVENT(btrfs__writepage
, __extent_writepage
,
352 TP_PROTO(struct page
*page
, struct inode
*inode
,
353 struct writeback_control
*wbc
),
355 TP_ARGS(page
, inode
, wbc
)
358 TRACE_EVENT(btrfs_writepage_end_io_hook
,
360 TP_PROTO(struct page
*page
, u64 start
, u64 end
, int uptodate
),
362 TP_ARGS(page
, start
, end
, uptodate
),
365 __field( ino_t
, ino
)
366 __field( pgoff_t
, index
)
367 __field( u64
, start
)
369 __field( int, uptodate
)
370 __field( u64
, root_objectid
)
374 __entry
->ino
= page
->mapping
->host
->i_ino
;
375 __entry
->index
= page
->index
;
376 __entry
->start
= start
;
378 __entry
->uptodate
= uptodate
;
379 __entry
->root_objectid
=
380 BTRFS_I(page
->mapping
->host
)->root
->root_key
.objectid
;
383 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, "
384 "end = %llu, uptodate = %d",
385 show_root_type(__entry
->root_objectid
),
386 (unsigned long)__entry
->ino
, (unsigned long)__entry
->index
,
387 (unsigned long long)__entry
->start
,
388 (unsigned long long)__entry
->end
, __entry
->uptodate
)
391 TRACE_EVENT(btrfs_sync_file
,
393 TP_PROTO(struct file
*file
, int datasync
),
395 TP_ARGS(file
, datasync
),
398 __field( ino_t
, ino
)
399 __field( ino_t
, parent
)
400 __field( int, datasync
)
401 __field( u64
, root_objectid
)
405 struct dentry
*dentry
= file
->f_path
.dentry
;
406 struct inode
*inode
= dentry
->d_inode
;
408 __entry
->ino
= inode
->i_ino
;
409 __entry
->parent
= dentry
->d_parent
->d_inode
->i_ino
;
410 __entry
->datasync
= datasync
;
411 __entry
->root_objectid
=
412 BTRFS_I(inode
)->root
->root_key
.objectid
;
415 TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d",
416 show_root_type(__entry
->root_objectid
),
417 (unsigned long)__entry
->ino
, (unsigned long)__entry
->parent
,
421 TRACE_EVENT(btrfs_sync_fs
,
432 __entry
->wait
= wait
;
435 TP_printk("wait = %d", __entry
->wait
)
438 #define show_ref_action(action) \
439 __print_symbolic(action, \
440 { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \
441 { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \
442 { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \
443 { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
446 DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref
,
448 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
449 struct btrfs_delayed_tree_ref
*full_ref
,
452 TP_ARGS(ref
, full_ref
, action
),
455 __field( u64
, bytenr
)
456 __field( u64
, num_bytes
)
457 __field( int, action
)
458 __field( u64
, parent
)
459 __field( u64
, ref_root
)
460 __field( int, level
)
466 __entry
->bytenr
= ref
->bytenr
;
467 __entry
->num_bytes
= ref
->num_bytes
;
468 __entry
->action
= action
;
469 __entry
->parent
= full_ref
->parent
;
470 __entry
->ref_root
= full_ref
->root
;
471 __entry
->level
= full_ref
->level
;
472 __entry
->type
= ref
->type
;
473 __entry
->seq
= ref
->seq
;
476 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
477 "parent = %llu(%s), ref_root = %llu(%s), level = %d, "
478 "type = %s, seq = %llu",
479 (unsigned long long)__entry
->bytenr
,
480 (unsigned long long)__entry
->num_bytes
,
481 show_ref_action(__entry
->action
),
482 show_root_type(__entry
->parent
),
483 show_root_type(__entry
->ref_root
),
484 __entry
->level
, show_ref_type(__entry
->type
),
485 (unsigned long long)__entry
->seq
)
488 DEFINE_EVENT(btrfs_delayed_tree_ref
, add_delayed_tree_ref
,
490 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
491 struct btrfs_delayed_tree_ref
*full_ref
,
494 TP_ARGS(ref
, full_ref
, action
)
497 DEFINE_EVENT(btrfs_delayed_tree_ref
, run_delayed_tree_ref
,
499 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
500 struct btrfs_delayed_tree_ref
*full_ref
,
503 TP_ARGS(ref
, full_ref
, action
)
506 DECLARE_EVENT_CLASS(btrfs_delayed_data_ref
,
508 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
509 struct btrfs_delayed_data_ref
*full_ref
,
512 TP_ARGS(ref
, full_ref
, action
),
515 __field( u64
, bytenr
)
516 __field( u64
, num_bytes
)
517 __field( int, action
)
518 __field( u64
, parent
)
519 __field( u64
, ref_root
)
520 __field( u64
, owner
)
521 __field( u64
, offset
)
527 __entry
->bytenr
= ref
->bytenr
;
528 __entry
->num_bytes
= ref
->num_bytes
;
529 __entry
->action
= action
;
530 __entry
->parent
= full_ref
->parent
;
531 __entry
->ref_root
= full_ref
->root
;
532 __entry
->owner
= full_ref
->objectid
;
533 __entry
->offset
= full_ref
->offset
;
534 __entry
->type
= ref
->type
;
535 __entry
->seq
= ref
->seq
;
538 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
539 "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, "
540 "offset = %llu, type = %s, seq = %llu",
541 (unsigned long long)__entry
->bytenr
,
542 (unsigned long long)__entry
->num_bytes
,
543 show_ref_action(__entry
->action
),
544 show_root_type(__entry
->parent
),
545 show_root_type(__entry
->ref_root
),
546 (unsigned long long)__entry
->owner
,
547 (unsigned long long)__entry
->offset
,
548 show_ref_type(__entry
->type
),
549 (unsigned long long)__entry
->seq
)
552 DEFINE_EVENT(btrfs_delayed_data_ref
, add_delayed_data_ref
,
554 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
555 struct btrfs_delayed_data_ref
*full_ref
,
558 TP_ARGS(ref
, full_ref
, action
)
561 DEFINE_EVENT(btrfs_delayed_data_ref
, run_delayed_data_ref
,
563 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
564 struct btrfs_delayed_data_ref
*full_ref
,
567 TP_ARGS(ref
, full_ref
, action
)
570 DECLARE_EVENT_CLASS(btrfs_delayed_ref_head
,
572 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
573 struct btrfs_delayed_ref_head
*head_ref
,
576 TP_ARGS(ref
, head_ref
, action
),
579 __field( u64
, bytenr
)
580 __field( u64
, num_bytes
)
581 __field( int, action
)
582 __field( int, is_data
)
586 __entry
->bytenr
= ref
->bytenr
;
587 __entry
->num_bytes
= ref
->num_bytes
;
588 __entry
->action
= action
;
589 __entry
->is_data
= head_ref
->is_data
;
592 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d",
593 (unsigned long long)__entry
->bytenr
,
594 (unsigned long long)__entry
->num_bytes
,
595 show_ref_action(__entry
->action
),
599 DEFINE_EVENT(btrfs_delayed_ref_head
, add_delayed_ref_head
,
601 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
602 struct btrfs_delayed_ref_head
*head_ref
,
605 TP_ARGS(ref
, head_ref
, action
)
608 DEFINE_EVENT(btrfs_delayed_ref_head
, run_delayed_ref_head
,
610 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
611 struct btrfs_delayed_ref_head
*head_ref
,
614 TP_ARGS(ref
, head_ref
, action
)
617 #define show_chunk_type(type) \
618 __print_flags(type, "|", \
619 { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \
620 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
621 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
622 { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \
623 { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \
624 { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \
625 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
626 { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \
627 { BTRFS_BLOCK_GROUP_RAID6, "RAID6" })
629 DECLARE_EVENT_CLASS(btrfs__chunk
,
631 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
632 u64 offset
, u64 size
),
634 TP_ARGS(root
, map
, offset
, size
),
637 __field( int, num_stripes
)
639 __field( int, sub_stripes
)
640 __field( u64
, offset
)
642 __field( u64
, root_objectid
)
646 __entry
->num_stripes
= map
->num_stripes
;
647 __entry
->type
= map
->type
;
648 __entry
->sub_stripes
= map
->sub_stripes
;
649 __entry
->offset
= offset
;
650 __entry
->size
= size
;
651 __entry
->root_objectid
= root
->root_key
.objectid
;
654 TP_printk("root = %llu(%s), offset = %llu, size = %llu, "
655 "num_stripes = %d, sub_stripes = %d, type = %s",
656 show_root_type(__entry
->root_objectid
),
657 (unsigned long long)__entry
->offset
,
658 (unsigned long long)__entry
->size
,
659 __entry
->num_stripes
, __entry
->sub_stripes
,
660 show_chunk_type(__entry
->type
))
663 DEFINE_EVENT(btrfs__chunk
, btrfs_chunk_alloc
,
665 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
666 u64 offset
, u64 size
),
668 TP_ARGS(root
, map
, offset
, size
)
671 DEFINE_EVENT(btrfs__chunk
, btrfs_chunk_free
,
673 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
674 u64 offset
, u64 size
),
676 TP_ARGS(root
, map
, offset
, size
)
679 TRACE_EVENT(btrfs_cow_block
,
681 TP_PROTO(struct btrfs_root
*root
, struct extent_buffer
*buf
,
682 struct extent_buffer
*cow
),
684 TP_ARGS(root
, buf
, cow
),
687 __field( u64
, root_objectid
)
688 __field( u64
, buf_start
)
690 __field( u64
, cow_start
)
691 __field( int, buf_level
)
692 __field( int, cow_level
)
696 __entry
->root_objectid
= root
->root_key
.objectid
;
697 __entry
->buf_start
= buf
->start
;
698 __entry
->refs
= atomic_read(&buf
->refs
);
699 __entry
->cow_start
= cow
->start
;
700 __entry
->buf_level
= btrfs_header_level(buf
);
701 __entry
->cow_level
= btrfs_header_level(cow
);
704 TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu "
705 "(orig_level = %d), cow_buf = %llu (cow_level = %d)",
706 show_root_type(__entry
->root_objectid
),
708 (unsigned long long)__entry
->buf_start
,
710 (unsigned long long)__entry
->cow_start
,
714 TRACE_EVENT(btrfs_space_reservation
,
716 TP_PROTO(struct btrfs_fs_info
*fs_info
, char *type
, u64 val
,
717 u64 bytes
, int reserve
),
719 TP_ARGS(fs_info
, type
, val
, bytes
, reserve
),
722 __array( u8
, fsid
, BTRFS_UUID_SIZE
)
723 __string( type
, type
)
725 __field( u64
, bytes
)
726 __field( int, reserve
)
730 memcpy(__entry
->fsid
, fs_info
->fsid
, BTRFS_UUID_SIZE
);
731 __assign_str(type
, type
);
733 __entry
->bytes
= bytes
;
734 __entry
->reserve
= reserve
;
737 TP_printk("%pU: %s: %Lu %s %Lu", __entry
->fsid
, __get_str(type
),
738 __entry
->val
, __entry
->reserve
? "reserve" : "release",
742 DECLARE_EVENT_CLASS(btrfs__reserved_extent
,
744 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
746 TP_ARGS(root
, start
, len
),
749 __field( u64
, root_objectid
)
750 __field( u64
, start
)
755 __entry
->root_objectid
= root
->root_key
.objectid
;
756 __entry
->start
= start
;
760 TP_printk("root = %llu(%s), start = %llu, len = %llu",
761 show_root_type(__entry
->root_objectid
),
762 (unsigned long long)__entry
->start
,
763 (unsigned long long)__entry
->len
)
766 DEFINE_EVENT(btrfs__reserved_extent
, btrfs_reserved_extent_alloc
,
768 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
770 TP_ARGS(root
, start
, len
)
773 DEFINE_EVENT(btrfs__reserved_extent
, btrfs_reserved_extent_free
,
775 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
777 TP_ARGS(root
, start
, len
)
780 TRACE_EVENT(find_free_extent
,
782 TP_PROTO(struct btrfs_root
*root
, u64 num_bytes
, u64 empty_size
,
785 TP_ARGS(root
, num_bytes
, empty_size
, data
),
788 __field( u64
, root_objectid
)
789 __field( u64
, num_bytes
)
790 __field( u64
, empty_size
)
795 __entry
->root_objectid
= root
->root_key
.objectid
;
796 __entry
->num_bytes
= num_bytes
;
797 __entry
->empty_size
= empty_size
;
798 __entry
->data
= data
;
801 TP_printk("root = %Lu(%s), len = %Lu, empty_size = %Lu, "
802 "flags = %Lu(%s)", show_root_type(__entry
->root_objectid
),
803 __entry
->num_bytes
, __entry
->empty_size
, __entry
->data
,
804 __print_flags((unsigned long)__entry
->data
, "|",
808 DECLARE_EVENT_CLASS(btrfs__reserve_extent
,
810 TP_PROTO(struct btrfs_root
*root
,
811 struct btrfs_block_group_cache
*block_group
, u64 start
,
814 TP_ARGS(root
, block_group
, start
, len
),
817 __field( u64
, root_objectid
)
818 __field( u64
, bg_objectid
)
819 __field( u64
, flags
)
820 __field( u64
, start
)
825 __entry
->root_objectid
= root
->root_key
.objectid
;
826 __entry
->bg_objectid
= block_group
->key
.objectid
;
827 __entry
->flags
= block_group
->flags
;
828 __entry
->start
= start
;
832 TP_printk("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), "
833 "start = %Lu, len = %Lu",
834 show_root_type(__entry
->root_objectid
), __entry
->bg_objectid
,
835 __entry
->flags
, __print_flags((unsigned long)__entry
->flags
,
836 "|", BTRFS_GROUP_FLAGS
),
837 __entry
->start
, __entry
->len
)
840 DEFINE_EVENT(btrfs__reserve_extent
, btrfs_reserve_extent
,
842 TP_PROTO(struct btrfs_root
*root
,
843 struct btrfs_block_group_cache
*block_group
, u64 start
,
846 TP_ARGS(root
, block_group
, start
, len
)
849 DEFINE_EVENT(btrfs__reserve_extent
, btrfs_reserve_extent_cluster
,
851 TP_PROTO(struct btrfs_root
*root
,
852 struct btrfs_block_group_cache
*block_group
, u64 start
,
855 TP_ARGS(root
, block_group
, start
, len
)
858 TRACE_EVENT(btrfs_find_cluster
,
860 TP_PROTO(struct btrfs_block_group_cache
*block_group
, u64 start
,
861 u64 bytes
, u64 empty_size
, u64 min_bytes
),
863 TP_ARGS(block_group
, start
, bytes
, empty_size
, min_bytes
),
866 __field( u64
, bg_objectid
)
867 __field( u64
, flags
)
868 __field( u64
, start
)
869 __field( u64
, bytes
)
870 __field( u64
, empty_size
)
871 __field( u64
, min_bytes
)
875 __entry
->bg_objectid
= block_group
->key
.objectid
;
876 __entry
->flags
= block_group
->flags
;
877 __entry
->start
= start
;
878 __entry
->bytes
= bytes
;
879 __entry
->empty_size
= empty_size
;
880 __entry
->min_bytes
= min_bytes
;
883 TP_printk("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu,"
884 " empty_size = %Lu, min_bytes = %Lu", __entry
->bg_objectid
,
886 __print_flags((unsigned long)__entry
->flags
, "|",
887 BTRFS_GROUP_FLAGS
), __entry
->start
,
888 __entry
->bytes
, __entry
->empty_size
, __entry
->min_bytes
)
891 TRACE_EVENT(btrfs_failed_cluster_setup
,
893 TP_PROTO(struct btrfs_block_group_cache
*block_group
),
895 TP_ARGS(block_group
),
898 __field( u64
, bg_objectid
)
902 __entry
->bg_objectid
= block_group
->key
.objectid
;
905 TP_printk("block_group = %Lu", __entry
->bg_objectid
)
908 TRACE_EVENT(btrfs_setup_cluster
,
910 TP_PROTO(struct btrfs_block_group_cache
*block_group
,
911 struct btrfs_free_cluster
*cluster
, u64 size
, int bitmap
),
913 TP_ARGS(block_group
, cluster
, size
, bitmap
),
916 __field( u64
, bg_objectid
)
917 __field( u64
, flags
)
918 __field( u64
, start
)
919 __field( u64
, max_size
)
921 __field( int, bitmap
)
925 __entry
->bg_objectid
= block_group
->key
.objectid
;
926 __entry
->flags
= block_group
->flags
;
927 __entry
->start
= cluster
->window_start
;
928 __entry
->max_size
= cluster
->max_size
;
929 __entry
->size
= size
;
930 __entry
->bitmap
= bitmap
;
933 TP_printk("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, "
934 "size = %Lu, max_size = %Lu, bitmap = %d",
935 __entry
->bg_objectid
,
937 __print_flags((unsigned long)__entry
->flags
, "|",
938 BTRFS_GROUP_FLAGS
), __entry
->start
,
939 __entry
->size
, __entry
->max_size
, __entry
->bitmap
)
943 TRACE_EVENT(alloc_extent_state
,
945 TP_PROTO(struct extent_state
*state
, gfp_t mask
, unsigned long IP
),
947 TP_ARGS(state
, mask
, IP
),
950 __field(struct extent_state
*, state
)
952 __field(unsigned long, ip
)
956 __entry
->state
= state
,
957 __entry
->mask
= mask
,
961 TP_printk("state=%p; mask = %s; caller = %pF", __entry
->state
,
962 show_gfp_flags(__entry
->mask
), (void *)__entry
->ip
)
965 TRACE_EVENT(free_extent_state
,
967 TP_PROTO(struct extent_state
*state
, unsigned long IP
),
972 __field(struct extent_state
*, state
)
973 __field(unsigned long, ip
)
977 __entry
->state
= state
,
981 TP_printk(" state=%p; caller = %pF", __entry
->state
,
985 #endif /* _TRACE_BTRFS_H */
987 /* This part must be outside protection */
988 #include <trace/define_trace.h>