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 struct __btrfs_workqueue
;
26 struct btrfs_qgroup_operation
;
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_RELOC" }, \
49 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
51 #define show_root_type(obj) \
52 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
53 (obj >= BTRFS_ROOT_TREE_OBJECTID && \
54 obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
56 #define BTRFS_GROUP_FLAGS \
57 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \
58 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
59 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
60 { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \
61 { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \
62 { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \
63 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
64 { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \
65 { BTRFS_BLOCK_GROUP_RAID6, "RAID6"}
67 #define BTRFS_UUID_SIZE 16
69 TRACE_EVENT(btrfs_transaction_commit
,
71 TP_PROTO(struct btrfs_root
*root
),
76 __field( u64
, generation
)
77 __field( u64
, root_objectid
)
81 __entry
->generation
= root
->fs_info
->generation
;
82 __entry
->root_objectid
= root
->root_key
.objectid
;
85 TP_printk("root = %llu(%s), gen = %llu",
86 show_root_type(__entry
->root_objectid
),
87 (unsigned long long)__entry
->generation
)
90 DECLARE_EVENT_CLASS(btrfs__inode
,
92 TP_PROTO(struct inode
*inode
),
98 __field( blkcnt_t
, blocks
)
99 __field( u64
, disk_i_size
)
100 __field( u64
, generation
)
101 __field( u64
, last_trans
)
102 __field( u64
, logged_trans
)
103 __field( u64
, root_objectid
)
107 __entry
->ino
= inode
->i_ino
;
108 __entry
->blocks
= inode
->i_blocks
;
109 __entry
->disk_i_size
= BTRFS_I(inode
)->disk_i_size
;
110 __entry
->generation
= BTRFS_I(inode
)->generation
;
111 __entry
->last_trans
= BTRFS_I(inode
)->last_trans
;
112 __entry
->logged_trans
= BTRFS_I(inode
)->logged_trans
;
113 __entry
->root_objectid
=
114 BTRFS_I(inode
)->root
->root_key
.objectid
;
117 TP_printk("root = %llu(%s), gen = %llu, ino = %lu, blocks = %llu, "
118 "disk_i_size = %llu, last_trans = %llu, logged_trans = %llu",
119 show_root_type(__entry
->root_objectid
),
120 (unsigned long long)__entry
->generation
,
121 (unsigned long)__entry
->ino
,
122 (unsigned long long)__entry
->blocks
,
123 (unsigned long long)__entry
->disk_i_size
,
124 (unsigned long long)__entry
->last_trans
,
125 (unsigned long long)__entry
->logged_trans
)
128 DEFINE_EVENT(btrfs__inode
, btrfs_inode_new
,
130 TP_PROTO(struct inode
*inode
),
135 DEFINE_EVENT(btrfs__inode
, btrfs_inode_request
,
137 TP_PROTO(struct inode
*inode
),
142 DEFINE_EVENT(btrfs__inode
, btrfs_inode_evict
,
144 TP_PROTO(struct inode
*inode
),
149 #define __show_map_type(type) \
150 __print_symbolic_u64(type, \
151 { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \
152 { EXTENT_MAP_HOLE, "HOLE" }, \
153 { EXTENT_MAP_INLINE, "INLINE" }, \
154 { EXTENT_MAP_DELALLOC, "DELALLOC" })
156 #define show_map_type(type) \
157 type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type)
159 #define show_map_flags(flag) \
160 __print_flags(flag, "|", \
161 { (1 << EXTENT_FLAG_PINNED), "PINNED" },\
162 { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\
163 { (1 << EXTENT_FLAG_VACANCY), "VACANCY" },\
164 { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\
165 { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\
166 { (1 << EXTENT_FLAG_FILLING), "FILLING" },\
167 { (1 << EXTENT_FLAG_FS_MAPPING), "FS_MAPPING" })
169 TRACE_EVENT_CONDITION(btrfs_get_extent
,
171 TP_PROTO(struct btrfs_root
*root
, struct extent_map
*map
),
178 __field( u64
, root_objectid
)
179 __field( u64
, start
)
181 __field( u64
, orig_start
)
182 __field( u64
, block_start
)
183 __field( u64
, block_len
)
184 __field( unsigned long, flags
)
186 __field( unsigned int, compress_type
)
190 __entry
->root_objectid
= root
->root_key
.objectid
;
191 __entry
->start
= map
->start
;
192 __entry
->len
= map
->len
;
193 __entry
->orig_start
= map
->orig_start
;
194 __entry
->block_start
= map
->block_start
;
195 __entry
->block_len
= map
->block_len
;
196 __entry
->flags
= map
->flags
;
197 __entry
->refs
= atomic_read(&map
->refs
);
198 __entry
->compress_type
= map
->compress_type
;
201 TP_printk("root = %llu(%s), start = %llu, len = %llu, "
202 "orig_start = %llu, block_start = %llu(%s), "
203 "block_len = %llu, flags = %s, refs = %u, "
204 "compress_type = %u",
205 show_root_type(__entry
->root_objectid
),
206 (unsigned long long)__entry
->start
,
207 (unsigned long long)__entry
->len
,
208 (unsigned long long)__entry
->orig_start
,
209 show_map_type(__entry
->block_start
),
210 (unsigned long long)__entry
->block_len
,
211 show_map_flags(__entry
->flags
),
212 __entry
->refs
, __entry
->compress_type
)
215 #define show_ordered_flags(flags) \
216 __print_flags(flags, "|", \
217 { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \
218 { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \
219 { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \
220 { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \
221 { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \
222 { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \
223 { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \
224 { (1 << BTRFS_ORDERED_UPDATED_ISIZE), "UPDATED_ISIZE" }, \
225 { (1 << BTRFS_ORDERED_LOGGED_CSUM), "LOGGED_CSUM" }, \
226 { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" })
229 DECLARE_EVENT_CLASS(btrfs__ordered_extent
,
231 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
233 TP_ARGS(inode
, ordered
),
236 __field( ino_t
, ino
)
237 __field( u64
, file_offset
)
238 __field( u64
, start
)
240 __field( u64
, disk_len
)
241 __field( u64
, bytes_left
)
242 __field( unsigned long, flags
)
243 __field( int, compress_type
)
245 __field( u64
, root_objectid
)
249 __entry
->ino
= inode
->i_ino
;
250 __entry
->file_offset
= ordered
->file_offset
;
251 __entry
->start
= ordered
->start
;
252 __entry
->len
= ordered
->len
;
253 __entry
->disk_len
= ordered
->disk_len
;
254 __entry
->bytes_left
= ordered
->bytes_left
;
255 __entry
->flags
= ordered
->flags
;
256 __entry
->compress_type
= ordered
->compress_type
;
257 __entry
->refs
= atomic_read(&ordered
->refs
);
258 __entry
->root_objectid
=
259 BTRFS_I(inode
)->root
->root_key
.objectid
;
262 TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, "
263 "start = %llu, len = %llu, disk_len = %llu, "
264 "bytes_left = %llu, flags = %s, compress_type = %d, "
266 show_root_type(__entry
->root_objectid
),
267 (unsigned long long)__entry
->ino
,
268 (unsigned long long)__entry
->file_offset
,
269 (unsigned long long)__entry
->start
,
270 (unsigned long long)__entry
->len
,
271 (unsigned long long)__entry
->disk_len
,
272 (unsigned long long)__entry
->bytes_left
,
273 show_ordered_flags(__entry
->flags
),
274 __entry
->compress_type
, __entry
->refs
)
277 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_add
,
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_remove
,
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_start
,
293 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
295 TP_ARGS(inode
, ordered
)
298 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_put
,
300 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
302 TP_ARGS(inode
, ordered
)
305 DECLARE_EVENT_CLASS(btrfs__writepage
,
307 TP_PROTO(struct page
*page
, struct inode
*inode
,
308 struct writeback_control
*wbc
),
310 TP_ARGS(page
, inode
, wbc
),
313 __field( ino_t
, ino
)
314 __field( pgoff_t
, index
)
315 __field( long, nr_to_write
)
316 __field( long, pages_skipped
)
317 __field( loff_t
, range_start
)
318 __field( loff_t
, range_end
)
319 __field( char, for_kupdate
)
320 __field( char, for_reclaim
)
321 __field( char, range_cyclic
)
322 __field( pgoff_t
, writeback_index
)
323 __field( u64
, root_objectid
)
327 __entry
->ino
= inode
->i_ino
;
328 __entry
->index
= page
->index
;
329 __entry
->nr_to_write
= wbc
->nr_to_write
;
330 __entry
->pages_skipped
= wbc
->pages_skipped
;
331 __entry
->range_start
= wbc
->range_start
;
332 __entry
->range_end
= wbc
->range_end
;
333 __entry
->for_kupdate
= wbc
->for_kupdate
;
334 __entry
->for_reclaim
= wbc
->for_reclaim
;
335 __entry
->range_cyclic
= wbc
->range_cyclic
;
336 __entry
->writeback_index
= inode
->i_mapping
->writeback_index
;
337 __entry
->root_objectid
=
338 BTRFS_I(inode
)->root
->root_key
.objectid
;
341 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, "
342 "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, "
343 "range_end = %llu, for_kupdate = %d, "
344 "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu",
345 show_root_type(__entry
->root_objectid
),
346 (unsigned long)__entry
->ino
, __entry
->index
,
347 __entry
->nr_to_write
, __entry
->pages_skipped
,
348 __entry
->range_start
, __entry
->range_end
,
349 __entry
->for_kupdate
,
350 __entry
->for_reclaim
, __entry
->range_cyclic
,
351 (unsigned long)__entry
->writeback_index
)
354 DEFINE_EVENT(btrfs__writepage
, __extent_writepage
,
356 TP_PROTO(struct page
*page
, struct inode
*inode
,
357 struct writeback_control
*wbc
),
359 TP_ARGS(page
, inode
, wbc
)
362 TRACE_EVENT(btrfs_writepage_end_io_hook
,
364 TP_PROTO(struct page
*page
, u64 start
, u64 end
, int uptodate
),
366 TP_ARGS(page
, start
, end
, uptodate
),
369 __field( ino_t
, ino
)
370 __field( pgoff_t
, index
)
371 __field( u64
, start
)
373 __field( int, uptodate
)
374 __field( u64
, root_objectid
)
378 __entry
->ino
= page
->mapping
->host
->i_ino
;
379 __entry
->index
= page
->index
;
380 __entry
->start
= start
;
382 __entry
->uptodate
= uptodate
;
383 __entry
->root_objectid
=
384 BTRFS_I(page
->mapping
->host
)->root
->root_key
.objectid
;
387 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, "
388 "end = %llu, uptodate = %d",
389 show_root_type(__entry
->root_objectid
),
390 (unsigned long)__entry
->ino
, (unsigned long)__entry
->index
,
391 (unsigned long long)__entry
->start
,
392 (unsigned long long)__entry
->end
, __entry
->uptodate
)
395 TRACE_EVENT(btrfs_sync_file
,
397 TP_PROTO(struct file
*file
, int datasync
),
399 TP_ARGS(file
, datasync
),
402 __field( ino_t
, ino
)
403 __field( ino_t
, parent
)
404 __field( int, datasync
)
405 __field( u64
, root_objectid
)
409 struct dentry
*dentry
= file
->f_path
.dentry
;
410 struct inode
*inode
= d_inode(dentry
);
412 __entry
->ino
= inode
->i_ino
;
413 __entry
->parent
= d_inode(dentry
->d_parent
)->i_ino
;
414 __entry
->datasync
= datasync
;
415 __entry
->root_objectid
=
416 BTRFS_I(inode
)->root
->root_key
.objectid
;
419 TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d",
420 show_root_type(__entry
->root_objectid
),
421 (unsigned long)__entry
->ino
, (unsigned long)__entry
->parent
,
425 TRACE_EVENT(btrfs_sync_fs
,
436 __entry
->wait
= wait
;
439 TP_printk("wait = %d", __entry
->wait
)
442 #define show_ref_action(action) \
443 __print_symbolic(action, \
444 { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \
445 { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \
446 { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \
447 { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
450 DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref
,
452 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
453 struct btrfs_delayed_tree_ref
*full_ref
,
456 TP_ARGS(ref
, full_ref
, action
),
459 __field( u64
, bytenr
)
460 __field( u64
, num_bytes
)
461 __field( int, action
)
462 __field( u64
, parent
)
463 __field( u64
, ref_root
)
464 __field( int, level
)
470 __entry
->bytenr
= ref
->bytenr
;
471 __entry
->num_bytes
= ref
->num_bytes
;
472 __entry
->action
= action
;
473 __entry
->parent
= full_ref
->parent
;
474 __entry
->ref_root
= full_ref
->root
;
475 __entry
->level
= full_ref
->level
;
476 __entry
->type
= ref
->type
;
477 __entry
->seq
= ref
->seq
;
480 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
481 "parent = %llu(%s), ref_root = %llu(%s), level = %d, "
482 "type = %s, seq = %llu",
483 (unsigned long long)__entry
->bytenr
,
484 (unsigned long long)__entry
->num_bytes
,
485 show_ref_action(__entry
->action
),
486 show_root_type(__entry
->parent
),
487 show_root_type(__entry
->ref_root
),
488 __entry
->level
, show_ref_type(__entry
->type
),
489 (unsigned long long)__entry
->seq
)
492 DEFINE_EVENT(btrfs_delayed_tree_ref
, add_delayed_tree_ref
,
494 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
495 struct btrfs_delayed_tree_ref
*full_ref
,
498 TP_ARGS(ref
, full_ref
, action
)
501 DEFINE_EVENT(btrfs_delayed_tree_ref
, run_delayed_tree_ref
,
503 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
504 struct btrfs_delayed_tree_ref
*full_ref
,
507 TP_ARGS(ref
, full_ref
, action
)
510 DECLARE_EVENT_CLASS(btrfs_delayed_data_ref
,
512 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
513 struct btrfs_delayed_data_ref
*full_ref
,
516 TP_ARGS(ref
, full_ref
, action
),
519 __field( u64
, bytenr
)
520 __field( u64
, num_bytes
)
521 __field( int, action
)
522 __field( u64
, parent
)
523 __field( u64
, ref_root
)
524 __field( u64
, owner
)
525 __field( u64
, offset
)
531 __entry
->bytenr
= ref
->bytenr
;
532 __entry
->num_bytes
= ref
->num_bytes
;
533 __entry
->action
= action
;
534 __entry
->parent
= full_ref
->parent
;
535 __entry
->ref_root
= full_ref
->root
;
536 __entry
->owner
= full_ref
->objectid
;
537 __entry
->offset
= full_ref
->offset
;
538 __entry
->type
= ref
->type
;
539 __entry
->seq
= ref
->seq
;
542 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
543 "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, "
544 "offset = %llu, type = %s, seq = %llu",
545 (unsigned long long)__entry
->bytenr
,
546 (unsigned long long)__entry
->num_bytes
,
547 show_ref_action(__entry
->action
),
548 show_root_type(__entry
->parent
),
549 show_root_type(__entry
->ref_root
),
550 (unsigned long long)__entry
->owner
,
551 (unsigned long long)__entry
->offset
,
552 show_ref_type(__entry
->type
),
553 (unsigned long long)__entry
->seq
)
556 DEFINE_EVENT(btrfs_delayed_data_ref
, add_delayed_data_ref
,
558 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
559 struct btrfs_delayed_data_ref
*full_ref
,
562 TP_ARGS(ref
, full_ref
, action
)
565 DEFINE_EVENT(btrfs_delayed_data_ref
, run_delayed_data_ref
,
567 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
568 struct btrfs_delayed_data_ref
*full_ref
,
571 TP_ARGS(ref
, full_ref
, action
)
574 DECLARE_EVENT_CLASS(btrfs_delayed_ref_head
,
576 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
577 struct btrfs_delayed_ref_head
*head_ref
,
580 TP_ARGS(ref
, head_ref
, action
),
583 __field( u64
, bytenr
)
584 __field( u64
, num_bytes
)
585 __field( int, action
)
586 __field( int, is_data
)
590 __entry
->bytenr
= ref
->bytenr
;
591 __entry
->num_bytes
= ref
->num_bytes
;
592 __entry
->action
= action
;
593 __entry
->is_data
= head_ref
->is_data
;
596 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d",
597 (unsigned long long)__entry
->bytenr
,
598 (unsigned long long)__entry
->num_bytes
,
599 show_ref_action(__entry
->action
),
603 DEFINE_EVENT(btrfs_delayed_ref_head
, add_delayed_ref_head
,
605 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
606 struct btrfs_delayed_ref_head
*head_ref
,
609 TP_ARGS(ref
, head_ref
, action
)
612 DEFINE_EVENT(btrfs_delayed_ref_head
, run_delayed_ref_head
,
614 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
615 struct btrfs_delayed_ref_head
*head_ref
,
618 TP_ARGS(ref
, head_ref
, action
)
621 #define show_chunk_type(type) \
622 __print_flags(type, "|", \
623 { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \
624 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
625 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
626 { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \
627 { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \
628 { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \
629 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
630 { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \
631 { BTRFS_BLOCK_GROUP_RAID6, "RAID6" })
633 DECLARE_EVENT_CLASS(btrfs__chunk
,
635 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
636 u64 offset
, u64 size
),
638 TP_ARGS(root
, map
, offset
, size
),
641 __field( int, num_stripes
)
643 __field( int, sub_stripes
)
644 __field( u64
, offset
)
646 __field( u64
, root_objectid
)
650 __entry
->num_stripes
= map
->num_stripes
;
651 __entry
->type
= map
->type
;
652 __entry
->sub_stripes
= map
->sub_stripes
;
653 __entry
->offset
= offset
;
654 __entry
->size
= size
;
655 __entry
->root_objectid
= root
->root_key
.objectid
;
658 TP_printk("root = %llu(%s), offset = %llu, size = %llu, "
659 "num_stripes = %d, sub_stripes = %d, type = %s",
660 show_root_type(__entry
->root_objectid
),
661 (unsigned long long)__entry
->offset
,
662 (unsigned long long)__entry
->size
,
663 __entry
->num_stripes
, __entry
->sub_stripes
,
664 show_chunk_type(__entry
->type
))
667 DEFINE_EVENT(btrfs__chunk
, btrfs_chunk_alloc
,
669 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
670 u64 offset
, u64 size
),
672 TP_ARGS(root
, map
, offset
, size
)
675 DEFINE_EVENT(btrfs__chunk
, btrfs_chunk_free
,
677 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
678 u64 offset
, u64 size
),
680 TP_ARGS(root
, map
, offset
, size
)
683 TRACE_EVENT(btrfs_cow_block
,
685 TP_PROTO(struct btrfs_root
*root
, struct extent_buffer
*buf
,
686 struct extent_buffer
*cow
),
688 TP_ARGS(root
, buf
, cow
),
691 __field( u64
, root_objectid
)
692 __field( u64
, buf_start
)
694 __field( u64
, cow_start
)
695 __field( int, buf_level
)
696 __field( int, cow_level
)
700 __entry
->root_objectid
= root
->root_key
.objectid
;
701 __entry
->buf_start
= buf
->start
;
702 __entry
->refs
= atomic_read(&buf
->refs
);
703 __entry
->cow_start
= cow
->start
;
704 __entry
->buf_level
= btrfs_header_level(buf
);
705 __entry
->cow_level
= btrfs_header_level(cow
);
708 TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu "
709 "(orig_level = %d), cow_buf = %llu (cow_level = %d)",
710 show_root_type(__entry
->root_objectid
),
712 (unsigned long long)__entry
->buf_start
,
714 (unsigned long long)__entry
->cow_start
,
718 TRACE_EVENT(btrfs_space_reservation
,
720 TP_PROTO(struct btrfs_fs_info
*fs_info
, char *type
, u64 val
,
721 u64 bytes
, int reserve
),
723 TP_ARGS(fs_info
, type
, val
, bytes
, reserve
),
726 __array( u8
, fsid
, BTRFS_UUID_SIZE
)
727 __string( type
, type
)
729 __field( u64
, bytes
)
730 __field( int, reserve
)
734 memcpy(__entry
->fsid
, fs_info
->fsid
, BTRFS_UUID_SIZE
);
735 __assign_str(type
, type
);
737 __entry
->bytes
= bytes
;
738 __entry
->reserve
= reserve
;
741 TP_printk("%pU: %s: %Lu %s %Lu", __entry
->fsid
, __get_str(type
),
742 __entry
->val
, __entry
->reserve
? "reserve" : "release",
746 DECLARE_EVENT_CLASS(btrfs__reserved_extent
,
748 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
750 TP_ARGS(root
, start
, len
),
753 __field( u64
, root_objectid
)
754 __field( u64
, start
)
759 __entry
->root_objectid
= root
->root_key
.objectid
;
760 __entry
->start
= start
;
764 TP_printk("root = %llu(%s), start = %llu, len = %llu",
765 show_root_type(__entry
->root_objectid
),
766 (unsigned long long)__entry
->start
,
767 (unsigned long long)__entry
->len
)
770 DEFINE_EVENT(btrfs__reserved_extent
, btrfs_reserved_extent_alloc
,
772 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
774 TP_ARGS(root
, start
, len
)
777 DEFINE_EVENT(btrfs__reserved_extent
, btrfs_reserved_extent_free
,
779 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
781 TP_ARGS(root
, start
, len
)
784 TRACE_EVENT(find_free_extent
,
786 TP_PROTO(struct btrfs_root
*root
, u64 num_bytes
, u64 empty_size
,
789 TP_ARGS(root
, num_bytes
, empty_size
, data
),
792 __field( u64
, root_objectid
)
793 __field( u64
, num_bytes
)
794 __field( u64
, empty_size
)
799 __entry
->root_objectid
= root
->root_key
.objectid
;
800 __entry
->num_bytes
= num_bytes
;
801 __entry
->empty_size
= empty_size
;
802 __entry
->data
= data
;
805 TP_printk("root = %Lu(%s), len = %Lu, empty_size = %Lu, "
806 "flags = %Lu(%s)", show_root_type(__entry
->root_objectid
),
807 __entry
->num_bytes
, __entry
->empty_size
, __entry
->data
,
808 __print_flags((unsigned long)__entry
->data
, "|",
812 DECLARE_EVENT_CLASS(btrfs__reserve_extent
,
814 TP_PROTO(struct btrfs_root
*root
,
815 struct btrfs_block_group_cache
*block_group
, u64 start
,
818 TP_ARGS(root
, block_group
, start
, len
),
821 __field( u64
, root_objectid
)
822 __field( u64
, bg_objectid
)
823 __field( u64
, flags
)
824 __field( u64
, start
)
829 __entry
->root_objectid
= root
->root_key
.objectid
;
830 __entry
->bg_objectid
= block_group
->key
.objectid
;
831 __entry
->flags
= block_group
->flags
;
832 __entry
->start
= start
;
836 TP_printk("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), "
837 "start = %Lu, len = %Lu",
838 show_root_type(__entry
->root_objectid
), __entry
->bg_objectid
,
839 __entry
->flags
, __print_flags((unsigned long)__entry
->flags
,
840 "|", BTRFS_GROUP_FLAGS
),
841 __entry
->start
, __entry
->len
)
844 DEFINE_EVENT(btrfs__reserve_extent
, btrfs_reserve_extent
,
846 TP_PROTO(struct btrfs_root
*root
,
847 struct btrfs_block_group_cache
*block_group
, u64 start
,
850 TP_ARGS(root
, block_group
, start
, len
)
853 DEFINE_EVENT(btrfs__reserve_extent
, btrfs_reserve_extent_cluster
,
855 TP_PROTO(struct btrfs_root
*root
,
856 struct btrfs_block_group_cache
*block_group
, u64 start
,
859 TP_ARGS(root
, block_group
, start
, len
)
862 TRACE_EVENT(btrfs_find_cluster
,
864 TP_PROTO(struct btrfs_block_group_cache
*block_group
, u64 start
,
865 u64 bytes
, u64 empty_size
, u64 min_bytes
),
867 TP_ARGS(block_group
, start
, bytes
, empty_size
, min_bytes
),
870 __field( u64
, bg_objectid
)
871 __field( u64
, flags
)
872 __field( u64
, start
)
873 __field( u64
, bytes
)
874 __field( u64
, empty_size
)
875 __field( u64
, min_bytes
)
879 __entry
->bg_objectid
= block_group
->key
.objectid
;
880 __entry
->flags
= block_group
->flags
;
881 __entry
->start
= start
;
882 __entry
->bytes
= bytes
;
883 __entry
->empty_size
= empty_size
;
884 __entry
->min_bytes
= min_bytes
;
887 TP_printk("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu,"
888 " empty_size = %Lu, min_bytes = %Lu", __entry
->bg_objectid
,
890 __print_flags((unsigned long)__entry
->flags
, "|",
891 BTRFS_GROUP_FLAGS
), __entry
->start
,
892 __entry
->bytes
, __entry
->empty_size
, __entry
->min_bytes
)
895 TRACE_EVENT(btrfs_failed_cluster_setup
,
897 TP_PROTO(struct btrfs_block_group_cache
*block_group
),
899 TP_ARGS(block_group
),
902 __field( u64
, bg_objectid
)
906 __entry
->bg_objectid
= block_group
->key
.objectid
;
909 TP_printk("block_group = %Lu", __entry
->bg_objectid
)
912 TRACE_EVENT(btrfs_setup_cluster
,
914 TP_PROTO(struct btrfs_block_group_cache
*block_group
,
915 struct btrfs_free_cluster
*cluster
, u64 size
, int bitmap
),
917 TP_ARGS(block_group
, cluster
, size
, bitmap
),
920 __field( u64
, bg_objectid
)
921 __field( u64
, flags
)
922 __field( u64
, start
)
923 __field( u64
, max_size
)
925 __field( int, bitmap
)
929 __entry
->bg_objectid
= block_group
->key
.objectid
;
930 __entry
->flags
= block_group
->flags
;
931 __entry
->start
= cluster
->window_start
;
932 __entry
->max_size
= cluster
->max_size
;
933 __entry
->size
= size
;
934 __entry
->bitmap
= bitmap
;
937 TP_printk("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, "
938 "size = %Lu, max_size = %Lu, bitmap = %d",
939 __entry
->bg_objectid
,
941 __print_flags((unsigned long)__entry
->flags
, "|",
942 BTRFS_GROUP_FLAGS
), __entry
->start
,
943 __entry
->size
, __entry
->max_size
, __entry
->bitmap
)
947 TRACE_EVENT(alloc_extent_state
,
949 TP_PROTO(struct extent_state
*state
, gfp_t mask
, unsigned long IP
),
951 TP_ARGS(state
, mask
, IP
),
954 __field(struct extent_state
*, state
)
956 __field(unsigned long, ip
)
960 __entry
->state
= state
,
961 __entry
->mask
= mask
,
965 TP_printk("state=%p; mask = %s; caller = %pS", __entry
->state
,
966 show_gfp_flags(__entry
->mask
), (void *)__entry
->ip
)
969 TRACE_EVENT(free_extent_state
,
971 TP_PROTO(struct extent_state
*state
, unsigned long IP
),
976 __field(struct extent_state
*, state
)
977 __field(unsigned long, ip
)
981 __entry
->state
= state
,
985 TP_printk(" state=%p; caller = %pS", __entry
->state
,
989 DECLARE_EVENT_CLASS(btrfs__work
,
991 TP_PROTO(struct btrfs_work
*work
),
996 __field( void *, work
)
997 __field( void *, wq
)
998 __field( void *, func
)
999 __field( void *, ordered_func
)
1000 __field( void *, ordered_free
)
1001 __field( void *, normal_work
)
1005 __entry
->work
= work
;
1006 __entry
->wq
= work
->wq
;
1007 __entry
->func
= work
->func
;
1008 __entry
->ordered_func
= work
->ordered_func
;
1009 __entry
->ordered_free
= work
->ordered_free
;
1010 __entry
->normal_work
= &work
->normal_work
;
1013 TP_printk("work=%p (normal_work=%p), wq=%p, func=%pf, ordered_func=%p,"
1015 __entry
->work
, __entry
->normal_work
, __entry
->wq
,
1016 __entry
->func
, __entry
->ordered_func
, __entry
->ordered_free
)
1019 /* For situiations that the work is freed */
1020 DECLARE_EVENT_CLASS(btrfs__work__done
,
1022 TP_PROTO(struct btrfs_work
*work
),
1027 __field( void *, work
)
1031 __entry
->work
= work
;
1034 TP_printk("work->%p", __entry
->work
)
1037 DEFINE_EVENT(btrfs__work
, btrfs_work_queued
,
1039 TP_PROTO(struct btrfs_work
*work
),
1044 DEFINE_EVENT(btrfs__work
, btrfs_work_sched
,
1046 TP_PROTO(struct btrfs_work
*work
),
1051 DEFINE_EVENT(btrfs__work__done
, btrfs_all_work_done
,
1053 TP_PROTO(struct btrfs_work
*work
),
1058 DEFINE_EVENT(btrfs__work
, btrfs_ordered_sched
,
1060 TP_PROTO(struct btrfs_work
*work
),
1065 DECLARE_EVENT_CLASS(btrfs__workqueue
,
1067 TP_PROTO(struct __btrfs_workqueue
*wq
, const char *name
, int high
),
1069 TP_ARGS(wq
, name
, high
),
1072 __field( void *, wq
)
1073 __string( name
, name
)
1074 __field( int , high
)
1079 __assign_str(name
, name
);
1080 __entry
->high
= high
;
1083 TP_printk("name=%s%s, wq=%p", __get_str(name
),
1084 __print_flags(__entry
->high
, "",
1085 {(WQ_HIGHPRI
), "-high"}),
1089 DEFINE_EVENT(btrfs__workqueue
, btrfs_workqueue_alloc
,
1091 TP_PROTO(struct __btrfs_workqueue
*wq
, const char *name
, int high
),
1093 TP_ARGS(wq
, name
, high
)
1096 DECLARE_EVENT_CLASS(btrfs__workqueue_done
,
1098 TP_PROTO(struct __btrfs_workqueue
*wq
),
1103 __field( void *, wq
)
1110 TP_printk("wq=%p", __entry
->wq
)
1113 DEFINE_EVENT(btrfs__workqueue_done
, btrfs_workqueue_destroy
,
1115 TP_PROTO(struct __btrfs_workqueue
*wq
),
1120 #define show_oper_type(type) \
1121 __print_symbolic(type, \
1122 { BTRFS_QGROUP_OPER_ADD_EXCL, "OPER_ADD_EXCL" }, \
1123 { BTRFS_QGROUP_OPER_ADD_SHARED, "OPER_ADD_SHARED" }, \
1124 { BTRFS_QGROUP_OPER_SUB_EXCL, "OPER_SUB_EXCL" }, \
1125 { BTRFS_QGROUP_OPER_SUB_SHARED, "OPER_SUB_SHARED" })
1127 DECLARE_EVENT_CLASS(btrfs_qgroup_oper
,
1129 TP_PROTO(struct btrfs_qgroup_operation
*oper
),
1134 __field( u64
, ref_root
)
1135 __field( u64
, bytenr
)
1136 __field( u64
, num_bytes
)
1138 __field( int, type
)
1139 __field( u64
, elem_seq
)
1143 __entry
->ref_root
= oper
->ref_root
;
1144 __entry
->bytenr
= oper
->bytenr
,
1145 __entry
->num_bytes
= oper
->num_bytes
;
1146 __entry
->seq
= oper
->seq
;
1147 __entry
->type
= oper
->type
;
1148 __entry
->elem_seq
= oper
->elem
.seq
;
1151 TP_printk("ref_root = %llu, bytenr = %llu, num_bytes = %llu, "
1152 "seq = %llu, elem.seq = %llu, type = %s",
1153 (unsigned long long)__entry
->ref_root
,
1154 (unsigned long long)__entry
->bytenr
,
1155 (unsigned long long)__entry
->num_bytes
,
1156 (unsigned long long)__entry
->seq
,
1157 (unsigned long long)__entry
->elem_seq
,
1158 show_oper_type(__entry
->type
))
1161 DEFINE_EVENT(btrfs_qgroup_oper
, btrfs_qgroup_account
,
1163 TP_PROTO(struct btrfs_qgroup_operation
*oper
),
1168 DEFINE_EVENT(btrfs_qgroup_oper
, btrfs_qgroup_record_ref
,
1170 TP_PROTO(struct btrfs_qgroup_operation
*oper
),
1175 #endif /* _TRACE_BTRFS_H */
1177 /* This part must be outside protection */
1178 #include <trace/define_trace.h>