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_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \
44 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
46 #define show_root_type(obj) \
47 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
48 (obj <= BTRFS_CSUM_TREE_OBJECTID )) ? __show_root_type(obj) : "-"
50 #define BTRFS_GROUP_FLAGS \
51 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \
52 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
53 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
54 { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \
55 { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \
56 { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \
57 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}
59 #define BTRFS_UUID_SIZE 16
61 TRACE_EVENT(btrfs_transaction_commit
,
63 TP_PROTO(struct btrfs_root
*root
),
68 __field( u64
, generation
)
69 __field( u64
, root_objectid
)
73 __entry
->generation
= root
->fs_info
->generation
;
74 __entry
->root_objectid
= root
->root_key
.objectid
;
77 TP_printk("root = %llu(%s), gen = %llu",
78 show_root_type(__entry
->root_objectid
),
79 (unsigned long long)__entry
->generation
)
82 DECLARE_EVENT_CLASS(btrfs__inode
,
84 TP_PROTO(struct inode
*inode
),
90 __field( blkcnt_t
, blocks
)
91 __field( u64
, disk_i_size
)
92 __field( u64
, generation
)
93 __field( u64
, last_trans
)
94 __field( u64
, logged_trans
)
95 __field( u64
, root_objectid
)
99 __entry
->ino
= inode
->i_ino
;
100 __entry
->blocks
= inode
->i_blocks
;
101 __entry
->disk_i_size
= BTRFS_I(inode
)->disk_i_size
;
102 __entry
->generation
= BTRFS_I(inode
)->generation
;
103 __entry
->last_trans
= BTRFS_I(inode
)->last_trans
;
104 __entry
->logged_trans
= BTRFS_I(inode
)->logged_trans
;
105 __entry
->root_objectid
=
106 BTRFS_I(inode
)->root
->root_key
.objectid
;
109 TP_printk("root = %llu(%s), gen = %llu, ino = %lu, blocks = %llu, "
110 "disk_i_size = %llu, last_trans = %llu, logged_trans = %llu",
111 show_root_type(__entry
->root_objectid
),
112 (unsigned long long)__entry
->generation
,
113 (unsigned long)__entry
->ino
,
114 (unsigned long long)__entry
->blocks
,
115 (unsigned long long)__entry
->disk_i_size
,
116 (unsigned long long)__entry
->last_trans
,
117 (unsigned long long)__entry
->logged_trans
)
120 DEFINE_EVENT(btrfs__inode
, btrfs_inode_new
,
122 TP_PROTO(struct inode
*inode
),
127 DEFINE_EVENT(btrfs__inode
, btrfs_inode_request
,
129 TP_PROTO(struct inode
*inode
),
134 DEFINE_EVENT(btrfs__inode
, btrfs_inode_evict
,
136 TP_PROTO(struct inode
*inode
),
141 #define __show_map_type(type) \
142 __print_symbolic_u64(type, \
143 { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \
144 { EXTENT_MAP_HOLE, "HOLE" }, \
145 { EXTENT_MAP_INLINE, "INLINE" }, \
146 { EXTENT_MAP_DELALLOC, "DELALLOC" })
148 #define show_map_type(type) \
149 type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type)
151 #define show_map_flags(flag) \
152 __print_flags(flag, "|", \
153 { EXTENT_FLAG_PINNED, "PINNED" }, \
154 { EXTENT_FLAG_COMPRESSED, "COMPRESSED" }, \
155 { EXTENT_FLAG_VACANCY, "VACANCY" }, \
156 { EXTENT_FLAG_PREALLOC, "PREALLOC" })
158 TRACE_EVENT(btrfs_get_extent
,
160 TP_PROTO(struct btrfs_root
*root
, struct extent_map
*map
),
165 __field( u64
, root_objectid
)
166 __field( u64
, start
)
168 __field( u64
, orig_start
)
169 __field( u64
, block_start
)
170 __field( u64
, block_len
)
171 __field( unsigned long, flags
)
173 __field( unsigned int, compress_type
)
177 __entry
->root_objectid
= root
->root_key
.objectid
;
178 __entry
->start
= map
->start
;
179 __entry
->len
= map
->len
;
180 __entry
->orig_start
= map
->orig_start
;
181 __entry
->block_start
= map
->block_start
;
182 __entry
->block_len
= map
->block_len
;
183 __entry
->flags
= map
->flags
;
184 __entry
->refs
= atomic_read(&map
->refs
);
185 __entry
->compress_type
= map
->compress_type
;
188 TP_printk("root = %llu(%s), start = %llu, len = %llu, "
189 "orig_start = %llu, block_start = %llu(%s), "
190 "block_len = %llu, flags = %s, refs = %u, "
191 "compress_type = %u",
192 show_root_type(__entry
->root_objectid
),
193 (unsigned long long)__entry
->start
,
194 (unsigned long long)__entry
->len
,
195 (unsigned long long)__entry
->orig_start
,
196 show_map_type(__entry
->block_start
),
197 (unsigned long long)__entry
->block_len
,
198 show_map_flags(__entry
->flags
),
199 __entry
->refs
, __entry
->compress_type
)
202 #define show_ordered_flags(flags) \
203 __print_symbolic(flags, \
204 { BTRFS_ORDERED_IO_DONE, "IO_DONE" }, \
205 { BTRFS_ORDERED_COMPLETE, "COMPLETE" }, \
206 { BTRFS_ORDERED_NOCOW, "NOCOW" }, \
207 { BTRFS_ORDERED_COMPRESSED, "COMPRESSED" }, \
208 { BTRFS_ORDERED_PREALLOC, "PREALLOC" }, \
209 { BTRFS_ORDERED_DIRECT, "DIRECT" })
211 DECLARE_EVENT_CLASS(btrfs__ordered_extent
,
213 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
215 TP_ARGS(inode
, ordered
),
218 __field( ino_t
, ino
)
219 __field( u64
, file_offset
)
220 __field( u64
, start
)
222 __field( u64
, disk_len
)
223 __field( u64
, bytes_left
)
224 __field( unsigned long, flags
)
225 __field( int, compress_type
)
227 __field( u64
, root_objectid
)
231 __entry
->ino
= inode
->i_ino
;
232 __entry
->file_offset
= ordered
->file_offset
;
233 __entry
->start
= ordered
->start
;
234 __entry
->len
= ordered
->len
;
235 __entry
->disk_len
= ordered
->disk_len
;
236 __entry
->bytes_left
= ordered
->bytes_left
;
237 __entry
->flags
= ordered
->flags
;
238 __entry
->compress_type
= ordered
->compress_type
;
239 __entry
->refs
= atomic_read(&ordered
->refs
);
240 __entry
->root_objectid
=
241 BTRFS_I(inode
)->root
->root_key
.objectid
;
244 TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, "
245 "start = %llu, len = %llu, disk_len = %llu, "
246 "bytes_left = %llu, flags = %s, compress_type = %d, "
248 show_root_type(__entry
->root_objectid
),
249 (unsigned long long)__entry
->ino
,
250 (unsigned long long)__entry
->file_offset
,
251 (unsigned long long)__entry
->start
,
252 (unsigned long long)__entry
->len
,
253 (unsigned long long)__entry
->disk_len
,
254 (unsigned long long)__entry
->bytes_left
,
255 show_ordered_flags(__entry
->flags
),
256 __entry
->compress_type
, __entry
->refs
)
259 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_add
,
261 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
263 TP_ARGS(inode
, ordered
)
266 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_remove
,
268 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
270 TP_ARGS(inode
, ordered
)
273 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_start
,
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_put
,
282 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
284 TP_ARGS(inode
, ordered
)
287 DECLARE_EVENT_CLASS(btrfs__writepage
,
289 TP_PROTO(struct page
*page
, struct inode
*inode
,
290 struct writeback_control
*wbc
),
292 TP_ARGS(page
, inode
, wbc
),
295 __field( ino_t
, ino
)
296 __field( pgoff_t
, index
)
297 __field( long, nr_to_write
)
298 __field( long, pages_skipped
)
299 __field( loff_t
, range_start
)
300 __field( loff_t
, range_end
)
301 __field( char, for_kupdate
)
302 __field( char, for_reclaim
)
303 __field( char, range_cyclic
)
304 __field( pgoff_t
, writeback_index
)
305 __field( u64
, root_objectid
)
309 __entry
->ino
= inode
->i_ino
;
310 __entry
->index
= page
->index
;
311 __entry
->nr_to_write
= wbc
->nr_to_write
;
312 __entry
->pages_skipped
= wbc
->pages_skipped
;
313 __entry
->range_start
= wbc
->range_start
;
314 __entry
->range_end
= wbc
->range_end
;
315 __entry
->for_kupdate
= wbc
->for_kupdate
;
316 __entry
->for_reclaim
= wbc
->for_reclaim
;
317 __entry
->range_cyclic
= wbc
->range_cyclic
;
318 __entry
->writeback_index
= inode
->i_mapping
->writeback_index
;
319 __entry
->root_objectid
=
320 BTRFS_I(inode
)->root
->root_key
.objectid
;
323 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, "
324 "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, "
325 "range_end = %llu, for_kupdate = %d, "
326 "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu",
327 show_root_type(__entry
->root_objectid
),
328 (unsigned long)__entry
->ino
, __entry
->index
,
329 __entry
->nr_to_write
, __entry
->pages_skipped
,
330 __entry
->range_start
, __entry
->range_end
,
331 __entry
->for_kupdate
,
332 __entry
->for_reclaim
, __entry
->range_cyclic
,
333 (unsigned long)__entry
->writeback_index
)
336 DEFINE_EVENT(btrfs__writepage
, __extent_writepage
,
338 TP_PROTO(struct page
*page
, struct inode
*inode
,
339 struct writeback_control
*wbc
),
341 TP_ARGS(page
, inode
, wbc
)
344 TRACE_EVENT(btrfs_writepage_end_io_hook
,
346 TP_PROTO(struct page
*page
, u64 start
, u64 end
, int uptodate
),
348 TP_ARGS(page
, start
, end
, uptodate
),
351 __field( ino_t
, ino
)
352 __field( pgoff_t
, index
)
353 __field( u64
, start
)
355 __field( int, uptodate
)
356 __field( u64
, root_objectid
)
360 __entry
->ino
= page
->mapping
->host
->i_ino
;
361 __entry
->index
= page
->index
;
362 __entry
->start
= start
;
364 __entry
->uptodate
= uptodate
;
365 __entry
->root_objectid
=
366 BTRFS_I(page
->mapping
->host
)->root
->root_key
.objectid
;
369 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, "
370 "end = %llu, uptodate = %d",
371 show_root_type(__entry
->root_objectid
),
372 (unsigned long)__entry
->ino
, (unsigned long)__entry
->index
,
373 (unsigned long long)__entry
->start
,
374 (unsigned long long)__entry
->end
, __entry
->uptodate
)
377 TRACE_EVENT(btrfs_sync_file
,
379 TP_PROTO(struct file
*file
, int datasync
),
381 TP_ARGS(file
, datasync
),
384 __field( ino_t
, ino
)
385 __field( ino_t
, parent
)
386 __field( int, datasync
)
387 __field( u64
, root_objectid
)
391 struct dentry
*dentry
= file
->f_path
.dentry
;
392 struct inode
*inode
= dentry
->d_inode
;
394 __entry
->ino
= inode
->i_ino
;
395 __entry
->parent
= dentry
->d_parent
->d_inode
->i_ino
;
396 __entry
->datasync
= datasync
;
397 __entry
->root_objectid
=
398 BTRFS_I(inode
)->root
->root_key
.objectid
;
401 TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d",
402 show_root_type(__entry
->root_objectid
),
403 (unsigned long)__entry
->ino
, (unsigned long)__entry
->parent
,
407 TRACE_EVENT(btrfs_sync_fs
,
418 __entry
->wait
= wait
;
421 TP_printk("wait = %d", __entry
->wait
)
424 #define show_ref_action(action) \
425 __print_symbolic(action, \
426 { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \
427 { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \
428 { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \
429 { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
432 TRACE_EVENT(btrfs_delayed_tree_ref
,
434 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
435 struct btrfs_delayed_tree_ref
*full_ref
,
438 TP_ARGS(ref
, full_ref
, action
),
441 __field( u64
, bytenr
)
442 __field( u64
, num_bytes
)
443 __field( int, action
)
444 __field( u64
, parent
)
445 __field( u64
, ref_root
)
446 __field( int, level
)
451 __entry
->bytenr
= ref
->bytenr
;
452 __entry
->num_bytes
= ref
->num_bytes
;
453 __entry
->action
= action
;
454 __entry
->parent
= full_ref
->parent
;
455 __entry
->ref_root
= full_ref
->root
;
456 __entry
->level
= full_ref
->level
;
457 __entry
->type
= ref
->type
;
460 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
461 "parent = %llu(%s), ref_root = %llu(%s), level = %d, "
463 (unsigned long long)__entry
->bytenr
,
464 (unsigned long long)__entry
->num_bytes
,
465 show_ref_action(__entry
->action
),
466 show_root_type(__entry
->parent
),
467 show_root_type(__entry
->ref_root
),
468 __entry
->level
, show_ref_type(__entry
->type
))
471 TRACE_EVENT(btrfs_delayed_data_ref
,
473 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
474 struct btrfs_delayed_data_ref
*full_ref
,
477 TP_ARGS(ref
, full_ref
, action
),
480 __field( u64
, bytenr
)
481 __field( u64
, num_bytes
)
482 __field( int, action
)
483 __field( u64
, parent
)
484 __field( u64
, ref_root
)
485 __field( u64
, owner
)
486 __field( u64
, offset
)
491 __entry
->bytenr
= ref
->bytenr
;
492 __entry
->num_bytes
= ref
->num_bytes
;
493 __entry
->action
= action
;
494 __entry
->parent
= full_ref
->parent
;
495 __entry
->ref_root
= full_ref
->root
;
496 __entry
->owner
= full_ref
->objectid
;
497 __entry
->offset
= full_ref
->offset
;
498 __entry
->type
= ref
->type
;
501 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
502 "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, "
503 "offset = %llu, type = %s",
504 (unsigned long long)__entry
->bytenr
,
505 (unsigned long long)__entry
->num_bytes
,
506 show_ref_action(__entry
->action
),
507 show_root_type(__entry
->parent
),
508 show_root_type(__entry
->ref_root
),
509 (unsigned long long)__entry
->owner
,
510 (unsigned long long)__entry
->offset
,
511 show_ref_type(__entry
->type
))
514 TRACE_EVENT(btrfs_delayed_ref_head
,
516 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
517 struct btrfs_delayed_ref_head
*head_ref
,
520 TP_ARGS(ref
, head_ref
, action
),
523 __field( u64
, bytenr
)
524 __field( u64
, num_bytes
)
525 __field( int, action
)
526 __field( int, is_data
)
530 __entry
->bytenr
= ref
->bytenr
;
531 __entry
->num_bytes
= ref
->num_bytes
;
532 __entry
->action
= action
;
533 __entry
->is_data
= head_ref
->is_data
;
536 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d",
537 (unsigned long long)__entry
->bytenr
,
538 (unsigned long long)__entry
->num_bytes
,
539 show_ref_action(__entry
->action
),
543 #define show_chunk_type(type) \
544 __print_flags(type, "|", \
545 { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \
546 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
547 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
548 { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \
549 { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \
550 { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \
551 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"})
553 DECLARE_EVENT_CLASS(btrfs__chunk
,
555 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
556 u64 offset
, u64 size
),
558 TP_ARGS(root
, map
, offset
, size
),
561 __field( int, num_stripes
)
563 __field( int, sub_stripes
)
564 __field( u64
, offset
)
566 __field( u64
, root_objectid
)
570 __entry
->num_stripes
= map
->num_stripes
;
571 __entry
->type
= map
->type
;
572 __entry
->sub_stripes
= map
->sub_stripes
;
573 __entry
->offset
= offset
;
574 __entry
->size
= size
;
575 __entry
->root_objectid
= root
->root_key
.objectid
;
578 TP_printk("root = %llu(%s), offset = %llu, size = %llu, "
579 "num_stripes = %d, sub_stripes = %d, type = %s",
580 show_root_type(__entry
->root_objectid
),
581 (unsigned long long)__entry
->offset
,
582 (unsigned long long)__entry
->size
,
583 __entry
->num_stripes
, __entry
->sub_stripes
,
584 show_chunk_type(__entry
->type
))
587 DEFINE_EVENT(btrfs__chunk
, btrfs_chunk_alloc
,
589 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
590 u64 offset
, u64 size
),
592 TP_ARGS(root
, map
, offset
, size
)
595 DEFINE_EVENT(btrfs__chunk
, btrfs_chunk_free
,
597 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
598 u64 offset
, u64 size
),
600 TP_ARGS(root
, map
, offset
, size
)
603 TRACE_EVENT(btrfs_cow_block
,
605 TP_PROTO(struct btrfs_root
*root
, struct extent_buffer
*buf
,
606 struct extent_buffer
*cow
),
608 TP_ARGS(root
, buf
, cow
),
611 __field( u64
, root_objectid
)
612 __field( u64
, buf_start
)
614 __field( u64
, cow_start
)
615 __field( int, buf_level
)
616 __field( int, cow_level
)
620 __entry
->root_objectid
= root
->root_key
.objectid
;
621 __entry
->buf_start
= buf
->start
;
622 __entry
->refs
= atomic_read(&buf
->refs
);
623 __entry
->cow_start
= cow
->start
;
624 __entry
->buf_level
= btrfs_header_level(buf
);
625 __entry
->cow_level
= btrfs_header_level(cow
);
628 TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu "
629 "(orig_level = %d), cow_buf = %llu (cow_level = %d)",
630 show_root_type(__entry
->root_objectid
),
632 (unsigned long long)__entry
->buf_start
,
634 (unsigned long long)__entry
->cow_start
,
638 TRACE_EVENT(btrfs_space_reservation
,
640 TP_PROTO(struct btrfs_fs_info
*fs_info
, char *type
, u64 val
,
641 u64 bytes
, int reserve
),
643 TP_ARGS(fs_info
, type
, val
, bytes
, reserve
),
646 __array( u8
, fsid
, BTRFS_UUID_SIZE
)
647 __string( type
, type
)
649 __field( u64
, bytes
)
650 __field( int, reserve
)
654 memcpy(__entry
->fsid
, fs_info
->fsid
, BTRFS_UUID_SIZE
);
655 __assign_str(type
, type
);
657 __entry
->bytes
= bytes
;
658 __entry
->reserve
= reserve
;
661 TP_printk("%pU: %s: %Lu %s %Lu", __entry
->fsid
, __get_str(type
),
662 __entry
->val
, __entry
->reserve
? "reserve" : "release",
666 DECLARE_EVENT_CLASS(btrfs__reserved_extent
,
668 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
670 TP_ARGS(root
, start
, len
),
673 __field( u64
, root_objectid
)
674 __field( u64
, start
)
679 __entry
->root_objectid
= root
->root_key
.objectid
;
680 __entry
->start
= start
;
684 TP_printk("root = %llu(%s), start = %llu, len = %llu",
685 show_root_type(__entry
->root_objectid
),
686 (unsigned long long)__entry
->start
,
687 (unsigned long long)__entry
->len
)
690 DEFINE_EVENT(btrfs__reserved_extent
, btrfs_reserved_extent_alloc
,
692 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
694 TP_ARGS(root
, start
, len
)
697 DEFINE_EVENT(btrfs__reserved_extent
, btrfs_reserved_extent_free
,
699 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
701 TP_ARGS(root
, start
, len
)
704 TRACE_EVENT(find_free_extent
,
706 TP_PROTO(struct btrfs_root
*root
, u64 num_bytes
, u64 empty_size
,
709 TP_ARGS(root
, num_bytes
, empty_size
, data
),
712 __field( u64
, root_objectid
)
713 __field( u64
, num_bytes
)
714 __field( u64
, empty_size
)
719 __entry
->root_objectid
= root
->root_key
.objectid
;
720 __entry
->num_bytes
= num_bytes
;
721 __entry
->empty_size
= empty_size
;
722 __entry
->data
= data
;
725 TP_printk("root = %Lu(%s), len = %Lu, empty_size = %Lu, "
726 "flags = %Lu(%s)", show_root_type(__entry
->root_objectid
),
727 __entry
->num_bytes
, __entry
->empty_size
, __entry
->data
,
728 __print_flags((unsigned long)__entry
->data
, "|",
732 DECLARE_EVENT_CLASS(btrfs__reserve_extent
,
734 TP_PROTO(struct btrfs_root
*root
,
735 struct btrfs_block_group_cache
*block_group
, u64 start
,
738 TP_ARGS(root
, block_group
, start
, len
),
741 __field( u64
, root_objectid
)
742 __field( u64
, bg_objectid
)
743 __field( u64
, flags
)
744 __field( u64
, start
)
749 __entry
->root_objectid
= root
->root_key
.objectid
;
750 __entry
->bg_objectid
= block_group
->key
.objectid
;
751 __entry
->flags
= block_group
->flags
;
752 __entry
->start
= start
;
756 TP_printk("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), "
757 "start = %Lu, len = %Lu",
758 show_root_type(__entry
->root_objectid
), __entry
->bg_objectid
,
759 __entry
->flags
, __print_flags((unsigned long)__entry
->flags
,
760 "|", BTRFS_GROUP_FLAGS
),
761 __entry
->start
, __entry
->len
)
764 DEFINE_EVENT(btrfs__reserve_extent
, btrfs_reserve_extent
,
766 TP_PROTO(struct btrfs_root
*root
,
767 struct btrfs_block_group_cache
*block_group
, u64 start
,
770 TP_ARGS(root
, block_group
, start
, len
)
773 DEFINE_EVENT(btrfs__reserve_extent
, btrfs_reserve_extent_cluster
,
775 TP_PROTO(struct btrfs_root
*root
,
776 struct btrfs_block_group_cache
*block_group
, u64 start
,
779 TP_ARGS(root
, block_group
, start
, len
)
782 TRACE_EVENT(btrfs_find_cluster
,
784 TP_PROTO(struct btrfs_block_group_cache
*block_group
, u64 start
,
785 u64 bytes
, u64 empty_size
, u64 min_bytes
),
787 TP_ARGS(block_group
, start
, bytes
, empty_size
, min_bytes
),
790 __field( u64
, bg_objectid
)
791 __field( u64
, flags
)
792 __field( u64
, start
)
793 __field( u64
, bytes
)
794 __field( u64
, empty_size
)
795 __field( u64
, min_bytes
)
799 __entry
->bg_objectid
= block_group
->key
.objectid
;
800 __entry
->flags
= block_group
->flags
;
801 __entry
->start
= start
;
802 __entry
->bytes
= bytes
;
803 __entry
->empty_size
= empty_size
;
804 __entry
->min_bytes
= min_bytes
;
807 TP_printk("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu,"
808 " empty_size = %Lu, min_bytes = %Lu", __entry
->bg_objectid
,
810 __print_flags((unsigned long)__entry
->flags
, "|",
811 BTRFS_GROUP_FLAGS
), __entry
->start
,
812 __entry
->bytes
, __entry
->empty_size
, __entry
->min_bytes
)
815 TRACE_EVENT(btrfs_failed_cluster_setup
,
817 TP_PROTO(struct btrfs_block_group_cache
*block_group
),
819 TP_ARGS(block_group
),
822 __field( u64
, bg_objectid
)
826 __entry
->bg_objectid
= block_group
->key
.objectid
;
829 TP_printk("block_group = %Lu", __entry
->bg_objectid
)
832 TRACE_EVENT(btrfs_setup_cluster
,
834 TP_PROTO(struct btrfs_block_group_cache
*block_group
,
835 struct btrfs_free_cluster
*cluster
, u64 size
, int bitmap
),
837 TP_ARGS(block_group
, cluster
, size
, bitmap
),
840 __field( u64
, bg_objectid
)
841 __field( u64
, flags
)
842 __field( u64
, start
)
843 __field( u64
, max_size
)
845 __field( int, bitmap
)
849 __entry
->bg_objectid
= block_group
->key
.objectid
;
850 __entry
->flags
= block_group
->flags
;
851 __entry
->start
= cluster
->window_start
;
852 __entry
->max_size
= cluster
->max_size
;
853 __entry
->size
= size
;
854 __entry
->bitmap
= bitmap
;
857 TP_printk("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, "
858 "size = %Lu, max_size = %Lu, bitmap = %d",
859 __entry
->bg_objectid
,
861 __print_flags((unsigned long)__entry
->flags
, "|",
862 BTRFS_GROUP_FLAGS
), __entry
->start
,
863 __entry
->size
, __entry
->max_size
, __entry
->bitmap
)
867 TRACE_EVENT(alloc_extent_state
,
869 TP_PROTO(struct extent_state
*state
, gfp_t mask
, unsigned long IP
),
871 TP_ARGS(state
, mask
, IP
),
874 __field(struct extent_state
*, state
)
876 __field(unsigned long, ip
)
880 __entry
->state
= state
,
881 __entry
->mask
= mask
,
885 TP_printk("state=%p; mask = %s; caller = %pF", __entry
->state
,
886 show_gfp_flags(__entry
->mask
), (void *)__entry
->ip
)
889 TRACE_EVENT(free_extent_state
,
891 TP_PROTO(struct extent_state
*state
, unsigned long IP
),
896 __field(struct extent_state
*, state
)
897 __field(unsigned long, ip
)
901 __entry
->state
= state
,
905 TP_printk(" state=%p; caller = %pF", __entry
->state
,
909 #endif /* _TRACE_BTRFS_H */
911 /* This part must be outside protection */
912 #include <trace/define_trace.h>