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>
10 #include <linux/version.h>
12 #ifndef _TRACE_BTRFS_DEF_
13 #define _TRACE_BTRFS_DEF_
18 struct btrfs_ordered_extent
;
19 struct btrfs_delayed_ref_node
;
20 struct btrfs_delayed_tree_ref
;
21 struct btrfs_delayed_data_ref
;
22 struct btrfs_delayed_ref_head
;
23 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
24 struct btrfs_block_group_cache
;
25 struct btrfs_free_cluster
;
29 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
34 #define show_ref_type(type) \
35 __print_symbolic(type, \
36 { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \
37 { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \
38 { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \
39 { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \
40 { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" })
42 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,40))
43 #define __show_root_type(obj) \
44 __print_symbolic_u64(obj, \
45 { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \
46 { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \
47 { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \
48 { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \
49 { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \
50 { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \
51 { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \
52 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \
53 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \
54 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
56 #define __show_root_type(obj) \
57 __print_symbolic(obj, \
58 { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \
59 { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \
60 { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \
61 { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \
62 { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \
63 { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \
64 { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \
65 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \
66 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \
67 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
70 #define show_root_type(obj) \
71 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
72 (obj <= BTRFS_CSUM_TREE_OBJECTID )) ? __show_root_type(obj) : "-"
74 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
76 #define BTRFS_GROUP_FLAGS \
77 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \
78 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
79 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
80 { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \
81 { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \
82 { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \
83 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}
85 #define BTRFS_UUID_SIZE 16
89 TRACE_EVENT(btrfs_transaction_commit
,
91 TP_PROTO(struct btrfs_root
*root
),
96 __field( u64
, generation
)
97 __field( u64
, root_objectid
)
101 tp_assign(generation
, root
->fs_info
->generation
)
102 tp_assign(root_objectid
, root
->root_key
.objectid
)
105 TP_printk("root = %llu(%s), gen = %llu",
106 show_root_type(__entry
->root_objectid
),
107 (unsigned long long)__entry
->generation
)
110 DECLARE_EVENT_CLASS(btrfs__inode
,
112 TP_PROTO(struct inode
*inode
),
117 __field( ino_t
, ino
)
118 __field( blkcnt_t
, blocks
)
119 __field( u64
, disk_i_size
)
120 __field( u64
, generation
)
121 __field( u64
, last_trans
)
122 __field( u64
, logged_trans
)
123 __field( u64
, root_objectid
)
127 tp_assign(ino
, inode
->i_ino
)
128 tp_assign(blocks
, inode
->i_blocks
)
129 tp_assign(disk_i_size
, BTRFS_I(inode
)->disk_i_size
)
130 tp_assign(generation
, BTRFS_I(inode
)->generation
)
131 tp_assign(last_trans
, BTRFS_I(inode
)->last_trans
)
132 tp_assign(logged_trans
, BTRFS_I(inode
)->logged_trans
)
133 tp_assign(root_objectid
,
134 BTRFS_I(inode
)->root
->root_key
.objectid
)
137 TP_printk("root = %llu(%s), gen = %llu, ino = %lu, blocks = %llu, "
138 "disk_i_size = %llu, last_trans = %llu, logged_trans = %llu",
139 show_root_type(__entry
->root_objectid
),
140 (unsigned long long)__entry
->generation
,
141 (unsigned long)__entry
->ino
,
142 (unsigned long long)__entry
->blocks
,
143 (unsigned long long)__entry
->disk_i_size
,
144 (unsigned long long)__entry
->last_trans
,
145 (unsigned long long)__entry
->logged_trans
)
148 DEFINE_EVENT(btrfs__inode
, btrfs_inode_new
,
150 TP_PROTO(struct inode
*inode
),
155 DEFINE_EVENT(btrfs__inode
, btrfs_inode_request
,
157 TP_PROTO(struct inode
*inode
),
162 DEFINE_EVENT(btrfs__inode
, btrfs_inode_evict
,
164 TP_PROTO(struct inode
*inode
),
169 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,40))
170 #define __show_map_type(type) \
171 __print_symbolic_u64(type, \
172 { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \
173 { EXTENT_MAP_HOLE, "HOLE" }, \
174 { EXTENT_MAP_INLINE, "INLINE" }, \
175 { EXTENT_MAP_DELALLOC, "DELALLOC" })
177 #define __show_map_type(type) \
178 __print_symbolic(type, \
179 { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \
180 { EXTENT_MAP_HOLE, "HOLE" }, \
181 { EXTENT_MAP_INLINE, "INLINE" }, \
182 { EXTENT_MAP_DELALLOC, "DELALLOC" })
185 #define show_map_type(type) \
186 type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type)
188 #define show_map_flags(flag) \
189 __print_flags(flag, "|", \
190 { EXTENT_FLAG_PINNED, "PINNED" }, \
191 { EXTENT_FLAG_COMPRESSED, "COMPRESSED" }, \
192 { EXTENT_FLAG_VACANCY, "VACANCY" }, \
193 { EXTENT_FLAG_PREALLOC, "PREALLOC" })
195 TRACE_EVENT(btrfs_get_extent
,
197 TP_PROTO(struct btrfs_root
*root
, struct extent_map
*map
),
202 __field( u64
, root_objectid
)
203 __field( u64
, start
)
205 __field( u64
, orig_start
)
206 __field( u64
, block_start
)
207 __field( u64
, block_len
)
208 __field( unsigned long, flags
)
210 __field( unsigned int, compress_type
)
214 tp_assign(root_objectid
, root
->root_key
.objectid
)
215 tp_assign(start
, map
->start
)
216 tp_assign(len
, map
->len
)
217 tp_assign(orig_start
, map
->orig_start
)
218 tp_assign(block_start
, map
->block_start
)
219 tp_assign(block_len
, map
->block_len
)
220 tp_assign(flags
, map
->flags
)
221 tp_assign(refs
, atomic_read(&map
->refs
))
222 tp_assign(compress_type
, map
->compress_type
)
225 TP_printk("root = %llu(%s), start = %llu, len = %llu, "
226 "orig_start = %llu, block_start = %llu(%s), "
227 "block_len = %llu, flags = %s, refs = %u, "
228 "compress_type = %u",
229 show_root_type(__entry
->root_objectid
),
230 (unsigned long long)__entry
->start
,
231 (unsigned long long)__entry
->len
,
232 (unsigned long long)__entry
->orig_start
,
233 show_map_type(__entry
->block_start
),
234 (unsigned long long)__entry
->block_len
,
235 show_map_flags(__entry
->flags
),
236 __entry
->refs
, __entry
->compress_type
)
239 #define show_ordered_flags(flags) \
240 __print_symbolic(flags, \
241 { BTRFS_ORDERED_IO_DONE, "IO_DONE" }, \
242 { BTRFS_ORDERED_COMPLETE, "COMPLETE" }, \
243 { BTRFS_ORDERED_NOCOW, "NOCOW" }, \
244 { BTRFS_ORDERED_COMPRESSED, "COMPRESSED" }, \
245 { BTRFS_ORDERED_PREALLOC, "PREALLOC" }, \
246 { BTRFS_ORDERED_DIRECT, "DIRECT" })
248 DECLARE_EVENT_CLASS(btrfs__ordered_extent
,
250 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
252 TP_ARGS(inode
, ordered
),
255 __field( ino_t
, ino
)
256 __field( u64
, file_offset
)
257 __field( u64
, start
)
259 __field( u64
, disk_len
)
260 __field( u64
, bytes_left
)
261 __field( unsigned long, flags
)
262 __field( int, compress_type
)
264 __field( u64
, root_objectid
)
268 tp_assign(ino
, inode
->i_ino
)
269 tp_assign(file_offset
, ordered
->file_offset
)
270 tp_assign(start
, ordered
->start
)
271 tp_assign(len
, ordered
->len
)
272 tp_assign(disk_len
, ordered
->disk_len
)
273 tp_assign(bytes_left
, ordered
->bytes_left
)
274 tp_assign(flags
, ordered
->flags
)
275 tp_assign(compress_type
, ordered
->compress_type
)
276 tp_assign(refs
, atomic_read(&ordered
->refs
))
277 tp_assign(root_objectid
,
278 BTRFS_I(inode
)->root
->root_key
.objectid
)
281 TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, "
282 "start = %llu, len = %llu, disk_len = %llu, "
283 "bytes_left = %llu, flags = %s, compress_type = %d, "
285 show_root_type(__entry
->root_objectid
),
286 (unsigned long long)__entry
->ino
,
287 (unsigned long long)__entry
->file_offset
,
288 (unsigned long long)__entry
->start
,
289 (unsigned long long)__entry
->len
,
290 (unsigned long long)__entry
->disk_len
,
291 (unsigned long long)__entry
->bytes_left
,
292 show_ordered_flags(__entry
->flags
),
293 __entry
->compress_type
, __entry
->refs
)
296 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_add
,
298 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
300 TP_ARGS(inode
, ordered
)
303 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_remove
,
305 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
307 TP_ARGS(inode
, ordered
)
310 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_start
,
312 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
314 TP_ARGS(inode
, ordered
)
317 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_put
,
319 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
321 TP_ARGS(inode
, ordered
)
324 DECLARE_EVENT_CLASS(btrfs__writepage
,
326 TP_PROTO(struct page
*page
, struct inode
*inode
,
327 struct writeback_control
*wbc
),
329 TP_ARGS(page
, inode
, wbc
),
332 __field( ino_t
, ino
)
333 __field( pgoff_t
, index
)
334 __field( long, nr_to_write
)
335 __field( long, pages_skipped
)
336 __field( loff_t
, range_start
)
337 __field( loff_t
, range_end
)
338 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
339 __field( char, nonblocking
)
341 __field( char, for_kupdate
)
342 __field( char, for_reclaim
)
343 __field( char, range_cyclic
)
344 __field( pgoff_t
, writeback_index
)
345 __field( u64
, root_objectid
)
349 tp_assign(ino
, inode
->i_ino
)
350 tp_assign(index
, page
->index
)
351 tp_assign(nr_to_write
, wbc
->nr_to_write
)
352 tp_assign(pages_skipped
, wbc
->pages_skipped
)
353 tp_assign(range_start
, wbc
->range_start
)
354 tp_assign(range_end
, wbc
->range_end
)
355 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
356 tp_assign(nonblocking
, wbc
->nonblocking
)
358 tp_assign(for_kupdate
, wbc
->for_kupdate
)
359 tp_assign(for_reclaim
, wbc
->for_reclaim
)
360 tp_assign(range_cyclic
, wbc
->range_cyclic
)
361 tp_assign(writeback_index
, inode
->i_mapping
->writeback_index
)
362 tp_assign(root_objectid
,
363 BTRFS_I(inode
)->root
->root_key
.objectid
)
366 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
367 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, "
368 "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, "
369 "range_end = %llu, nonblocking = %d, for_kupdate = %d, "
370 "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu",
371 show_root_type(__entry
->root_objectid
),
372 (unsigned long)__entry
->ino
, __entry
->index
,
373 __entry
->nr_to_write
, __entry
->pages_skipped
,
374 __entry
->range_start
, __entry
->range_end
,
375 __entry
->nonblocking
, __entry
->for_kupdate
,
376 __entry
->for_reclaim
, __entry
->range_cyclic
,
377 (unsigned long)__entry
->writeback_index
)
379 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, "
380 "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, "
381 "range_end = %llu, for_kupdate = %d, "
382 "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu",
383 show_root_type(__entry
->root_objectid
),
384 (unsigned long)__entry
->ino
, __entry
->index
,
385 __entry
->nr_to_write
, __entry
->pages_skipped
,
386 __entry
->range_start
, __entry
->range_end
,
387 __entry
->for_kupdate
,
388 __entry
->for_reclaim
, __entry
->range_cyclic
,
389 (unsigned long)__entry
->writeback_index
)
393 DEFINE_EVENT(btrfs__writepage
, __extent_writepage
,
395 TP_PROTO(struct page
*page
, struct inode
*inode
,
396 struct writeback_control
*wbc
),
398 TP_ARGS(page
, inode
, wbc
)
401 TRACE_EVENT(btrfs_writepage_end_io_hook
,
403 TP_PROTO(struct page
*page
, u64 start
, u64 end
, int uptodate
),
405 TP_ARGS(page
, start
, end
, uptodate
),
408 __field( ino_t
, ino
)
409 __field( pgoff_t
, index
)
410 __field( u64
, start
)
412 __field( int, uptodate
)
413 __field( u64
, root_objectid
)
417 tp_assign(ino
, page
->mapping
->host
->i_ino
)
418 tp_assign(index
, page
->index
)
419 tp_assign(start
, start
)
421 tp_assign(uptodate
, uptodate
)
422 tp_assign(root_objectid
,
423 BTRFS_I(page
->mapping
->host
)->root
->root_key
.objectid
)
426 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, "
427 "end = %llu, uptodate = %d",
428 show_root_type(__entry
->root_objectid
),
429 (unsigned long)__entry
->ino
, (unsigned long)__entry
->index
,
430 (unsigned long long)__entry
->start
,
431 (unsigned long long)__entry
->end
, __entry
->uptodate
)
434 TRACE_EVENT(btrfs_sync_file
,
436 TP_PROTO(struct file
*file
, int datasync
),
438 TP_ARGS(file
, datasync
),
441 __field( ino_t
, ino
)
442 __field( ino_t
, parent
)
443 __field( int, datasync
)
444 __field( u64
, root_objectid
)
448 tp_assign(ino
, file
->f_path
.dentry
->d_inode
->i_ino
)
449 tp_assign(parent
, file
->f_path
.dentry
->d_parent
->d_inode
->i_ino
)
450 tp_assign(datasync
, datasync
)
451 tp_assign(root_objectid
,
452 BTRFS_I(file
->f_path
.dentry
->d_inode
)->root
->root_key
.objectid
)
455 TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d",
456 show_root_type(__entry
->root_objectid
),
457 (unsigned long)__entry
->ino
, (unsigned long)__entry
->parent
,
461 TRACE_EVENT(btrfs_sync_fs
,
472 tp_assign(wait
, wait
)
475 TP_printk("wait = %d", __entry
->wait
)
478 #define show_ref_action(action) \
479 __print_symbolic(action, \
480 { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \
481 { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \
482 { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \
483 { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
486 TRACE_EVENT(btrfs_delayed_tree_ref
,
488 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
489 struct btrfs_delayed_tree_ref
*full_ref
,
492 TP_ARGS(ref
, full_ref
, action
),
495 __field( u64
, bytenr
)
496 __field( u64
, num_bytes
)
497 __field( int, action
)
498 __field( u64
, parent
)
499 __field( u64
, ref_root
)
500 __field( int, level
)
502 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
508 tp_assign(bytenr
, ref
->bytenr
)
509 tp_assign(num_bytes
, ref
->num_bytes
)
510 tp_assign(action
, action
)
511 tp_assign(parent
, full_ref
->parent
)
512 tp_assign(ref_root
, full_ref
->root
)
513 tp_assign(level
, full_ref
->level
)
514 tp_assign(type
, ref
->type
)
515 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
516 tp_assign(seq
, ref
->seq
)
520 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
521 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
522 "parent = %llu(%s), ref_root = %llu(%s), level = %d, "
523 "type = %s, seq = %llu",
525 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
526 "parent = %llu(%s), ref_root = %llu(%s), level = %d, "
529 (unsigned long long)__entry
->bytenr
,
530 (unsigned long long)__entry
->num_bytes
,
531 show_ref_action(__entry
->action
),
532 show_root_type(__entry
->parent
),
533 show_root_type(__entry
->ref_root
),
534 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
535 __entry
->level
, show_ref_type(__entry
->type
),
536 (unsigned long long)__entry
->seq
)
538 __entry
->level
, show_ref_type(__entry
->type
))
542 TRACE_EVENT(btrfs_delayed_data_ref
,
544 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
545 struct btrfs_delayed_data_ref
*full_ref
,
548 TP_ARGS(ref
, full_ref
, action
),
551 __field( u64
, bytenr
)
552 __field( u64
, num_bytes
)
553 __field( int, action
)
554 __field( u64
, parent
)
555 __field( u64
, ref_root
)
556 __field( u64
, owner
)
557 __field( u64
, offset
)
559 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
565 tp_assign(bytenr
, ref
->bytenr
)
566 tp_assign(num_bytes
, ref
->num_bytes
)
567 tp_assign(action
, action
)
568 tp_assign(parent
, full_ref
->parent
)
569 tp_assign(ref_root
, full_ref
->root
)
570 tp_assign(owner
, full_ref
->objectid
)
571 tp_assign(offset
, full_ref
->offset
)
572 tp_assign(type
, ref
->type
)
573 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
574 tp_assign(seq
, ref
->seq
)
578 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
579 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
580 "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, "
581 "offset = %llu, type = %s, seq = %llu",
583 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
584 "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, "
585 "offset = %llu, type = %s",
587 (unsigned long long)__entry
->bytenr
,
588 (unsigned long long)__entry
->num_bytes
,
589 show_ref_action(__entry
->action
),
590 show_root_type(__entry
->parent
),
591 show_root_type(__entry
->ref_root
),
592 (unsigned long long)__entry
->owner
,
593 (unsigned long long)__entry
->offset
,
594 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
595 show_ref_type(__entry
->type
),
596 (unsigned long long)__entry
->seq
)
598 show_ref_type(__entry
->type
))
602 TRACE_EVENT(btrfs_delayed_ref_head
,
604 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
605 struct btrfs_delayed_ref_head
*head_ref
,
608 TP_ARGS(ref
, head_ref
, action
),
611 __field( u64
, bytenr
)
612 __field( u64
, num_bytes
)
613 __field( int, action
)
614 __field( int, is_data
)
618 tp_assign(bytenr
, ref
->bytenr
)
619 tp_assign(num_bytes
, ref
->num_bytes
)
620 tp_assign(action
, action
)
621 tp_assign(is_data
, head_ref
->is_data
)
624 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d",
625 (unsigned long long)__entry
->bytenr
,
626 (unsigned long long)__entry
->num_bytes
,
627 show_ref_action(__entry
->action
),
631 #define show_chunk_type(type) \
632 __print_flags(type, "|", \
633 { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \
634 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
635 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
636 { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \
637 { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \
638 { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \
639 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"})
641 DECLARE_EVENT_CLASS(btrfs__chunk
,
643 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
644 u64 offset
, u64 size
),
646 TP_ARGS(root
, map
, offset
, size
),
649 __field( int, num_stripes
)
651 __field( int, sub_stripes
)
652 __field( u64
, offset
)
654 __field( u64
, root_objectid
)
658 tp_assign(num_stripes
, map
->num_stripes
)
659 tp_assign(type
, map
->type
)
660 tp_assign(sub_stripes
, map
->sub_stripes
)
661 tp_assign(offset
, offset
)
662 tp_assign(size
, size
)
663 tp_assign(root_objectid
, root
->root_key
.objectid
)
666 TP_printk("root = %llu(%s), offset = %llu, size = %llu, "
667 "num_stripes = %d, sub_stripes = %d, type = %s",
668 show_root_type(__entry
->root_objectid
),
669 (unsigned long long)__entry
->offset
,
670 (unsigned long long)__entry
->size
,
671 __entry
->num_stripes
, __entry
->sub_stripes
,
672 show_chunk_type(__entry
->type
))
675 DEFINE_EVENT(btrfs__chunk
, btrfs_chunk_alloc
,
677 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
678 u64 offset
, u64 size
),
680 TP_ARGS(root
, map
, offset
, size
)
683 DEFINE_EVENT(btrfs__chunk
, btrfs_chunk_free
,
685 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
686 u64 offset
, u64 size
),
688 TP_ARGS(root
, map
, offset
, size
)
691 TRACE_EVENT(btrfs_cow_block
,
693 TP_PROTO(struct btrfs_root
*root
, struct extent_buffer
*buf
,
694 struct extent_buffer
*cow
),
696 TP_ARGS(root
, buf
, cow
),
699 __field( u64
, root_objectid
)
700 __field( u64
, buf_start
)
702 __field( u64
, cow_start
)
703 __field( int, buf_level
)
704 __field( int, cow_level
)
708 tp_assign(root_objectid
, root
->root_key
.objectid
)
709 tp_assign(buf_start
, buf
->start
)
710 tp_assign(refs
, atomic_read(&buf
->refs
))
711 tp_assign(cow_start
, cow
->start
)
712 tp_assign(buf_level
, btrfs_header_level(buf
))
713 tp_assign(cow_level
, btrfs_header_level(cow
))
716 TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu "
717 "(orig_level = %d), cow_buf = %llu (cow_level = %d)",
718 show_root_type(__entry
->root_objectid
),
720 (unsigned long long)__entry
->buf_start
,
722 (unsigned long long)__entry
->cow_start
,
726 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
727 TRACE_EVENT(btrfs_space_reservation
,
729 TP_PROTO(struct btrfs_fs_info
*fs_info
, char *type
, u64 val
,
730 u64 bytes
, int reserve
),
732 TP_ARGS(fs_info
, type
, val
, bytes
, reserve
),
735 __array( u8
, fsid
, BTRFS_UUID_SIZE
)
736 __string( type
, type
)
738 __field( u64
, bytes
)
739 __field( int, reserve
)
743 tp_memcpy(fsid
, fs_info
->fsid
, BTRFS_UUID_SIZE
)
744 tp_strcpy(type
, type
)
746 tp_assign(bytes
, bytes
)
747 tp_assign(reserve
, reserve
)
750 TP_printk("%pU: %s: %Lu %s %Lu", __entry
->fsid
, __get_str(type
),
751 __entry
->val
, __entry
->reserve
? "reserve" : "release",
756 DECLARE_EVENT_CLASS(btrfs__reserved_extent
,
758 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
760 TP_ARGS(root
, start
, len
),
763 __field( u64
, root_objectid
)
764 __field( u64
, start
)
769 tp_assign(root_objectid
, root
->root_key
.objectid
)
770 tp_assign(start
, start
)
774 TP_printk("root = %llu(%s), start = %llu, len = %llu",
775 show_root_type(__entry
->root_objectid
),
776 (unsigned long long)__entry
->start
,
777 (unsigned long long)__entry
->len
)
780 DEFINE_EVENT(btrfs__reserved_extent
, btrfs_reserved_extent_alloc
,
782 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
784 TP_ARGS(root
, start
, len
)
787 DEFINE_EVENT(btrfs__reserved_extent
, btrfs_reserved_extent_free
,
789 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
791 TP_ARGS(root
, start
, len
)
794 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
795 TRACE_EVENT(find_free_extent
,
797 TP_PROTO(struct btrfs_root
*root
, u64 num_bytes
, u64 empty_size
,
800 TP_ARGS(root
, num_bytes
, empty_size
, data
),
803 __field( u64
, root_objectid
)
804 __field( u64
, num_bytes
)
805 __field( u64
, empty_size
)
810 tp_assign(root_objectid
, root
->root_key
.objectid
)
811 tp_assign(num_bytes
, num_bytes
)
812 tp_assign(empty_size
, empty_size
)
813 tp_assign(data
, data
)
816 TP_printk("root = %Lu(%s), len = %Lu, empty_size = %Lu, "
817 "flags = %Lu(%s)", show_root_type(__entry
->root_objectid
),
818 __entry
->num_bytes
, __entry
->empty_size
, __entry
->data
,
819 __print_flags((unsigned long)__entry
->data
, "|",
823 DECLARE_EVENT_CLASS(btrfs__reserve_extent
,
825 TP_PROTO(struct btrfs_root
*root
,
826 struct btrfs_block_group_cache
*block_group
, u64 start
,
829 TP_ARGS(root
, block_group
, start
, len
),
832 __field( u64
, root_objectid
)
833 __field( u64
, bg_objectid
)
834 __field( u64
, flags
)
835 __field( u64
, start
)
840 tp_assign(root_objectid
, root
->root_key
.objectid
)
841 tp_assign(bg_objectid
, block_group
->key
.objectid
)
842 tp_assign(flags
, block_group
->flags
)
843 tp_assign(start
, start
)
847 TP_printk("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), "
848 "start = %Lu, len = %Lu",
849 show_root_type(__entry
->root_objectid
), __entry
->bg_objectid
,
850 __entry
->flags
, __print_flags((unsigned long)__entry
->flags
,
851 "|", BTRFS_GROUP_FLAGS
),
852 __entry
->start
, __entry
->len
)
855 DEFINE_EVENT(btrfs__reserve_extent
, btrfs_reserve_extent
,
857 TP_PROTO(struct btrfs_root
*root
,
858 struct btrfs_block_group_cache
*block_group
, u64 start
,
861 TP_ARGS(root
, block_group
, start
, len
)
864 DEFINE_EVENT(btrfs__reserve_extent
, btrfs_reserve_extent_cluster
,
866 TP_PROTO(struct btrfs_root
*root
,
867 struct btrfs_block_group_cache
*block_group
, u64 start
,
870 TP_ARGS(root
, block_group
, start
, len
)
873 TRACE_EVENT(btrfs_find_cluster
,
875 TP_PROTO(struct btrfs_block_group_cache
*block_group
, u64 start
,
876 u64 bytes
, u64 empty_size
, u64 min_bytes
),
878 TP_ARGS(block_group
, start
, bytes
, empty_size
, min_bytes
),
881 __field( u64
, bg_objectid
)
882 __field( u64
, flags
)
883 __field( u64
, start
)
884 __field( u64
, bytes
)
885 __field( u64
, empty_size
)
886 __field( u64
, min_bytes
)
890 tp_assign(bg_objectid
, block_group
->key
.objectid
)
891 tp_assign(flags
, block_group
->flags
)
892 tp_assign(start
, start
)
893 tp_assign(bytes
, bytes
)
894 tp_assign(empty_size
, empty_size
)
895 tp_assign(min_bytes
, min_bytes
)
898 TP_printk("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu,"
899 " empty_size = %Lu, min_bytes = %Lu", __entry
->bg_objectid
,
901 __print_flags((unsigned long)__entry
->flags
, "|",
902 BTRFS_GROUP_FLAGS
), __entry
->start
,
903 __entry
->bytes
, __entry
->empty_size
, __entry
->min_bytes
)
906 TRACE_EVENT(btrfs_failed_cluster_setup
,
908 TP_PROTO(struct btrfs_block_group_cache
*block_group
),
910 TP_ARGS(block_group
),
913 __field( u64
, bg_objectid
)
917 tp_assign(bg_objectid
, block_group
->key
.objectid
)
920 TP_printk("block_group = %Lu", __entry
->bg_objectid
)
923 TRACE_EVENT(btrfs_setup_cluster
,
925 TP_PROTO(struct btrfs_block_group_cache
*block_group
,
926 struct btrfs_free_cluster
*cluster
, u64 size
, int bitmap
),
928 TP_ARGS(block_group
, cluster
, size
, bitmap
),
931 __field( u64
, bg_objectid
)
932 __field( u64
, flags
)
933 __field( u64
, start
)
934 __field( u64
, max_size
)
936 __field( int, bitmap
)
940 tp_assign(bg_objectid
, block_group
->key
.objectid
)
941 tp_assign(flags
, block_group
->flags
)
942 tp_assign(start
, cluster
->window_start
)
943 tp_assign(max_size
, cluster
->max_size
)
944 tp_assign(size
, size
)
945 tp_assign(bitmap
, bitmap
)
948 TP_printk("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, "
949 "size = %Lu, max_size = %Lu, bitmap = %d",
950 __entry
->bg_objectid
,
952 __print_flags((unsigned long)__entry
->flags
, "|",
953 BTRFS_GROUP_FLAGS
), __entry
->start
,
954 __entry
->size
, __entry
->max_size
, __entry
->bitmap
)
958 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
959 TRACE_EVENT(alloc_extent_state
,
961 TP_PROTO(struct extent_state
*state
, gfp_t mask
, unsigned long IP
),
963 TP_ARGS(state
, mask
, IP
),
966 __field(struct extent_state
*, state
)
968 __field(unsigned long, ip
)
972 tp_assign(state
, state
)
973 tp_assign(mask
, mask
)
977 TP_printk("state=%p; mask = %s; caller = %pF", __entry
->state
,
978 show_gfp_flags(__entry
->mask
), (void *)__entry
->ip
)
981 TRACE_EVENT(free_extent_state
,
983 TP_PROTO(struct extent_state
*state
, unsigned long IP
),
988 __field(struct extent_state
*, state
)
989 __field(unsigned long, ip
)
993 tp_assign(state
, state
)
997 TP_printk(" state=%p; caller = %pF", __entry
->state
,
1002 #endif /* _TRACE_BTRFS_H */
1004 /* This part must be outside protection */
1005 #include "../../../probes/define_trace.h"