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(btrfs_get_extent
,
167 TP_PROTO(struct btrfs_root
*root
, struct extent_map
*map
),
172 __field( u64
, root_objectid
)
173 __field( u64
, start
)
175 __field( u64
, orig_start
)
176 __field( u64
, block_start
)
177 __field( u64
, block_len
)
178 __field( unsigned long, flags
)
180 __field( unsigned int, compress_type
)
184 __entry
->root_objectid
= root
->root_key
.objectid
;
185 __entry
->start
= map
->start
;
186 __entry
->len
= map
->len
;
187 __entry
->orig_start
= map
->orig_start
;
188 __entry
->block_start
= map
->block_start
;
189 __entry
->block_len
= map
->block_len
;
190 __entry
->flags
= map
->flags
;
191 __entry
->refs
= atomic_read(&map
->refs
);
192 __entry
->compress_type
= map
->compress_type
;
195 TP_printk("root = %llu(%s), start = %llu, len = %llu, "
196 "orig_start = %llu, block_start = %llu(%s), "
197 "block_len = %llu, flags = %s, refs = %u, "
198 "compress_type = %u",
199 show_root_type(__entry
->root_objectid
),
200 (unsigned long long)__entry
->start
,
201 (unsigned long long)__entry
->len
,
202 (unsigned long long)__entry
->orig_start
,
203 show_map_type(__entry
->block_start
),
204 (unsigned long long)__entry
->block_len
,
205 show_map_flags(__entry
->flags
),
206 __entry
->refs
, __entry
->compress_type
)
209 #define show_ordered_flags(flags) \
210 __print_symbolic(flags, \
211 { BTRFS_ORDERED_IO_DONE, "IO_DONE" }, \
212 { BTRFS_ORDERED_COMPLETE, "COMPLETE" }, \
213 { BTRFS_ORDERED_NOCOW, "NOCOW" }, \
214 { BTRFS_ORDERED_COMPRESSED, "COMPRESSED" }, \
215 { BTRFS_ORDERED_PREALLOC, "PREALLOC" }, \
216 { BTRFS_ORDERED_DIRECT, "DIRECT" }, \
217 { BTRFS_ORDERED_IOERR, "IOERR" }, \
218 { BTRFS_ORDERED_UPDATED_ISIZE, "UPDATED_ISIZE" }, \
219 { BTRFS_ORDERED_LOGGED_CSUM, "LOGGED_CSUM" })
222 DECLARE_EVENT_CLASS(btrfs__ordered_extent
,
224 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
226 TP_ARGS(inode
, ordered
),
229 __field( ino_t
, ino
)
230 __field( u64
, file_offset
)
231 __field( u64
, start
)
233 __field( u64
, disk_len
)
234 __field( u64
, bytes_left
)
235 __field( unsigned long, flags
)
236 __field( int, compress_type
)
238 __field( u64
, root_objectid
)
242 __entry
->ino
= inode
->i_ino
;
243 __entry
->file_offset
= ordered
->file_offset
;
244 __entry
->start
= ordered
->start
;
245 __entry
->len
= ordered
->len
;
246 __entry
->disk_len
= ordered
->disk_len
;
247 __entry
->bytes_left
= ordered
->bytes_left
;
248 __entry
->flags
= ordered
->flags
;
249 __entry
->compress_type
= ordered
->compress_type
;
250 __entry
->refs
= atomic_read(&ordered
->refs
);
251 __entry
->root_objectid
=
252 BTRFS_I(inode
)->root
->root_key
.objectid
;
255 TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, "
256 "start = %llu, len = %llu, disk_len = %llu, "
257 "bytes_left = %llu, flags = %s, compress_type = %d, "
259 show_root_type(__entry
->root_objectid
),
260 (unsigned long long)__entry
->ino
,
261 (unsigned long long)__entry
->file_offset
,
262 (unsigned long long)__entry
->start
,
263 (unsigned long long)__entry
->len
,
264 (unsigned long long)__entry
->disk_len
,
265 (unsigned long long)__entry
->bytes_left
,
266 show_ordered_flags(__entry
->flags
),
267 __entry
->compress_type
, __entry
->refs
)
270 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_add
,
272 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
274 TP_ARGS(inode
, ordered
)
277 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_remove
,
279 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
281 TP_ARGS(inode
, ordered
)
284 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_start
,
286 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
288 TP_ARGS(inode
, ordered
)
291 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_put
,
293 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
295 TP_ARGS(inode
, ordered
)
298 DECLARE_EVENT_CLASS(btrfs__writepage
,
300 TP_PROTO(struct page
*page
, struct inode
*inode
,
301 struct writeback_control
*wbc
),
303 TP_ARGS(page
, inode
, wbc
),
306 __field( ino_t
, ino
)
307 __field( pgoff_t
, index
)
308 __field( long, nr_to_write
)
309 __field( long, pages_skipped
)
310 __field( loff_t
, range_start
)
311 __field( loff_t
, range_end
)
312 __field( char, for_kupdate
)
313 __field( char, for_reclaim
)
314 __field( char, range_cyclic
)
315 __field( pgoff_t
, writeback_index
)
316 __field( u64
, root_objectid
)
320 __entry
->ino
= inode
->i_ino
;
321 __entry
->index
= page
->index
;
322 __entry
->nr_to_write
= wbc
->nr_to_write
;
323 __entry
->pages_skipped
= wbc
->pages_skipped
;
324 __entry
->range_start
= wbc
->range_start
;
325 __entry
->range_end
= wbc
->range_end
;
326 __entry
->for_kupdate
= wbc
->for_kupdate
;
327 __entry
->for_reclaim
= wbc
->for_reclaim
;
328 __entry
->range_cyclic
= wbc
->range_cyclic
;
329 __entry
->writeback_index
= inode
->i_mapping
->writeback_index
;
330 __entry
->root_objectid
=
331 BTRFS_I(inode
)->root
->root_key
.objectid
;
334 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, "
335 "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, "
336 "range_end = %llu, for_kupdate = %d, "
337 "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu",
338 show_root_type(__entry
->root_objectid
),
339 (unsigned long)__entry
->ino
, __entry
->index
,
340 __entry
->nr_to_write
, __entry
->pages_skipped
,
341 __entry
->range_start
, __entry
->range_end
,
342 __entry
->for_kupdate
,
343 __entry
->for_reclaim
, __entry
->range_cyclic
,
344 (unsigned long)__entry
->writeback_index
)
347 DEFINE_EVENT(btrfs__writepage
, __extent_writepage
,
349 TP_PROTO(struct page
*page
, struct inode
*inode
,
350 struct writeback_control
*wbc
),
352 TP_ARGS(page
, inode
, wbc
)
355 TRACE_EVENT(btrfs_writepage_end_io_hook
,
357 TP_PROTO(struct page
*page
, u64 start
, u64 end
, int uptodate
),
359 TP_ARGS(page
, start
, end
, uptodate
),
362 __field( ino_t
, ino
)
363 __field( pgoff_t
, index
)
364 __field( u64
, start
)
366 __field( int, uptodate
)
367 __field( u64
, root_objectid
)
371 __entry
->ino
= page
->mapping
->host
->i_ino
;
372 __entry
->index
= page
->index
;
373 __entry
->start
= start
;
375 __entry
->uptodate
= uptodate
;
376 __entry
->root_objectid
=
377 BTRFS_I(page
->mapping
->host
)->root
->root_key
.objectid
;
380 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, "
381 "end = %llu, uptodate = %d",
382 show_root_type(__entry
->root_objectid
),
383 (unsigned long)__entry
->ino
, (unsigned long)__entry
->index
,
384 (unsigned long long)__entry
->start
,
385 (unsigned long long)__entry
->end
, __entry
->uptodate
)
388 TRACE_EVENT(btrfs_sync_file
,
390 TP_PROTO(struct file
*file
, int datasync
),
392 TP_ARGS(file
, datasync
),
395 __field( ino_t
, ino
)
396 __field( ino_t
, parent
)
397 __field( int, datasync
)
398 __field( u64
, root_objectid
)
402 struct dentry
*dentry
= file
->f_path
.dentry
;
403 struct inode
*inode
= dentry
->d_inode
;
405 __entry
->ino
= inode
->i_ino
;
406 __entry
->parent
= dentry
->d_parent
->d_inode
->i_ino
;
407 __entry
->datasync
= datasync
;
408 __entry
->root_objectid
=
409 BTRFS_I(inode
)->root
->root_key
.objectid
;
412 TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d",
413 show_root_type(__entry
->root_objectid
),
414 (unsigned long)__entry
->ino
, (unsigned long)__entry
->parent
,
418 TRACE_EVENT(btrfs_sync_fs
,
429 __entry
->wait
= wait
;
432 TP_printk("wait = %d", __entry
->wait
)
435 #define show_ref_action(action) \
436 __print_symbolic(action, \
437 { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \
438 { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \
439 { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \
440 { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
443 DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref
,
445 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
446 struct btrfs_delayed_tree_ref
*full_ref
,
449 TP_ARGS(ref
, full_ref
, action
),
452 __field( u64
, bytenr
)
453 __field( u64
, num_bytes
)
454 __field( int, action
)
455 __field( u64
, parent
)
456 __field( u64
, ref_root
)
457 __field( int, level
)
463 __entry
->bytenr
= ref
->bytenr
;
464 __entry
->num_bytes
= ref
->num_bytes
;
465 __entry
->action
= action
;
466 __entry
->parent
= full_ref
->parent
;
467 __entry
->ref_root
= full_ref
->root
;
468 __entry
->level
= full_ref
->level
;
469 __entry
->type
= ref
->type
;
470 __entry
->seq
= ref
->seq
;
473 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
474 "parent = %llu(%s), ref_root = %llu(%s), level = %d, "
475 "type = %s, seq = %llu",
476 (unsigned long long)__entry
->bytenr
,
477 (unsigned long long)__entry
->num_bytes
,
478 show_ref_action(__entry
->action
),
479 show_root_type(__entry
->parent
),
480 show_root_type(__entry
->ref_root
),
481 __entry
->level
, show_ref_type(__entry
->type
),
482 (unsigned long long)__entry
->seq
)
485 DEFINE_EVENT(btrfs_delayed_tree_ref
, add_delayed_tree_ref
,
487 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
488 struct btrfs_delayed_tree_ref
*full_ref
,
491 TP_ARGS(ref
, full_ref
, action
)
494 DEFINE_EVENT(btrfs_delayed_tree_ref
, run_delayed_tree_ref
,
496 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
497 struct btrfs_delayed_tree_ref
*full_ref
,
500 TP_ARGS(ref
, full_ref
, action
)
503 DECLARE_EVENT_CLASS(btrfs_delayed_data_ref
,
505 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
506 struct btrfs_delayed_data_ref
*full_ref
,
509 TP_ARGS(ref
, full_ref
, action
),
512 __field( u64
, bytenr
)
513 __field( u64
, num_bytes
)
514 __field( int, action
)
515 __field( u64
, parent
)
516 __field( u64
, ref_root
)
517 __field( u64
, owner
)
518 __field( u64
, offset
)
524 __entry
->bytenr
= ref
->bytenr
;
525 __entry
->num_bytes
= ref
->num_bytes
;
526 __entry
->action
= action
;
527 __entry
->parent
= full_ref
->parent
;
528 __entry
->ref_root
= full_ref
->root
;
529 __entry
->owner
= full_ref
->objectid
;
530 __entry
->offset
= full_ref
->offset
;
531 __entry
->type
= ref
->type
;
532 __entry
->seq
= ref
->seq
;
535 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
536 "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, "
537 "offset = %llu, type = %s, seq = %llu",
538 (unsigned long long)__entry
->bytenr
,
539 (unsigned long long)__entry
->num_bytes
,
540 show_ref_action(__entry
->action
),
541 show_root_type(__entry
->parent
),
542 show_root_type(__entry
->ref_root
),
543 (unsigned long long)__entry
->owner
,
544 (unsigned long long)__entry
->offset
,
545 show_ref_type(__entry
->type
),
546 (unsigned long long)__entry
->seq
)
549 DEFINE_EVENT(btrfs_delayed_data_ref
, add_delayed_data_ref
,
551 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
552 struct btrfs_delayed_data_ref
*full_ref
,
555 TP_ARGS(ref
, full_ref
, action
)
558 DEFINE_EVENT(btrfs_delayed_data_ref
, run_delayed_data_ref
,
560 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
561 struct btrfs_delayed_data_ref
*full_ref
,
564 TP_ARGS(ref
, full_ref
, action
)
567 DECLARE_EVENT_CLASS(btrfs_delayed_ref_head
,
569 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
570 struct btrfs_delayed_ref_head
*head_ref
,
573 TP_ARGS(ref
, head_ref
, action
),
576 __field( u64
, bytenr
)
577 __field( u64
, num_bytes
)
578 __field( int, action
)
579 __field( int, is_data
)
583 __entry
->bytenr
= ref
->bytenr
;
584 __entry
->num_bytes
= ref
->num_bytes
;
585 __entry
->action
= action
;
586 __entry
->is_data
= head_ref
->is_data
;
589 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d",
590 (unsigned long long)__entry
->bytenr
,
591 (unsigned long long)__entry
->num_bytes
,
592 show_ref_action(__entry
->action
),
596 DEFINE_EVENT(btrfs_delayed_ref_head
, add_delayed_ref_head
,
598 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
599 struct btrfs_delayed_ref_head
*head_ref
,
602 TP_ARGS(ref
, head_ref
, action
)
605 DEFINE_EVENT(btrfs_delayed_ref_head
, run_delayed_ref_head
,
607 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
608 struct btrfs_delayed_ref_head
*head_ref
,
611 TP_ARGS(ref
, head_ref
, action
)
614 #define show_chunk_type(type) \
615 __print_flags(type, "|", \
616 { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \
617 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
618 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
619 { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \
620 { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \
621 { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \
622 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
623 { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \
624 { BTRFS_BLOCK_GROUP_RAID6, "RAID6" })
626 DECLARE_EVENT_CLASS(btrfs__chunk
,
628 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
629 u64 offset
, u64 size
),
631 TP_ARGS(root
, map
, offset
, size
),
634 __field( int, num_stripes
)
636 __field( int, sub_stripes
)
637 __field( u64
, offset
)
639 __field( u64
, root_objectid
)
643 __entry
->num_stripes
= map
->num_stripes
;
644 __entry
->type
= map
->type
;
645 __entry
->sub_stripes
= map
->sub_stripes
;
646 __entry
->offset
= offset
;
647 __entry
->size
= size
;
648 __entry
->root_objectid
= root
->root_key
.objectid
;
651 TP_printk("root = %llu(%s), offset = %llu, size = %llu, "
652 "num_stripes = %d, sub_stripes = %d, type = %s",
653 show_root_type(__entry
->root_objectid
),
654 (unsigned long long)__entry
->offset
,
655 (unsigned long long)__entry
->size
,
656 __entry
->num_stripes
, __entry
->sub_stripes
,
657 show_chunk_type(__entry
->type
))
660 DEFINE_EVENT(btrfs__chunk
, btrfs_chunk_alloc
,
662 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
663 u64 offset
, u64 size
),
665 TP_ARGS(root
, map
, offset
, size
)
668 DEFINE_EVENT(btrfs__chunk
, btrfs_chunk_free
,
670 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
671 u64 offset
, u64 size
),
673 TP_ARGS(root
, map
, offset
, size
)
676 TRACE_EVENT(btrfs_cow_block
,
678 TP_PROTO(struct btrfs_root
*root
, struct extent_buffer
*buf
,
679 struct extent_buffer
*cow
),
681 TP_ARGS(root
, buf
, cow
),
684 __field( u64
, root_objectid
)
685 __field( u64
, buf_start
)
687 __field( u64
, cow_start
)
688 __field( int, buf_level
)
689 __field( int, cow_level
)
693 __entry
->root_objectid
= root
->root_key
.objectid
;
694 __entry
->buf_start
= buf
->start
;
695 __entry
->refs
= atomic_read(&buf
->refs
);
696 __entry
->cow_start
= cow
->start
;
697 __entry
->buf_level
= btrfs_header_level(buf
);
698 __entry
->cow_level
= btrfs_header_level(cow
);
701 TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu "
702 "(orig_level = %d), cow_buf = %llu (cow_level = %d)",
703 show_root_type(__entry
->root_objectid
),
705 (unsigned long long)__entry
->buf_start
,
707 (unsigned long long)__entry
->cow_start
,
711 TRACE_EVENT(btrfs_space_reservation
,
713 TP_PROTO(struct btrfs_fs_info
*fs_info
, char *type
, u64 val
,
714 u64 bytes
, int reserve
),
716 TP_ARGS(fs_info
, type
, val
, bytes
, reserve
),
719 __array( u8
, fsid
, BTRFS_UUID_SIZE
)
720 __string( type
, type
)
722 __field( u64
, bytes
)
723 __field( int, reserve
)
727 memcpy(__entry
->fsid
, fs_info
->fsid
, BTRFS_UUID_SIZE
);
728 __assign_str(type
, type
);
730 __entry
->bytes
= bytes
;
731 __entry
->reserve
= reserve
;
734 TP_printk("%pU: %s: %Lu %s %Lu", __entry
->fsid
, __get_str(type
),
735 __entry
->val
, __entry
->reserve
? "reserve" : "release",
739 DECLARE_EVENT_CLASS(btrfs__reserved_extent
,
741 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
743 TP_ARGS(root
, start
, len
),
746 __field( u64
, root_objectid
)
747 __field( u64
, start
)
752 __entry
->root_objectid
= root
->root_key
.objectid
;
753 __entry
->start
= start
;
757 TP_printk("root = %llu(%s), start = %llu, len = %llu",
758 show_root_type(__entry
->root_objectid
),
759 (unsigned long long)__entry
->start
,
760 (unsigned long long)__entry
->len
)
763 DEFINE_EVENT(btrfs__reserved_extent
, btrfs_reserved_extent_alloc
,
765 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
767 TP_ARGS(root
, start
, len
)
770 DEFINE_EVENT(btrfs__reserved_extent
, btrfs_reserved_extent_free
,
772 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
774 TP_ARGS(root
, start
, len
)
777 TRACE_EVENT(find_free_extent
,
779 TP_PROTO(struct btrfs_root
*root
, u64 num_bytes
, u64 empty_size
,
782 TP_ARGS(root
, num_bytes
, empty_size
, data
),
785 __field( u64
, root_objectid
)
786 __field( u64
, num_bytes
)
787 __field( u64
, empty_size
)
792 __entry
->root_objectid
= root
->root_key
.objectid
;
793 __entry
->num_bytes
= num_bytes
;
794 __entry
->empty_size
= empty_size
;
795 __entry
->data
= data
;
798 TP_printk("root = %Lu(%s), len = %Lu, empty_size = %Lu, "
799 "flags = %Lu(%s)", show_root_type(__entry
->root_objectid
),
800 __entry
->num_bytes
, __entry
->empty_size
, __entry
->data
,
801 __print_flags((unsigned long)__entry
->data
, "|",
805 DECLARE_EVENT_CLASS(btrfs__reserve_extent
,
807 TP_PROTO(struct btrfs_root
*root
,
808 struct btrfs_block_group_cache
*block_group
, u64 start
,
811 TP_ARGS(root
, block_group
, start
, len
),
814 __field( u64
, root_objectid
)
815 __field( u64
, bg_objectid
)
816 __field( u64
, flags
)
817 __field( u64
, start
)
822 __entry
->root_objectid
= root
->root_key
.objectid
;
823 __entry
->bg_objectid
= block_group
->key
.objectid
;
824 __entry
->flags
= block_group
->flags
;
825 __entry
->start
= start
;
829 TP_printk("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), "
830 "start = %Lu, len = %Lu",
831 show_root_type(__entry
->root_objectid
), __entry
->bg_objectid
,
832 __entry
->flags
, __print_flags((unsigned long)__entry
->flags
,
833 "|", BTRFS_GROUP_FLAGS
),
834 __entry
->start
, __entry
->len
)
837 DEFINE_EVENT(btrfs__reserve_extent
, btrfs_reserve_extent
,
839 TP_PROTO(struct btrfs_root
*root
,
840 struct btrfs_block_group_cache
*block_group
, u64 start
,
843 TP_ARGS(root
, block_group
, start
, len
)
846 DEFINE_EVENT(btrfs__reserve_extent
, btrfs_reserve_extent_cluster
,
848 TP_PROTO(struct btrfs_root
*root
,
849 struct btrfs_block_group_cache
*block_group
, u64 start
,
852 TP_ARGS(root
, block_group
, start
, len
)
855 TRACE_EVENT(btrfs_find_cluster
,
857 TP_PROTO(struct btrfs_block_group_cache
*block_group
, u64 start
,
858 u64 bytes
, u64 empty_size
, u64 min_bytes
),
860 TP_ARGS(block_group
, start
, bytes
, empty_size
, min_bytes
),
863 __field( u64
, bg_objectid
)
864 __field( u64
, flags
)
865 __field( u64
, start
)
866 __field( u64
, bytes
)
867 __field( u64
, empty_size
)
868 __field( u64
, min_bytes
)
872 __entry
->bg_objectid
= block_group
->key
.objectid
;
873 __entry
->flags
= block_group
->flags
;
874 __entry
->start
= start
;
875 __entry
->bytes
= bytes
;
876 __entry
->empty_size
= empty_size
;
877 __entry
->min_bytes
= min_bytes
;
880 TP_printk("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu,"
881 " empty_size = %Lu, min_bytes = %Lu", __entry
->bg_objectid
,
883 __print_flags((unsigned long)__entry
->flags
, "|",
884 BTRFS_GROUP_FLAGS
), __entry
->start
,
885 __entry
->bytes
, __entry
->empty_size
, __entry
->min_bytes
)
888 TRACE_EVENT(btrfs_failed_cluster_setup
,
890 TP_PROTO(struct btrfs_block_group_cache
*block_group
),
892 TP_ARGS(block_group
),
895 __field( u64
, bg_objectid
)
899 __entry
->bg_objectid
= block_group
->key
.objectid
;
902 TP_printk("block_group = %Lu", __entry
->bg_objectid
)
905 TRACE_EVENT(btrfs_setup_cluster
,
907 TP_PROTO(struct btrfs_block_group_cache
*block_group
,
908 struct btrfs_free_cluster
*cluster
, u64 size
, int bitmap
),
910 TP_ARGS(block_group
, cluster
, size
, bitmap
),
913 __field( u64
, bg_objectid
)
914 __field( u64
, flags
)
915 __field( u64
, start
)
916 __field( u64
, max_size
)
918 __field( int, bitmap
)
922 __entry
->bg_objectid
= block_group
->key
.objectid
;
923 __entry
->flags
= block_group
->flags
;
924 __entry
->start
= cluster
->window_start
;
925 __entry
->max_size
= cluster
->max_size
;
926 __entry
->size
= size
;
927 __entry
->bitmap
= bitmap
;
930 TP_printk("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, "
931 "size = %Lu, max_size = %Lu, bitmap = %d",
932 __entry
->bg_objectid
,
934 __print_flags((unsigned long)__entry
->flags
, "|",
935 BTRFS_GROUP_FLAGS
), __entry
->start
,
936 __entry
->size
, __entry
->max_size
, __entry
->bitmap
)
940 TRACE_EVENT(alloc_extent_state
,
942 TP_PROTO(struct extent_state
*state
, gfp_t mask
, unsigned long IP
),
944 TP_ARGS(state
, mask
, IP
),
947 __field(struct extent_state
*, state
)
949 __field(unsigned long, ip
)
953 __entry
->state
= state
,
954 __entry
->mask
= mask
,
958 TP_printk("state=%p; mask = %s; caller = %pF", __entry
->state
,
959 show_gfp_flags(__entry
->mask
), (void *)__entry
->ip
)
962 TRACE_EVENT(free_extent_state
,
964 TP_PROTO(struct extent_state
*state
, unsigned long IP
),
969 __field(struct extent_state
*, state
)
970 __field(unsigned long, ip
)
974 __entry
->state
= state
,
978 TP_printk(" state=%p; caller = %pF", __entry
->state
,
982 #endif /* _TRACE_BTRFS_H */
984 /* This part must be outside protection */
985 #include <trace/define_trace.h>