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 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
71 #define show_root_type(obj) \
72 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
73 (obj >= BTRFS_ROOT_TREE_OBJECTID && \
74 obj <= BTRFS_CSUM_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
75 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) */
76 #define show_root_type(obj) \
77 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
78 (obj <= BTRFS_CSUM_TREE_OBJECTID )) ? __show_root_type(obj) : "-"
79 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) */
81 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
83 #define BTRFS_GROUP_FLAGS \
84 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \
85 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
86 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
87 { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \
88 { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \
89 { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \
90 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}
92 #define BTRFS_UUID_SIZE 16
96 TRACE_EVENT(btrfs_transaction_commit
,
98 TP_PROTO(struct btrfs_root
*root
),
103 __field( u64
, generation
)
104 __field( u64
, root_objectid
)
108 tp_assign(generation
, root
->fs_info
->generation
)
109 tp_assign(root_objectid
, root
->root_key
.objectid
)
112 TP_printk("root = %llu(%s), gen = %llu",
113 show_root_type(__entry
->root_objectid
),
114 (unsigned long long)__entry
->generation
)
117 DECLARE_EVENT_CLASS(btrfs__inode
,
119 TP_PROTO(struct inode
*inode
),
124 __field( ino_t
, ino
)
125 __field( blkcnt_t
, blocks
)
126 __field( u64
, disk_i_size
)
127 __field( u64
, generation
)
128 __field( u64
, last_trans
)
129 __field( u64
, logged_trans
)
130 __field( u64
, root_objectid
)
134 tp_assign(ino
, inode
->i_ino
)
135 tp_assign(blocks
, inode
->i_blocks
)
136 tp_assign(disk_i_size
, BTRFS_I(inode
)->disk_i_size
)
137 tp_assign(generation
, BTRFS_I(inode
)->generation
)
138 tp_assign(last_trans
, BTRFS_I(inode
)->last_trans
)
139 tp_assign(logged_trans
, BTRFS_I(inode
)->logged_trans
)
140 tp_assign(root_objectid
,
141 BTRFS_I(inode
)->root
->root_key
.objectid
)
144 TP_printk("root = %llu(%s), gen = %llu, ino = %lu, blocks = %llu, "
145 "disk_i_size = %llu, last_trans = %llu, logged_trans = %llu",
146 show_root_type(__entry
->root_objectid
),
147 (unsigned long long)__entry
->generation
,
148 (unsigned long)__entry
->ino
,
149 (unsigned long long)__entry
->blocks
,
150 (unsigned long long)__entry
->disk_i_size
,
151 (unsigned long long)__entry
->last_trans
,
152 (unsigned long long)__entry
->logged_trans
)
155 DEFINE_EVENT(btrfs__inode
, btrfs_inode_new
,
157 TP_PROTO(struct inode
*inode
),
162 DEFINE_EVENT(btrfs__inode
, btrfs_inode_request
,
164 TP_PROTO(struct inode
*inode
),
169 DEFINE_EVENT(btrfs__inode
, btrfs_inode_evict
,
171 TP_PROTO(struct inode
*inode
),
176 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,40))
177 #define __show_map_type(type) \
178 __print_symbolic_u64(type, \
179 { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \
180 { EXTENT_MAP_HOLE, "HOLE" }, \
181 { EXTENT_MAP_INLINE, "INLINE" }, \
182 { EXTENT_MAP_DELALLOC, "DELALLOC" })
184 #define __show_map_type(type) \
185 __print_symbolic(type, \
186 { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \
187 { EXTENT_MAP_HOLE, "HOLE" }, \
188 { EXTENT_MAP_INLINE, "INLINE" }, \
189 { EXTENT_MAP_DELALLOC, "DELALLOC" })
192 #define show_map_type(type) \
193 type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type)
195 #define show_map_flags(flag) \
196 __print_flags(flag, "|", \
197 { EXTENT_FLAG_PINNED, "PINNED" }, \
198 { EXTENT_FLAG_COMPRESSED, "COMPRESSED" }, \
199 { EXTENT_FLAG_VACANCY, "VACANCY" }, \
200 { EXTENT_FLAG_PREALLOC, "PREALLOC" })
202 TRACE_EVENT(btrfs_get_extent
,
204 TP_PROTO(struct btrfs_root
*root
, struct extent_map
*map
),
209 __field( u64
, root_objectid
)
210 __field( u64
, start
)
212 __field( u64
, orig_start
)
213 __field( u64
, block_start
)
214 __field( u64
, block_len
)
215 __field( unsigned long, flags
)
217 __field( unsigned int, compress_type
)
221 tp_assign(root_objectid
, root
->root_key
.objectid
)
222 tp_assign(start
, map
->start
)
223 tp_assign(len
, map
->len
)
224 tp_assign(orig_start
, map
->orig_start
)
225 tp_assign(block_start
, map
->block_start
)
226 tp_assign(block_len
, map
->block_len
)
227 tp_assign(flags
, map
->flags
)
228 tp_assign(refs
, atomic_read(&map
->refs
))
229 tp_assign(compress_type
, map
->compress_type
)
232 TP_printk("root = %llu(%s), start = %llu, len = %llu, "
233 "orig_start = %llu, block_start = %llu(%s), "
234 "block_len = %llu, flags = %s, refs = %u, "
235 "compress_type = %u",
236 show_root_type(__entry
->root_objectid
),
237 (unsigned long long)__entry
->start
,
238 (unsigned long long)__entry
->len
,
239 (unsigned long long)__entry
->orig_start
,
240 show_map_type(__entry
->block_start
),
241 (unsigned long long)__entry
->block_len
,
242 show_map_flags(__entry
->flags
),
243 __entry
->refs
, __entry
->compress_type
)
246 #define show_ordered_flags(flags) \
247 __print_symbolic(flags, \
248 { BTRFS_ORDERED_IO_DONE, "IO_DONE" }, \
249 { BTRFS_ORDERED_COMPLETE, "COMPLETE" }, \
250 { BTRFS_ORDERED_NOCOW, "NOCOW" }, \
251 { BTRFS_ORDERED_COMPRESSED, "COMPRESSED" }, \
252 { BTRFS_ORDERED_PREALLOC, "PREALLOC" }, \
253 { BTRFS_ORDERED_DIRECT, "DIRECT" })
255 DECLARE_EVENT_CLASS(btrfs__ordered_extent
,
257 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
259 TP_ARGS(inode
, ordered
),
262 __field( ino_t
, ino
)
263 __field( u64
, file_offset
)
264 __field( u64
, start
)
266 __field( u64
, disk_len
)
267 __field( u64
, bytes_left
)
268 __field( unsigned long, flags
)
269 __field( int, compress_type
)
271 __field( u64
, root_objectid
)
275 tp_assign(ino
, inode
->i_ino
)
276 tp_assign(file_offset
, ordered
->file_offset
)
277 tp_assign(start
, ordered
->start
)
278 tp_assign(len
, ordered
->len
)
279 tp_assign(disk_len
, ordered
->disk_len
)
280 tp_assign(bytes_left
, ordered
->bytes_left
)
281 tp_assign(flags
, ordered
->flags
)
282 tp_assign(compress_type
, ordered
->compress_type
)
283 tp_assign(refs
, atomic_read(&ordered
->refs
))
284 tp_assign(root_objectid
,
285 BTRFS_I(inode
)->root
->root_key
.objectid
)
288 TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, "
289 "start = %llu, len = %llu, disk_len = %llu, "
290 "bytes_left = %llu, flags = %s, compress_type = %d, "
292 show_root_type(__entry
->root_objectid
),
293 (unsigned long long)__entry
->ino
,
294 (unsigned long long)__entry
->file_offset
,
295 (unsigned long long)__entry
->start
,
296 (unsigned long long)__entry
->len
,
297 (unsigned long long)__entry
->disk_len
,
298 (unsigned long long)__entry
->bytes_left
,
299 show_ordered_flags(__entry
->flags
),
300 __entry
->compress_type
, __entry
->refs
)
303 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_add
,
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_remove
,
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_start
,
319 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
321 TP_ARGS(inode
, ordered
)
324 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_put
,
326 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
328 TP_ARGS(inode
, ordered
)
331 DECLARE_EVENT_CLASS(btrfs__writepage
,
333 TP_PROTO(struct page
*page
, struct inode
*inode
,
334 struct writeback_control
*wbc
),
336 TP_ARGS(page
, inode
, wbc
),
339 __field( ino_t
, ino
)
340 __field( pgoff_t
, index
)
341 __field( long, nr_to_write
)
342 __field( long, pages_skipped
)
343 __field( loff_t
, range_start
)
344 __field( loff_t
, range_end
)
345 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
346 __field( char, nonblocking
)
348 __field( char, for_kupdate
)
349 __field( char, for_reclaim
)
350 __field( char, range_cyclic
)
351 __field( pgoff_t
, writeback_index
)
352 __field( u64
, root_objectid
)
356 tp_assign(ino
, inode
->i_ino
)
357 tp_assign(index
, page
->index
)
358 tp_assign(nr_to_write
, wbc
->nr_to_write
)
359 tp_assign(pages_skipped
, wbc
->pages_skipped
)
360 tp_assign(range_start
, wbc
->range_start
)
361 tp_assign(range_end
, wbc
->range_end
)
362 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
363 tp_assign(nonblocking
, wbc
->nonblocking
)
365 tp_assign(for_kupdate
, wbc
->for_kupdate
)
366 tp_assign(for_reclaim
, wbc
->for_reclaim
)
367 tp_assign(range_cyclic
, wbc
->range_cyclic
)
368 tp_assign(writeback_index
, inode
->i_mapping
->writeback_index
)
369 tp_assign(root_objectid
,
370 BTRFS_I(inode
)->root
->root_key
.objectid
)
373 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
374 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, "
375 "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, "
376 "range_end = %llu, nonblocking = %d, for_kupdate = %d, "
377 "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu",
378 show_root_type(__entry
->root_objectid
),
379 (unsigned long)__entry
->ino
, __entry
->index
,
380 __entry
->nr_to_write
, __entry
->pages_skipped
,
381 __entry
->range_start
, __entry
->range_end
,
382 __entry
->nonblocking
, __entry
->for_kupdate
,
383 __entry
->for_reclaim
, __entry
->range_cyclic
,
384 (unsigned long)__entry
->writeback_index
)
386 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, "
387 "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, "
388 "range_end = %llu, for_kupdate = %d, "
389 "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu",
390 show_root_type(__entry
->root_objectid
),
391 (unsigned long)__entry
->ino
, __entry
->index
,
392 __entry
->nr_to_write
, __entry
->pages_skipped
,
393 __entry
->range_start
, __entry
->range_end
,
394 __entry
->for_kupdate
,
395 __entry
->for_reclaim
, __entry
->range_cyclic
,
396 (unsigned long)__entry
->writeback_index
)
400 DEFINE_EVENT(btrfs__writepage
, __extent_writepage
,
402 TP_PROTO(struct page
*page
, struct inode
*inode
,
403 struct writeback_control
*wbc
),
405 TP_ARGS(page
, inode
, wbc
)
408 TRACE_EVENT(btrfs_writepage_end_io_hook
,
410 TP_PROTO(struct page
*page
, u64 start
, u64 end
, int uptodate
),
412 TP_ARGS(page
, start
, end
, uptodate
),
415 __field( ino_t
, ino
)
416 __field( pgoff_t
, index
)
417 __field( u64
, start
)
419 __field( int, uptodate
)
420 __field( u64
, root_objectid
)
424 tp_assign(ino
, page
->mapping
->host
->i_ino
)
425 tp_assign(index
, page
->index
)
426 tp_assign(start
, start
)
428 tp_assign(uptodate
, uptodate
)
429 tp_assign(root_objectid
,
430 BTRFS_I(page
->mapping
->host
)->root
->root_key
.objectid
)
433 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, "
434 "end = %llu, uptodate = %d",
435 show_root_type(__entry
->root_objectid
),
436 (unsigned long)__entry
->ino
, (unsigned long)__entry
->index
,
437 (unsigned long long)__entry
->start
,
438 (unsigned long long)__entry
->end
, __entry
->uptodate
)
441 TRACE_EVENT(btrfs_sync_file
,
443 TP_PROTO(struct file
*file
, int datasync
),
445 TP_ARGS(file
, datasync
),
448 __field( ino_t
, ino
)
449 __field( ino_t
, parent
)
450 __field( int, datasync
)
451 __field( u64
, root_objectid
)
455 tp_assign(ino
, file
->f_path
.dentry
->d_inode
->i_ino
)
456 tp_assign(parent
, file
->f_path
.dentry
->d_parent
->d_inode
->i_ino
)
457 tp_assign(datasync
, datasync
)
458 tp_assign(root_objectid
,
459 BTRFS_I(file
->f_path
.dentry
->d_inode
)->root
->root_key
.objectid
)
462 TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d",
463 show_root_type(__entry
->root_objectid
),
464 (unsigned long)__entry
->ino
, (unsigned long)__entry
->parent
,
468 TRACE_EVENT(btrfs_sync_fs
,
479 tp_assign(wait
, wait
)
482 TP_printk("wait = %d", __entry
->wait
)
485 #define show_ref_action(action) \
486 __print_symbolic(action, \
487 { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \
488 { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \
489 { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \
490 { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
493 TRACE_EVENT(btrfs_delayed_tree_ref
,
495 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
496 struct btrfs_delayed_tree_ref
*full_ref
,
499 TP_ARGS(ref
, full_ref
, action
),
502 __field( u64
, bytenr
)
503 __field( u64
, num_bytes
)
504 __field( int, action
)
505 __field( u64
, parent
)
506 __field( u64
, ref_root
)
507 __field( int, level
)
509 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
515 tp_assign(bytenr
, ref
->bytenr
)
516 tp_assign(num_bytes
, ref
->num_bytes
)
517 tp_assign(action
, action
)
518 tp_assign(parent
, full_ref
->parent
)
519 tp_assign(ref_root
, full_ref
->root
)
520 tp_assign(level
, full_ref
->level
)
521 tp_assign(type
, ref
->type
)
522 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
523 tp_assign(seq
, ref
->seq
)
527 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
528 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
529 "parent = %llu(%s), ref_root = %llu(%s), level = %d, "
530 "type = %s, seq = %llu",
532 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
533 "parent = %llu(%s), ref_root = %llu(%s), level = %d, "
536 (unsigned long long)__entry
->bytenr
,
537 (unsigned long long)__entry
->num_bytes
,
538 show_ref_action(__entry
->action
),
539 show_root_type(__entry
->parent
),
540 show_root_type(__entry
->ref_root
),
541 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
542 __entry
->level
, show_ref_type(__entry
->type
),
543 (unsigned long long)__entry
->seq
)
545 __entry
->level
, show_ref_type(__entry
->type
))
549 TRACE_EVENT(btrfs_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 __field( u64
, bytenr
)
559 __field( u64
, num_bytes
)
560 __field( int, action
)
561 __field( u64
, parent
)
562 __field( u64
, ref_root
)
563 __field( u64
, owner
)
564 __field( u64
, offset
)
566 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
572 tp_assign(bytenr
, ref
->bytenr
)
573 tp_assign(num_bytes
, ref
->num_bytes
)
574 tp_assign(action
, action
)
575 tp_assign(parent
, full_ref
->parent
)
576 tp_assign(ref_root
, full_ref
->root
)
577 tp_assign(owner
, full_ref
->objectid
)
578 tp_assign(offset
, full_ref
->offset
)
579 tp_assign(type
, ref
->type
)
580 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
581 tp_assign(seq
, ref
->seq
)
585 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
586 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
587 "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, "
588 "offset = %llu, type = %s, seq = %llu",
590 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
591 "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, "
592 "offset = %llu, type = %s",
594 (unsigned long long)__entry
->bytenr
,
595 (unsigned long long)__entry
->num_bytes
,
596 show_ref_action(__entry
->action
),
597 show_root_type(__entry
->parent
),
598 show_root_type(__entry
->ref_root
),
599 (unsigned long long)__entry
->owner
,
600 (unsigned long long)__entry
->offset
,
601 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
602 show_ref_type(__entry
->type
),
603 (unsigned long long)__entry
->seq
)
605 show_ref_type(__entry
->type
))
609 TRACE_EVENT(btrfs_delayed_ref_head
,
611 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
612 struct btrfs_delayed_ref_head
*head_ref
,
615 TP_ARGS(ref
, head_ref
, action
),
618 __field( u64
, bytenr
)
619 __field( u64
, num_bytes
)
620 __field( int, action
)
621 __field( int, is_data
)
625 tp_assign(bytenr
, ref
->bytenr
)
626 tp_assign(num_bytes
, ref
->num_bytes
)
627 tp_assign(action
, action
)
628 tp_assign(is_data
, head_ref
->is_data
)
631 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d",
632 (unsigned long long)__entry
->bytenr
,
633 (unsigned long long)__entry
->num_bytes
,
634 show_ref_action(__entry
->action
),
638 #define show_chunk_type(type) \
639 __print_flags(type, "|", \
640 { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \
641 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
642 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
643 { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \
644 { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \
645 { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \
646 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"})
648 DECLARE_EVENT_CLASS(btrfs__chunk
,
650 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
651 u64 offset
, u64 size
),
653 TP_ARGS(root
, map
, offset
, size
),
656 __field( int, num_stripes
)
658 __field( int, sub_stripes
)
659 __field( u64
, offset
)
661 __field( u64
, root_objectid
)
665 tp_assign(num_stripes
, map
->num_stripes
)
666 tp_assign(type
, map
->type
)
667 tp_assign(sub_stripes
, map
->sub_stripes
)
668 tp_assign(offset
, offset
)
669 tp_assign(size
, size
)
670 tp_assign(root_objectid
, root
->root_key
.objectid
)
673 TP_printk("root = %llu(%s), offset = %llu, size = %llu, "
674 "num_stripes = %d, sub_stripes = %d, type = %s",
675 show_root_type(__entry
->root_objectid
),
676 (unsigned long long)__entry
->offset
,
677 (unsigned long long)__entry
->size
,
678 __entry
->num_stripes
, __entry
->sub_stripes
,
679 show_chunk_type(__entry
->type
))
682 DEFINE_EVENT(btrfs__chunk
, btrfs_chunk_alloc
,
684 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
685 u64 offset
, u64 size
),
687 TP_ARGS(root
, map
, offset
, size
)
690 DEFINE_EVENT(btrfs__chunk
, btrfs_chunk_free
,
692 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
693 u64 offset
, u64 size
),
695 TP_ARGS(root
, map
, offset
, size
)
698 TRACE_EVENT(btrfs_cow_block
,
700 TP_PROTO(struct btrfs_root
*root
, struct extent_buffer
*buf
,
701 struct extent_buffer
*cow
),
703 TP_ARGS(root
, buf
, cow
),
706 __field( u64
, root_objectid
)
707 __field( u64
, buf_start
)
709 __field( u64
, cow_start
)
710 __field( int, buf_level
)
711 __field( int, cow_level
)
715 tp_assign(root_objectid
, root
->root_key
.objectid
)
716 tp_assign(buf_start
, buf
->start
)
717 tp_assign(refs
, atomic_read(&buf
->refs
))
718 tp_assign(cow_start
, cow
->start
)
719 tp_assign(buf_level
, btrfs_header_level(buf
))
720 tp_assign(cow_level
, btrfs_header_level(cow
))
723 TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu "
724 "(orig_level = %d), cow_buf = %llu (cow_level = %d)",
725 show_root_type(__entry
->root_objectid
),
727 (unsigned long long)__entry
->buf_start
,
729 (unsigned long long)__entry
->cow_start
,
733 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
734 TRACE_EVENT(btrfs_space_reservation
,
736 TP_PROTO(struct btrfs_fs_info
*fs_info
, char *type
, u64 val
,
737 u64 bytes
, int reserve
),
739 TP_ARGS(fs_info
, type
, val
, bytes
, reserve
),
742 __array( u8
, fsid
, BTRFS_UUID_SIZE
)
743 __string( type
, type
)
745 __field( u64
, bytes
)
746 __field( int, reserve
)
750 tp_memcpy(fsid
, fs_info
->fsid
, BTRFS_UUID_SIZE
)
751 tp_strcpy(type
, type
)
753 tp_assign(bytes
, bytes
)
754 tp_assign(reserve
, reserve
)
757 TP_printk("%pU: %s: %Lu %s %Lu", __entry
->fsid
, __get_str(type
),
758 __entry
->val
, __entry
->reserve
? "reserve" : "release",
763 DECLARE_EVENT_CLASS(btrfs__reserved_extent
,
765 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
767 TP_ARGS(root
, start
, len
),
770 __field( u64
, root_objectid
)
771 __field( u64
, start
)
776 tp_assign(root_objectid
, root
->root_key
.objectid
)
777 tp_assign(start
, start
)
781 TP_printk("root = %llu(%s), start = %llu, len = %llu",
782 show_root_type(__entry
->root_objectid
),
783 (unsigned long long)__entry
->start
,
784 (unsigned long long)__entry
->len
)
787 DEFINE_EVENT(btrfs__reserved_extent
, btrfs_reserved_extent_alloc
,
789 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
791 TP_ARGS(root
, start
, len
)
794 DEFINE_EVENT(btrfs__reserved_extent
, btrfs_reserved_extent_free
,
796 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
798 TP_ARGS(root
, start
, len
)
801 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
802 TRACE_EVENT(find_free_extent
,
804 TP_PROTO(struct btrfs_root
*root
, u64 num_bytes
, u64 empty_size
,
807 TP_ARGS(root
, num_bytes
, empty_size
, data
),
810 __field( u64
, root_objectid
)
811 __field( u64
, num_bytes
)
812 __field( u64
, empty_size
)
817 tp_assign(root_objectid
, root
->root_key
.objectid
)
818 tp_assign(num_bytes
, num_bytes
)
819 tp_assign(empty_size
, empty_size
)
820 tp_assign(data
, data
)
823 TP_printk("root = %Lu(%s), len = %Lu, empty_size = %Lu, "
824 "flags = %Lu(%s)", show_root_type(__entry
->root_objectid
),
825 __entry
->num_bytes
, __entry
->empty_size
, __entry
->data
,
826 __print_flags((unsigned long)__entry
->data
, "|",
830 DECLARE_EVENT_CLASS(btrfs__reserve_extent
,
832 TP_PROTO(struct btrfs_root
*root
,
833 struct btrfs_block_group_cache
*block_group
, u64 start
,
836 TP_ARGS(root
, block_group
, start
, len
),
839 __field( u64
, root_objectid
)
840 __field( u64
, bg_objectid
)
841 __field( u64
, flags
)
842 __field( u64
, start
)
847 tp_assign(root_objectid
, root
->root_key
.objectid
)
848 tp_assign(bg_objectid
, block_group
->key
.objectid
)
849 tp_assign(flags
, block_group
->flags
)
850 tp_assign(start
, start
)
854 TP_printk("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), "
855 "start = %Lu, len = %Lu",
856 show_root_type(__entry
->root_objectid
), __entry
->bg_objectid
,
857 __entry
->flags
, __print_flags((unsigned long)__entry
->flags
,
858 "|", BTRFS_GROUP_FLAGS
),
859 __entry
->start
, __entry
->len
)
862 DEFINE_EVENT(btrfs__reserve_extent
, btrfs_reserve_extent
,
864 TP_PROTO(struct btrfs_root
*root
,
865 struct btrfs_block_group_cache
*block_group
, u64 start
,
868 TP_ARGS(root
, block_group
, start
, len
)
871 DEFINE_EVENT(btrfs__reserve_extent
, btrfs_reserve_extent_cluster
,
873 TP_PROTO(struct btrfs_root
*root
,
874 struct btrfs_block_group_cache
*block_group
, u64 start
,
877 TP_ARGS(root
, block_group
, start
, len
)
880 TRACE_EVENT(btrfs_find_cluster
,
882 TP_PROTO(struct btrfs_block_group_cache
*block_group
, u64 start
,
883 u64 bytes
, u64 empty_size
, u64 min_bytes
),
885 TP_ARGS(block_group
, start
, bytes
, empty_size
, min_bytes
),
888 __field( u64
, bg_objectid
)
889 __field( u64
, flags
)
890 __field( u64
, start
)
891 __field( u64
, bytes
)
892 __field( u64
, empty_size
)
893 __field( u64
, min_bytes
)
897 tp_assign(bg_objectid
, block_group
->key
.objectid
)
898 tp_assign(flags
, block_group
->flags
)
899 tp_assign(start
, start
)
900 tp_assign(bytes
, bytes
)
901 tp_assign(empty_size
, empty_size
)
902 tp_assign(min_bytes
, min_bytes
)
905 TP_printk("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu,"
906 " empty_size = %Lu, min_bytes = %Lu", __entry
->bg_objectid
,
908 __print_flags((unsigned long)__entry
->flags
, "|",
909 BTRFS_GROUP_FLAGS
), __entry
->start
,
910 __entry
->bytes
, __entry
->empty_size
, __entry
->min_bytes
)
913 TRACE_EVENT(btrfs_failed_cluster_setup
,
915 TP_PROTO(struct btrfs_block_group_cache
*block_group
),
917 TP_ARGS(block_group
),
920 __field( u64
, bg_objectid
)
924 tp_assign(bg_objectid
, block_group
->key
.objectid
)
927 TP_printk("block_group = %Lu", __entry
->bg_objectid
)
930 TRACE_EVENT(btrfs_setup_cluster
,
932 TP_PROTO(struct btrfs_block_group_cache
*block_group
,
933 struct btrfs_free_cluster
*cluster
, u64 size
, int bitmap
),
935 TP_ARGS(block_group
, cluster
, size
, bitmap
),
938 __field( u64
, bg_objectid
)
939 __field( u64
, flags
)
940 __field( u64
, start
)
941 __field( u64
, max_size
)
943 __field( int, bitmap
)
947 tp_assign(bg_objectid
, block_group
->key
.objectid
)
948 tp_assign(flags
, block_group
->flags
)
949 tp_assign(start
, cluster
->window_start
)
950 tp_assign(max_size
, cluster
->max_size
)
951 tp_assign(size
, size
)
952 tp_assign(bitmap
, bitmap
)
955 TP_printk("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, "
956 "size = %Lu, max_size = %Lu, bitmap = %d",
957 __entry
->bg_objectid
,
959 __print_flags((unsigned long)__entry
->flags
, "|",
960 BTRFS_GROUP_FLAGS
), __entry
->start
,
961 __entry
->size
, __entry
->max_size
, __entry
->bitmap
)
965 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
966 TRACE_EVENT(alloc_extent_state
,
968 TP_PROTO(struct extent_state
*state
, gfp_t mask
, unsigned long IP
),
970 TP_ARGS(state
, mask
, IP
),
973 __field(struct extent_state
*, state
)
975 __field(unsigned long, ip
)
979 tp_assign(state
, state
)
980 tp_assign(mask
, mask
)
984 TP_printk("state=%p; mask = %s; caller = %pF", __entry
->state
,
985 show_gfp_flags(__entry
->mask
), (void *)__entry
->ip
)
988 TRACE_EVENT(free_extent_state
,
990 TP_PROTO(struct extent_state
*state
, unsigned long IP
),
995 __field(struct extent_state
*, state
)
996 __field(unsigned long, ip
)
1000 tp_assign(state
, state
)
1004 TP_printk(" state=%p; caller = %pF", __entry
->state
,
1005 (void *)__entry
->ip
)
1009 #endif /* _TRACE_BTRFS_H */
1011 /* This part must be outside protection */
1012 #include "../../../probes/define_trace.h"