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" })
43 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
44 #define __show_root_type(obj) \
45 __print_symbolic_u64(obj, \
46 { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \
47 { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \
48 { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \
49 { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \
50 { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \
51 { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \
52 { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \
53 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \
54 { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \
55 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \
56 { BTRFS_UUID_TREE_OBJECTID, "UUID_RELOC" }, \
57 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
58 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
59 #define __show_root_type(obj) \
60 __print_symbolic_u64(obj, \
61 { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \
62 { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \
63 { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \
64 { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \
65 { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \
66 { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \
67 { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \
68 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \
69 { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \
70 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \
71 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
72 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,40))
73 #define __show_root_type(obj) \
74 __print_symbolic_u64(obj, \
75 { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \
76 { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \
77 { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \
78 { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \
79 { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \
80 { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \
81 { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \
82 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \
83 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \
84 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
86 #define __show_root_type(obj) \
87 __print_symbolic(obj, \
88 { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \
89 { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \
90 { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \
91 { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \
92 { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \
93 { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \
94 { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \
95 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \
96 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \
97 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
100 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
101 #define show_root_type(obj) \
102 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
103 (obj >= BTRFS_ROOT_TREE_OBJECTID && \
104 obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
105 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
106 #define show_root_type(obj) \
107 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
108 (obj >= BTRFS_ROOT_TREE_OBJECTID && \
109 obj <= BTRFS_CSUM_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
110 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) */
111 #define show_root_type(obj) \
112 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
113 (obj <= BTRFS_CSUM_TREE_OBJECTID )) ? __show_root_type(obj) : "-"
114 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) */
116 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
118 #define BTRFS_GROUP_FLAGS \
119 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \
120 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
121 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
122 { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \
123 { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \
124 { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \
125 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
126 { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \
127 { BTRFS_BLOCK_GROUP_RAID6, "RAID6"}
129 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
131 #define BTRFS_GROUP_FLAGS \
132 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \
133 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
134 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
135 { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \
136 { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \
137 { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \
138 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}
140 #define BTRFS_UUID_SIZE 16
144 TRACE_EVENT(btrfs_transaction_commit
,
146 TP_PROTO(struct btrfs_root
*root
),
151 __field( u64
, generation
)
152 __field( u64
, root_objectid
)
156 tp_assign(generation
, root
->fs_info
->generation
)
157 tp_assign(root_objectid
, root
->root_key
.objectid
)
160 TP_printk("root = %llu(%s), gen = %llu",
161 show_root_type(__entry
->root_objectid
),
162 (unsigned long long)__entry
->generation
)
165 DECLARE_EVENT_CLASS(btrfs__inode
,
167 TP_PROTO(struct inode
*inode
),
172 __field( ino_t
, ino
)
173 __field( blkcnt_t
, blocks
)
174 __field( u64
, disk_i_size
)
175 __field( u64
, generation
)
176 __field( u64
, last_trans
)
177 __field( u64
, logged_trans
)
178 __field( u64
, root_objectid
)
182 tp_assign(ino
, inode
->i_ino
)
183 tp_assign(blocks
, inode
->i_blocks
)
184 tp_assign(disk_i_size
, BTRFS_I(inode
)->disk_i_size
)
185 tp_assign(generation
, BTRFS_I(inode
)->generation
)
186 tp_assign(last_trans
, BTRFS_I(inode
)->last_trans
)
187 tp_assign(logged_trans
, BTRFS_I(inode
)->logged_trans
)
188 tp_assign(root_objectid
,
189 BTRFS_I(inode
)->root
->root_key
.objectid
)
192 TP_printk("root = %llu(%s), gen = %llu, ino = %lu, blocks = %llu, "
193 "disk_i_size = %llu, last_trans = %llu, logged_trans = %llu",
194 show_root_type(__entry
->root_objectid
),
195 (unsigned long long)__entry
->generation
,
196 (unsigned long)__entry
->ino
,
197 (unsigned long long)__entry
->blocks
,
198 (unsigned long long)__entry
->disk_i_size
,
199 (unsigned long long)__entry
->last_trans
,
200 (unsigned long long)__entry
->logged_trans
)
203 DEFINE_EVENT(btrfs__inode
, btrfs_inode_new
,
205 TP_PROTO(struct inode
*inode
),
210 DEFINE_EVENT(btrfs__inode
, btrfs_inode_request
,
212 TP_PROTO(struct inode
*inode
),
217 DEFINE_EVENT(btrfs__inode
, btrfs_inode_evict
,
219 TP_PROTO(struct inode
*inode
),
224 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,40))
225 #define __show_map_type(type) \
226 __print_symbolic_u64(type, \
227 { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \
228 { EXTENT_MAP_HOLE, "HOLE" }, \
229 { EXTENT_MAP_INLINE, "INLINE" }, \
230 { EXTENT_MAP_DELALLOC, "DELALLOC" })
232 #define __show_map_type(type) \
233 __print_symbolic(type, \
234 { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \
235 { EXTENT_MAP_HOLE, "HOLE" }, \
236 { EXTENT_MAP_INLINE, "INLINE" }, \
237 { EXTENT_MAP_DELALLOC, "DELALLOC" })
240 #define show_map_type(type) \
241 type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type)
243 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
245 #define show_map_flags(flag) \
246 __print_flags(flag, "|", \
247 { EXTENT_FLAG_PINNED, "PINNED" }, \
248 { EXTENT_FLAG_COMPRESSED, "COMPRESSED" }, \
249 { EXTENT_FLAG_VACANCY, "VACANCY" }, \
250 { EXTENT_FLAG_PREALLOC, "PREALLOC" }, \
251 { EXTENT_FLAG_LOGGING, "LOGGING" }, \
252 { EXTENT_FLAG_FILLING, "FILLING" })
256 #define show_map_flags(flag) \
257 __print_flags(flag, "|", \
258 { EXTENT_FLAG_PINNED, "PINNED" }, \
259 { EXTENT_FLAG_COMPRESSED, "COMPRESSED" }, \
260 { EXTENT_FLAG_VACANCY, "VACANCY" }, \
261 { EXTENT_FLAG_PREALLOC, "PREALLOC" })
265 TRACE_EVENT(btrfs_get_extent
,
267 TP_PROTO(struct btrfs_root
*root
, struct extent_map
*map
),
272 __field( u64
, root_objectid
)
273 __field( u64
, start
)
275 __field( u64
, orig_start
)
276 __field( u64
, block_start
)
277 __field( u64
, block_len
)
278 __field( unsigned long, flags
)
280 __field( unsigned int, compress_type
)
284 tp_assign(root_objectid
, root
->root_key
.objectid
)
285 tp_assign(start
, map
->start
)
286 tp_assign(len
, map
->len
)
287 tp_assign(orig_start
, map
->orig_start
)
288 tp_assign(block_start
, map
->block_start
)
289 tp_assign(block_len
, map
->block_len
)
290 tp_assign(flags
, map
->flags
)
291 tp_assign(refs
, atomic_read(&map
->refs
))
292 tp_assign(compress_type
, map
->compress_type
)
295 TP_printk("root = %llu(%s), start = %llu, len = %llu, "
296 "orig_start = %llu, block_start = %llu(%s), "
297 "block_len = %llu, flags = %s, refs = %u, "
298 "compress_type = %u",
299 show_root_type(__entry
->root_objectid
),
300 (unsigned long long)__entry
->start
,
301 (unsigned long long)__entry
->len
,
302 (unsigned long long)__entry
->orig_start
,
303 show_map_type(__entry
->block_start
),
304 (unsigned long long)__entry
->block_len
,
305 show_map_flags(__entry
->flags
),
306 __entry
->refs
, __entry
->compress_type
)
309 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
311 #define show_ordered_flags(flags) \
312 __print_flags(flags, "|", \
313 { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \
314 { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \
315 { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \
316 { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \
317 { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \
318 { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \
319 { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \
320 { (1 << BTRFS_ORDERED_UPDATED_ISIZE), "UPDATED_ISIZE" }, \
321 { (1 << BTRFS_ORDERED_LOGGED_CSUM), "LOGGED_CSUM" }, \
322 { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" })
324 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
326 #define show_ordered_flags(flags) \
327 __print_symbolic(flags, \
328 { BTRFS_ORDERED_IO_DONE, "IO_DONE" }, \
329 { BTRFS_ORDERED_COMPLETE, "COMPLETE" }, \
330 { BTRFS_ORDERED_NOCOW, "NOCOW" }, \
331 { BTRFS_ORDERED_COMPRESSED, "COMPRESSED" }, \
332 { BTRFS_ORDERED_PREALLOC, "PREALLOC" }, \
333 { BTRFS_ORDERED_DIRECT, "DIRECT" }, \
334 { BTRFS_ORDERED_IOERR, "IOERR" }, \
335 { BTRFS_ORDERED_UPDATED_ISIZE, "UPDATED_ISIZE" }, \
336 { BTRFS_ORDERED_LOGGED_CSUM, "LOGGED_CSUM" })
340 #define show_ordered_flags(flags) \
341 __print_symbolic(flags, \
342 { BTRFS_ORDERED_IO_DONE, "IO_DONE" }, \
343 { BTRFS_ORDERED_COMPLETE, "COMPLETE" }, \
344 { BTRFS_ORDERED_NOCOW, "NOCOW" }, \
345 { BTRFS_ORDERED_COMPRESSED, "COMPRESSED" }, \
346 { BTRFS_ORDERED_PREALLOC, "PREALLOC" }, \
347 { BTRFS_ORDERED_DIRECT, "DIRECT" })
351 DECLARE_EVENT_CLASS(btrfs__ordered_extent
,
353 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
355 TP_ARGS(inode
, ordered
),
358 __field( ino_t
, ino
)
359 __field( u64
, file_offset
)
360 __field( u64
, start
)
362 __field( u64
, disk_len
)
363 __field( u64
, bytes_left
)
364 __field( unsigned long, flags
)
365 __field( int, compress_type
)
367 __field( u64
, root_objectid
)
371 tp_assign(ino
, inode
->i_ino
)
372 tp_assign(file_offset
, ordered
->file_offset
)
373 tp_assign(start
, ordered
->start
)
374 tp_assign(len
, ordered
->len
)
375 tp_assign(disk_len
, ordered
->disk_len
)
376 tp_assign(bytes_left
, ordered
->bytes_left
)
377 tp_assign(flags
, ordered
->flags
)
378 tp_assign(compress_type
, ordered
->compress_type
)
379 tp_assign(refs
, atomic_read(&ordered
->refs
))
380 tp_assign(root_objectid
,
381 BTRFS_I(inode
)->root
->root_key
.objectid
)
384 TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, "
385 "start = %llu, len = %llu, disk_len = %llu, "
386 "bytes_left = %llu, flags = %s, compress_type = %d, "
388 show_root_type(__entry
->root_objectid
),
389 (unsigned long long)__entry
->ino
,
390 (unsigned long long)__entry
->file_offset
,
391 (unsigned long long)__entry
->start
,
392 (unsigned long long)__entry
->len
,
393 (unsigned long long)__entry
->disk_len
,
394 (unsigned long long)__entry
->bytes_left
,
395 show_ordered_flags(__entry
->flags
),
396 __entry
->compress_type
, __entry
->refs
)
399 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_add
,
401 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
403 TP_ARGS(inode
, ordered
)
406 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_remove
,
408 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
410 TP_ARGS(inode
, ordered
)
413 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_start
,
415 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
417 TP_ARGS(inode
, ordered
)
420 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_put
,
422 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
424 TP_ARGS(inode
, ordered
)
427 DECLARE_EVENT_CLASS(btrfs__writepage
,
429 TP_PROTO(struct page
*page
, struct inode
*inode
,
430 struct writeback_control
*wbc
),
432 TP_ARGS(page
, inode
, wbc
),
435 __field( ino_t
, ino
)
436 __field( pgoff_t
, index
)
437 __field( long, nr_to_write
)
438 __field( long, pages_skipped
)
439 __field( loff_t
, range_start
)
440 __field( loff_t
, range_end
)
441 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
442 __field( char, nonblocking
)
444 __field( char, for_kupdate
)
445 __field( char, for_reclaim
)
446 __field( char, range_cyclic
)
447 __field( pgoff_t
, writeback_index
)
448 __field( u64
, root_objectid
)
452 tp_assign(ino
, inode
->i_ino
)
453 tp_assign(index
, page
->index
)
454 tp_assign(nr_to_write
, wbc
->nr_to_write
)
455 tp_assign(pages_skipped
, wbc
->pages_skipped
)
456 tp_assign(range_start
, wbc
->range_start
)
457 tp_assign(range_end
, wbc
->range_end
)
458 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
459 tp_assign(nonblocking
, wbc
->nonblocking
)
461 tp_assign(for_kupdate
, wbc
->for_kupdate
)
462 tp_assign(for_reclaim
, wbc
->for_reclaim
)
463 tp_assign(range_cyclic
, wbc
->range_cyclic
)
464 tp_assign(writeback_index
, inode
->i_mapping
->writeback_index
)
465 tp_assign(root_objectid
,
466 BTRFS_I(inode
)->root
->root_key
.objectid
)
469 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
470 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, "
471 "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, "
472 "range_end = %llu, nonblocking = %d, for_kupdate = %d, "
473 "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu",
474 show_root_type(__entry
->root_objectid
),
475 (unsigned long)__entry
->ino
, __entry
->index
,
476 __entry
->nr_to_write
, __entry
->pages_skipped
,
477 __entry
->range_start
, __entry
->range_end
,
478 __entry
->nonblocking
, __entry
->for_kupdate
,
479 __entry
->for_reclaim
, __entry
->range_cyclic
,
480 (unsigned long)__entry
->writeback_index
)
482 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, "
483 "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, "
484 "range_end = %llu, for_kupdate = %d, "
485 "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu",
486 show_root_type(__entry
->root_objectid
),
487 (unsigned long)__entry
->ino
, __entry
->index
,
488 __entry
->nr_to_write
, __entry
->pages_skipped
,
489 __entry
->range_start
, __entry
->range_end
,
490 __entry
->for_kupdate
,
491 __entry
->for_reclaim
, __entry
->range_cyclic
,
492 (unsigned long)__entry
->writeback_index
)
496 DEFINE_EVENT(btrfs__writepage
, __extent_writepage
,
498 TP_PROTO(struct page
*page
, struct inode
*inode
,
499 struct writeback_control
*wbc
),
501 TP_ARGS(page
, inode
, wbc
)
504 TRACE_EVENT(btrfs_writepage_end_io_hook
,
506 TP_PROTO(struct page
*page
, u64 start
, u64 end
, int uptodate
),
508 TP_ARGS(page
, start
, end
, uptodate
),
511 __field( ino_t
, ino
)
512 __field( pgoff_t
, index
)
513 __field( u64
, start
)
515 __field( int, uptodate
)
516 __field( u64
, root_objectid
)
520 tp_assign(ino
, page
->mapping
->host
->i_ino
)
521 tp_assign(index
, page
->index
)
522 tp_assign(start
, start
)
524 tp_assign(uptodate
, uptodate
)
525 tp_assign(root_objectid
,
526 BTRFS_I(page
->mapping
->host
)->root
->root_key
.objectid
)
529 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, "
530 "end = %llu, uptodate = %d",
531 show_root_type(__entry
->root_objectid
),
532 (unsigned long)__entry
->ino
, (unsigned long)__entry
->index
,
533 (unsigned long long)__entry
->start
,
534 (unsigned long long)__entry
->end
, __entry
->uptodate
)
537 TRACE_EVENT(btrfs_sync_file
,
539 TP_PROTO(struct file
*file
, int datasync
),
541 TP_ARGS(file
, datasync
),
544 __field( ino_t
, ino
)
545 __field( ino_t
, parent
)
546 __field( int, datasync
)
547 __field( u64
, root_objectid
)
551 tp_assign(ino
, file
->f_path
.dentry
->d_inode
->i_ino
)
552 tp_assign(parent
, file
->f_path
.dentry
->d_parent
->d_inode
->i_ino
)
553 tp_assign(datasync
, datasync
)
554 tp_assign(root_objectid
,
555 BTRFS_I(file
->f_path
.dentry
->d_inode
)->root
->root_key
.objectid
)
558 TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d",
559 show_root_type(__entry
->root_objectid
),
560 (unsigned long)__entry
->ino
, (unsigned long)__entry
->parent
,
564 TRACE_EVENT(btrfs_sync_fs
,
575 tp_assign(wait
, wait
)
578 TP_printk("wait = %d", __entry
->wait
)
581 #define show_ref_action(action) \
582 __print_symbolic(action, \
583 { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \
584 { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \
585 { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \
586 { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
589 TRACE_EVENT(btrfs_delayed_tree_ref
,
591 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
592 struct btrfs_delayed_tree_ref
*full_ref
,
595 TP_ARGS(ref
, full_ref
, action
),
598 __field( u64
, bytenr
)
599 __field( u64
, num_bytes
)
600 __field( int, action
)
601 __field( u64
, parent
)
602 __field( u64
, ref_root
)
603 __field( int, level
)
605 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
611 tp_assign(bytenr
, ref
->bytenr
)
612 tp_assign(num_bytes
, ref
->num_bytes
)
613 tp_assign(action
, action
)
614 tp_assign(parent
, full_ref
->parent
)
615 tp_assign(ref_root
, full_ref
->root
)
616 tp_assign(level
, full_ref
->level
)
617 tp_assign(type
, ref
->type
)
618 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
619 tp_assign(seq
, ref
->seq
)
623 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
624 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
625 "parent = %llu(%s), ref_root = %llu(%s), level = %d, "
626 "type = %s, seq = %llu",
628 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
629 "parent = %llu(%s), ref_root = %llu(%s), level = %d, "
632 (unsigned long long)__entry
->bytenr
,
633 (unsigned long long)__entry
->num_bytes
,
634 show_ref_action(__entry
->action
),
635 show_root_type(__entry
->parent
),
636 show_root_type(__entry
->ref_root
),
637 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
638 __entry
->level
, show_ref_type(__entry
->type
),
639 (unsigned long long)__entry
->seq
)
641 __entry
->level
, show_ref_type(__entry
->type
))
645 TRACE_EVENT(btrfs_delayed_data_ref
,
647 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
648 struct btrfs_delayed_data_ref
*full_ref
,
651 TP_ARGS(ref
, full_ref
, action
),
654 __field( u64
, bytenr
)
655 __field( u64
, num_bytes
)
656 __field( int, action
)
657 __field( u64
, parent
)
658 __field( u64
, ref_root
)
659 __field( u64
, owner
)
660 __field( u64
, offset
)
662 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
668 tp_assign(bytenr
, ref
->bytenr
)
669 tp_assign(num_bytes
, ref
->num_bytes
)
670 tp_assign(action
, action
)
671 tp_assign(parent
, full_ref
->parent
)
672 tp_assign(ref_root
, full_ref
->root
)
673 tp_assign(owner
, full_ref
->objectid
)
674 tp_assign(offset
, full_ref
->offset
)
675 tp_assign(type
, ref
->type
)
676 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
677 tp_assign(seq
, ref
->seq
)
681 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
682 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
683 "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, "
684 "offset = %llu, type = %s, seq = %llu",
686 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
687 "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, "
688 "offset = %llu, type = %s",
690 (unsigned long long)__entry
->bytenr
,
691 (unsigned long long)__entry
->num_bytes
,
692 show_ref_action(__entry
->action
),
693 show_root_type(__entry
->parent
),
694 show_root_type(__entry
->ref_root
),
695 (unsigned long long)__entry
->owner
,
696 (unsigned long long)__entry
->offset
,
697 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
698 show_ref_type(__entry
->type
),
699 (unsigned long long)__entry
->seq
)
701 show_ref_type(__entry
->type
))
705 TRACE_EVENT(btrfs_delayed_ref_head
,
707 TP_PROTO(struct btrfs_delayed_ref_node
*ref
,
708 struct btrfs_delayed_ref_head
*head_ref
,
711 TP_ARGS(ref
, head_ref
, action
),
714 __field( u64
, bytenr
)
715 __field( u64
, num_bytes
)
716 __field( int, action
)
717 __field( int, is_data
)
721 tp_assign(bytenr
, ref
->bytenr
)
722 tp_assign(num_bytes
, ref
->num_bytes
)
723 tp_assign(action
, action
)
724 tp_assign(is_data
, head_ref
->is_data
)
727 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d",
728 (unsigned long long)__entry
->bytenr
,
729 (unsigned long long)__entry
->num_bytes
,
730 show_ref_action(__entry
->action
),
734 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
736 #define show_chunk_type(type) \
737 __print_flags(type, "|", \
738 { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \
739 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
740 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
741 { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \
742 { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \
743 { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \
744 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
745 { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \
746 { BTRFS_BLOCK_GROUP_RAID6, "RAID6" })
750 #define show_chunk_type(type) \
751 __print_flags(type, "|", \
752 { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \
753 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
754 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
755 { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \
756 { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \
757 { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \
758 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"})
762 DECLARE_EVENT_CLASS(btrfs__chunk
,
764 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
765 u64 offset
, u64 size
),
767 TP_ARGS(root
, map
, offset
, size
),
770 __field( int, num_stripes
)
772 __field( int, sub_stripes
)
773 __field( u64
, offset
)
775 __field( u64
, root_objectid
)
779 tp_assign(num_stripes
, map
->num_stripes
)
780 tp_assign(type
, map
->type
)
781 tp_assign(sub_stripes
, map
->sub_stripes
)
782 tp_assign(offset
, offset
)
783 tp_assign(size
, size
)
784 tp_assign(root_objectid
, root
->root_key
.objectid
)
787 TP_printk("root = %llu(%s), offset = %llu, size = %llu, "
788 "num_stripes = %d, sub_stripes = %d, type = %s",
789 show_root_type(__entry
->root_objectid
),
790 (unsigned long long)__entry
->offset
,
791 (unsigned long long)__entry
->size
,
792 __entry
->num_stripes
, __entry
->sub_stripes
,
793 show_chunk_type(__entry
->type
))
796 DEFINE_EVENT(btrfs__chunk
, btrfs_chunk_alloc
,
798 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
799 u64 offset
, u64 size
),
801 TP_ARGS(root
, map
, offset
, size
)
804 DEFINE_EVENT(btrfs__chunk
, btrfs_chunk_free
,
806 TP_PROTO(struct btrfs_root
*root
, struct map_lookup
*map
,
807 u64 offset
, u64 size
),
809 TP_ARGS(root
, map
, offset
, size
)
812 TRACE_EVENT(btrfs_cow_block
,
814 TP_PROTO(struct btrfs_root
*root
, struct extent_buffer
*buf
,
815 struct extent_buffer
*cow
),
817 TP_ARGS(root
, buf
, cow
),
820 __field( u64
, root_objectid
)
821 __field( u64
, buf_start
)
823 __field( u64
, cow_start
)
824 __field( int, buf_level
)
825 __field( int, cow_level
)
829 tp_assign(root_objectid
, root
->root_key
.objectid
)
830 tp_assign(buf_start
, buf
->start
)
831 tp_assign(refs
, atomic_read(&buf
->refs
))
832 tp_assign(cow_start
, cow
->start
)
833 tp_assign(buf_level
, btrfs_header_level(buf
))
834 tp_assign(cow_level
, btrfs_header_level(cow
))
837 TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu "
838 "(orig_level = %d), cow_buf = %llu (cow_level = %d)",
839 show_root_type(__entry
->root_objectid
),
841 (unsigned long long)__entry
->buf_start
,
843 (unsigned long long)__entry
->cow_start
,
847 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
848 TRACE_EVENT(btrfs_space_reservation
,
850 TP_PROTO(struct btrfs_fs_info
*fs_info
, char *type
, u64 val
,
851 u64 bytes
, int reserve
),
853 TP_ARGS(fs_info
, type
, val
, bytes
, reserve
),
856 __array( u8
, fsid
, BTRFS_UUID_SIZE
)
857 __string( type
, type
)
859 __field( u64
, bytes
)
860 __field( int, reserve
)
864 tp_memcpy(fsid
, fs_info
->fsid
, BTRFS_UUID_SIZE
)
865 tp_strcpy(type
, type
)
867 tp_assign(bytes
, bytes
)
868 tp_assign(reserve
, reserve
)
871 TP_printk("%pU: %s: %Lu %s %Lu", __entry
->fsid
, __get_str(type
),
872 __entry
->val
, __entry
->reserve
? "reserve" : "release",
877 DECLARE_EVENT_CLASS(btrfs__reserved_extent
,
879 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
881 TP_ARGS(root
, start
, len
),
884 __field( u64
, root_objectid
)
885 __field( u64
, start
)
890 tp_assign(root_objectid
, root
->root_key
.objectid
)
891 tp_assign(start
, start
)
895 TP_printk("root = %llu(%s), start = %llu, len = %llu",
896 show_root_type(__entry
->root_objectid
),
897 (unsigned long long)__entry
->start
,
898 (unsigned long long)__entry
->len
)
901 DEFINE_EVENT(btrfs__reserved_extent
, btrfs_reserved_extent_alloc
,
903 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
905 TP_ARGS(root
, start
, len
)
908 DEFINE_EVENT(btrfs__reserved_extent
, btrfs_reserved_extent_free
,
910 TP_PROTO(struct btrfs_root
*root
, u64 start
, u64 len
),
912 TP_ARGS(root
, start
, len
)
915 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
916 TRACE_EVENT_MAP(find_free_extent
,
918 btrfs_find_free_extent
,
920 TP_PROTO(struct btrfs_root
*root
, u64 num_bytes
, u64 empty_size
,
923 TP_ARGS(root
, num_bytes
, empty_size
, data
),
926 __field( u64
, root_objectid
)
927 __field( u64
, num_bytes
)
928 __field( u64
, empty_size
)
933 tp_assign(root_objectid
, root
->root_key
.objectid
)
934 tp_assign(num_bytes
, num_bytes
)
935 tp_assign(empty_size
, empty_size
)
936 tp_assign(data
, data
)
939 TP_printk("root = %Lu(%s), len = %Lu, empty_size = %Lu, "
940 "flags = %Lu(%s)", show_root_type(__entry
->root_objectid
),
941 __entry
->num_bytes
, __entry
->empty_size
, __entry
->data
,
942 __print_flags((unsigned long)__entry
->data
, "|",
946 DECLARE_EVENT_CLASS(btrfs__reserve_extent
,
948 TP_PROTO(struct btrfs_root
*root
,
949 struct btrfs_block_group_cache
*block_group
, u64 start
,
952 TP_ARGS(root
, block_group
, start
, len
),
955 __field( u64
, root_objectid
)
956 __field( u64
, bg_objectid
)
957 __field( u64
, flags
)
958 __field( u64
, start
)
963 tp_assign(root_objectid
, root
->root_key
.objectid
)
964 tp_assign(bg_objectid
, block_group
->key
.objectid
)
965 tp_assign(flags
, block_group
->flags
)
966 tp_assign(start
, start
)
970 TP_printk("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), "
971 "start = %Lu, len = %Lu",
972 show_root_type(__entry
->root_objectid
), __entry
->bg_objectid
,
973 __entry
->flags
, __print_flags((unsigned long)__entry
->flags
,
974 "|", BTRFS_GROUP_FLAGS
),
975 __entry
->start
, __entry
->len
)
978 DEFINE_EVENT(btrfs__reserve_extent
, btrfs_reserve_extent
,
980 TP_PROTO(struct btrfs_root
*root
,
981 struct btrfs_block_group_cache
*block_group
, u64 start
,
984 TP_ARGS(root
, block_group
, start
, len
)
987 DEFINE_EVENT(btrfs__reserve_extent
, btrfs_reserve_extent_cluster
,
989 TP_PROTO(struct btrfs_root
*root
,
990 struct btrfs_block_group_cache
*block_group
, u64 start
,
993 TP_ARGS(root
, block_group
, start
, len
)
996 TRACE_EVENT(btrfs_find_cluster
,
998 TP_PROTO(struct btrfs_block_group_cache
*block_group
, u64 start
,
999 u64 bytes
, u64 empty_size
, u64 min_bytes
),
1001 TP_ARGS(block_group
, start
, bytes
, empty_size
, min_bytes
),
1004 __field( u64
, bg_objectid
)
1005 __field( u64
, flags
)
1006 __field( u64
, start
)
1007 __field( u64
, bytes
)
1008 __field( u64
, empty_size
)
1009 __field( u64
, min_bytes
)
1013 tp_assign(bg_objectid
, block_group
->key
.objectid
)
1014 tp_assign(flags
, block_group
->flags
)
1015 tp_assign(start
, start
)
1016 tp_assign(bytes
, bytes
)
1017 tp_assign(empty_size
, empty_size
)
1018 tp_assign(min_bytes
, min_bytes
)
1021 TP_printk("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu,"
1022 " empty_size = %Lu, min_bytes = %Lu", __entry
->bg_objectid
,
1024 __print_flags((unsigned long)__entry
->flags
, "|",
1025 BTRFS_GROUP_FLAGS
), __entry
->start
,
1026 __entry
->bytes
, __entry
->empty_size
, __entry
->min_bytes
)
1029 TRACE_EVENT(btrfs_failed_cluster_setup
,
1031 TP_PROTO(struct btrfs_block_group_cache
*block_group
),
1033 TP_ARGS(block_group
),
1036 __field( u64
, bg_objectid
)
1040 tp_assign(bg_objectid
, block_group
->key
.objectid
)
1043 TP_printk("block_group = %Lu", __entry
->bg_objectid
)
1046 TRACE_EVENT(btrfs_setup_cluster
,
1048 TP_PROTO(struct btrfs_block_group_cache
*block_group
,
1049 struct btrfs_free_cluster
*cluster
, u64 size
, int bitmap
),
1051 TP_ARGS(block_group
, cluster
, size
, bitmap
),
1054 __field( u64
, bg_objectid
)
1055 __field( u64
, flags
)
1056 __field( u64
, start
)
1057 __field( u64
, max_size
)
1058 __field( u64
, size
)
1059 __field( int, bitmap
)
1063 tp_assign(bg_objectid
, block_group
->key
.objectid
)
1064 tp_assign(flags
, block_group
->flags
)
1065 tp_assign(start
, cluster
->window_start
)
1066 tp_assign(max_size
, cluster
->max_size
)
1067 tp_assign(size
, size
)
1068 tp_assign(bitmap
, bitmap
)
1071 TP_printk("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, "
1072 "size = %Lu, max_size = %Lu, bitmap = %d",
1073 __entry
->bg_objectid
,
1075 __print_flags((unsigned long)__entry
->flags
, "|",
1076 BTRFS_GROUP_FLAGS
), __entry
->start
,
1077 __entry
->size
, __entry
->max_size
, __entry
->bitmap
)
1081 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
1082 TRACE_EVENT_MAP(alloc_extent_state
,
1084 btrfs_alloc_extent_state
,
1086 TP_PROTO(struct extent_state
*state
, gfp_t mask
, unsigned long IP
),
1088 TP_ARGS(state
, mask
, IP
),
1091 __field(struct extent_state
*, state
)
1092 __field(gfp_t
, mask
)
1093 __field(unsigned long, ip
)
1097 tp_assign(state
, state
)
1098 tp_assign(mask
, mask
)
1102 TP_printk("state=%p; mask = %s; caller = %pF", __entry
->state
,
1103 show_gfp_flags(__entry
->mask
), (void *)__entry
->ip
)
1106 TRACE_EVENT_MAP(free_extent_state
,
1108 btrfs_free_extent_state
,
1110 TP_PROTO(struct extent_state
*state
, unsigned long IP
),
1115 __field(struct extent_state
*, state
)
1116 __field(unsigned long, ip
)
1120 tp_assign(state
, state
)
1124 TP_printk(" state=%p; caller = %pF", __entry
->state
,
1125 (void *)__entry
->ip
)
1129 #endif /* _TRACE_BTRFS_H */
1131 /* This part must be outside protection */
1132 #include "../../../probes/define_trace.h"