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/mmflags.h>
15 struct btrfs_file_extent_item
;
16 struct btrfs_ordered_extent
;
17 struct btrfs_delayed_ref_node
;
18 struct btrfs_delayed_tree_ref
;
19 struct btrfs_delayed_data_ref
;
20 struct btrfs_delayed_ref_head
;
21 struct btrfs_block_group_cache
;
22 struct btrfs_free_cluster
;
26 struct __btrfs_workqueue
;
27 struct btrfs_qgroup_extent_record
;
30 #define show_ref_type(type) \
31 __print_symbolic(type, \
32 { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \
33 { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \
34 { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \
35 { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \
36 { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" })
38 #define __show_root_type(obj) \
39 __print_symbolic_u64(obj, \
40 { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \
41 { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \
42 { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \
43 { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \
44 { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \
45 { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \
46 { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \
47 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \
48 { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \
49 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \
50 { BTRFS_UUID_TREE_OBJECTID, "UUID_TREE" }, \
51 { BTRFS_FREE_SPACE_TREE_OBJECTID, "FREE_SPACE_TREE" }, \
52 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
54 #define show_root_type(obj) \
55 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
56 (obj >= BTRFS_ROOT_TREE_OBJECTID && \
57 obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
59 #define show_fi_type(type) \
60 __print_symbolic(type, \
61 { BTRFS_FILE_EXTENT_INLINE, "INLINE" }, \
62 { BTRFS_FILE_EXTENT_REG, "REG" }, \
63 { BTRFS_FILE_EXTENT_PREALLOC, "PREALLOC"})
65 #define BTRFS_GROUP_FLAGS \
66 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \
67 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
68 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
69 { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \
70 { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \
71 { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \
72 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
73 { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \
74 { BTRFS_BLOCK_GROUP_RAID6, "RAID6"}
76 #define BTRFS_UUID_SIZE 16
77 #define TP_STRUCT__entry_fsid __array(u8, fsid, BTRFS_UUID_SIZE)
79 #define TP_fast_assign_fsid(fs_info) \
80 memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE)
82 #define TP_STRUCT__entry_btrfs(args...) \
84 TP_STRUCT__entry_fsid \
86 #define TP_fast_assign_btrfs(fs_info, args...) \
88 TP_fast_assign_fsid(fs_info); \
90 #define TP_printk_btrfs(fmt, args...) \
91 TP_printk("%pU: " fmt, __entry->fsid, args)
93 TRACE_EVENT(btrfs_transaction_commit
,
95 TP_PROTO(struct btrfs_root
*root
),
99 TP_STRUCT__entry_btrfs(
100 __field( u64
, generation
)
101 __field( u64
, root_objectid
)
104 TP_fast_assign_btrfs(root
->fs_info
,
105 __entry
->generation
= root
->fs_info
->generation
;
106 __entry
->root_objectid
= root
->root_key
.objectid
;
109 TP_printk_btrfs("root = %llu(%s), gen = %llu",
110 show_root_type(__entry
->root_objectid
),
111 (unsigned long long)__entry
->generation
)
114 DECLARE_EVENT_CLASS(btrfs__inode
,
116 TP_PROTO(struct inode
*inode
),
120 TP_STRUCT__entry_btrfs(
121 __field( ino_t
, ino
)
122 __field( blkcnt_t
, blocks
)
123 __field( u64
, disk_i_size
)
124 __field( u64
, generation
)
125 __field( u64
, last_trans
)
126 __field( u64
, logged_trans
)
127 __field( u64
, root_objectid
)
130 TP_fast_assign_btrfs(btrfs_sb(inode
->i_sb
),
131 __entry
->ino
= inode
->i_ino
;
132 __entry
->blocks
= inode
->i_blocks
;
133 __entry
->disk_i_size
= BTRFS_I(inode
)->disk_i_size
;
134 __entry
->generation
= BTRFS_I(inode
)->generation
;
135 __entry
->last_trans
= BTRFS_I(inode
)->last_trans
;
136 __entry
->logged_trans
= BTRFS_I(inode
)->logged_trans
;
137 __entry
->root_objectid
=
138 BTRFS_I(inode
)->root
->root_key
.objectid
;
141 TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%lu blocks=%llu "
142 "disk_i_size=%llu last_trans=%llu logged_trans=%llu",
143 show_root_type(__entry
->root_objectid
),
144 (unsigned long long)__entry
->generation
,
145 (unsigned long)__entry
->ino
,
146 (unsigned long long)__entry
->blocks
,
147 (unsigned long long)__entry
->disk_i_size
,
148 (unsigned long long)__entry
->last_trans
,
149 (unsigned long long)__entry
->logged_trans
)
152 DEFINE_EVENT(btrfs__inode
, btrfs_inode_new
,
154 TP_PROTO(struct inode
*inode
),
159 DEFINE_EVENT(btrfs__inode
, btrfs_inode_request
,
161 TP_PROTO(struct inode
*inode
),
166 DEFINE_EVENT(btrfs__inode
, btrfs_inode_evict
,
168 TP_PROTO(struct inode
*inode
),
173 #define __show_map_type(type) \
174 __print_symbolic_u64(type, \
175 { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \
176 { EXTENT_MAP_HOLE, "HOLE" }, \
177 { EXTENT_MAP_INLINE, "INLINE" }, \
178 { EXTENT_MAP_DELALLOC, "DELALLOC" })
180 #define show_map_type(type) \
181 type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type)
183 #define show_map_flags(flag) \
184 __print_flags(flag, "|", \
185 { (1 << EXTENT_FLAG_PINNED), "PINNED" },\
186 { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\
187 { (1 << EXTENT_FLAG_VACANCY), "VACANCY" },\
188 { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\
189 { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\
190 { (1 << EXTENT_FLAG_FILLING), "FILLING" },\
191 { (1 << EXTENT_FLAG_FS_MAPPING), "FS_MAPPING" })
193 TRACE_EVENT_CONDITION(btrfs_get_extent
,
195 TP_PROTO(struct btrfs_root
*root
, struct btrfs_inode
*inode
,
196 struct extent_map
*map
),
198 TP_ARGS(root
, inode
, map
),
202 TP_STRUCT__entry_btrfs(
203 __field( u64
, root_objectid
)
205 __field( u64
, start
)
207 __field( u64
, orig_start
)
208 __field( u64
, block_start
)
209 __field( u64
, block_len
)
210 __field( unsigned long, flags
)
212 __field( unsigned int, compress_type
)
215 TP_fast_assign_btrfs(root
->fs_info
,
216 __entry
->root_objectid
= root
->root_key
.objectid
;
217 __entry
->ino
= btrfs_ino(inode
);
218 __entry
->start
= map
->start
;
219 __entry
->len
= map
->len
;
220 __entry
->orig_start
= map
->orig_start
;
221 __entry
->block_start
= map
->block_start
;
222 __entry
->block_len
= map
->block_len
;
223 __entry
->flags
= map
->flags
;
224 __entry
->refs
= refcount_read(&map
->refs
);
225 __entry
->compress_type
= map
->compress_type
;
228 TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu "
229 "orig_start=%llu block_start=%llu(%s) "
230 "block_len=%llu flags=%s refs=%u "
232 show_root_type(__entry
->root_objectid
),
233 (unsigned long long)__entry
->ino
,
234 (unsigned long long)__entry
->start
,
235 (unsigned long long)__entry
->len
,
236 (unsigned long long)__entry
->orig_start
,
237 show_map_type(__entry
->block_start
),
238 (unsigned long long)__entry
->block_len
,
239 show_map_flags(__entry
->flags
),
240 __entry
->refs
, __entry
->compress_type
)
243 /* file extent item */
244 DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular
,
246 TP_PROTO(struct btrfs_inode
*bi
, struct extent_buffer
*l
,
247 struct btrfs_file_extent_item
*fi
, u64 start
),
249 TP_ARGS(bi
, l
, fi
, start
),
251 TP_STRUCT__entry_btrfs(
252 __field( u64
, root_obj
)
254 __field( loff_t
, isize
)
255 __field( u64
, disk_isize
)
256 __field( u64
, num_bytes
)
257 __field( u64
, ram_bytes
)
258 __field( u64
, disk_bytenr
)
259 __field( u64
, disk_num_bytes
)
260 __field( u64
, extent_offset
)
261 __field( u8
, extent_type
)
262 __field( u8
, compression
)
263 __field( u64
, extent_start
)
264 __field( u64
, extent_end
)
267 TP_fast_assign_btrfs(bi
->root
->fs_info
,
268 __entry
->root_obj
= bi
->root
->objectid
;
269 __entry
->ino
= btrfs_ino(bi
);
270 __entry
->isize
= bi
->vfs_inode
.i_size
;
271 __entry
->disk_isize
= bi
->disk_i_size
;
272 __entry
->num_bytes
= btrfs_file_extent_num_bytes(l
, fi
);
273 __entry
->ram_bytes
= btrfs_file_extent_ram_bytes(l
, fi
);
274 __entry
->disk_bytenr
= btrfs_file_extent_disk_bytenr(l
, fi
);
275 __entry
->disk_num_bytes
= btrfs_file_extent_disk_num_bytes(l
, fi
);
276 __entry
->extent_offset
= btrfs_file_extent_offset(l
, fi
);
277 __entry
->extent_type
= btrfs_file_extent_type(l
, fi
);
278 __entry
->compression
= btrfs_file_extent_compression(l
, fi
);
279 __entry
->extent_start
= start
;
280 __entry
->extent_end
= (start
+ __entry
->num_bytes
);
284 "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu "
285 "file extent range=[%llu %llu] "
286 "(num_bytes=%llu ram_bytes=%llu disk_bytenr=%llu "
287 "disk_num_bytes=%llu extent_offset=%llu type=%s "
289 show_root_type(__entry
->root_obj
), __entry
->ino
,
291 __entry
->disk_isize
, __entry
->extent_start
,
292 __entry
->extent_end
, __entry
->num_bytes
, __entry
->ram_bytes
,
293 __entry
->disk_bytenr
, __entry
->disk_num_bytes
,
294 __entry
->extent_offset
, show_fi_type(__entry
->extent_type
),
295 __entry
->compression
)
299 btrfs__file_extent_item_inline
,
301 TP_PROTO(struct btrfs_inode
*bi
, struct extent_buffer
*l
,
302 struct btrfs_file_extent_item
*fi
, int slot
, u64 start
),
304 TP_ARGS(bi
, l
, fi
, slot
, start
),
306 TP_STRUCT__entry_btrfs(
307 __field( u64
, root_obj
)
309 __field( loff_t
, isize
)
310 __field( u64
, disk_isize
)
311 __field( u8
, extent_type
)
312 __field( u8
, compression
)
313 __field( u64
, extent_start
)
314 __field( u64
, extent_end
)
317 TP_fast_assign_btrfs(
319 __entry
->root_obj
= bi
->root
->objectid
;
320 __entry
->ino
= btrfs_ino(bi
);
321 __entry
->isize
= bi
->vfs_inode
.i_size
;
322 __entry
->disk_isize
= bi
->disk_i_size
;
323 __entry
->extent_type
= btrfs_file_extent_type(l
, fi
);
324 __entry
->compression
= btrfs_file_extent_compression(l
, fi
);
325 __entry
->extent_start
= start
;
326 __entry
->extent_end
= (start
+ btrfs_file_extent_inline_len(l
, slot
, fi
));
330 "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu "
331 "file extent range=[%llu %llu] "
332 "extent_type=%s compression=%u",
333 show_root_type(__entry
->root_obj
), __entry
->ino
, __entry
->isize
,
334 __entry
->disk_isize
, __entry
->extent_start
,
335 __entry
->extent_end
, show_fi_type(__entry
->extent_type
),
336 __entry
->compression
)
340 btrfs__file_extent_item_regular
, btrfs_get_extent_show_fi_regular
,
342 TP_PROTO(struct btrfs_inode
*bi
, struct extent_buffer
*l
,
343 struct btrfs_file_extent_item
*fi
, u64 start
),
345 TP_ARGS(bi
, l
, fi
, start
)
349 btrfs__file_extent_item_regular
, btrfs_truncate_show_fi_regular
,
351 TP_PROTO(struct btrfs_inode
*bi
, struct extent_buffer
*l
,
352 struct btrfs_file_extent_item
*fi
, u64 start
),
354 TP_ARGS(bi
, l
, fi
, start
)
358 btrfs__file_extent_item_inline
, btrfs_get_extent_show_fi_inline
,
360 TP_PROTO(struct btrfs_inode
*bi
, struct extent_buffer
*l
,
361 struct btrfs_file_extent_item
*fi
, int slot
, u64 start
),
363 TP_ARGS(bi
, l
, fi
, slot
, start
)
367 btrfs__file_extent_item_inline
, btrfs_truncate_show_fi_inline
,
369 TP_PROTO(struct btrfs_inode
*bi
, struct extent_buffer
*l
,
370 struct btrfs_file_extent_item
*fi
, int slot
, u64 start
),
372 TP_ARGS(bi
, l
, fi
, slot
, start
)
375 #define show_ordered_flags(flags) \
376 __print_flags(flags, "|", \
377 { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \
378 { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \
379 { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \
380 { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \
381 { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \
382 { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \
383 { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \
384 { (1 << BTRFS_ORDERED_UPDATED_ISIZE), "UPDATED_ISIZE" }, \
385 { (1 << BTRFS_ORDERED_LOGGED_CSUM), "LOGGED_CSUM" }, \
386 { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" })
389 DECLARE_EVENT_CLASS(btrfs__ordered_extent
,
391 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
393 TP_ARGS(inode
, ordered
),
395 TP_STRUCT__entry_btrfs(
396 __field( ino_t
, ino
)
397 __field( u64
, file_offset
)
398 __field( u64
, start
)
400 __field( u64
, disk_len
)
401 __field( u64
, bytes_left
)
402 __field( unsigned long, flags
)
403 __field( int, compress_type
)
405 __field( u64
, root_objectid
)
406 __field( u64
, truncated_len
)
409 TP_fast_assign_btrfs(btrfs_sb(inode
->i_sb
),
410 __entry
->ino
= inode
->i_ino
;
411 __entry
->file_offset
= ordered
->file_offset
;
412 __entry
->start
= ordered
->start
;
413 __entry
->len
= ordered
->len
;
414 __entry
->disk_len
= ordered
->disk_len
;
415 __entry
->bytes_left
= ordered
->bytes_left
;
416 __entry
->flags
= ordered
->flags
;
417 __entry
->compress_type
= ordered
->compress_type
;
418 __entry
->refs
= refcount_read(&ordered
->refs
);
419 __entry
->root_objectid
=
420 BTRFS_I(inode
)->root
->root_key
.objectid
;
421 __entry
->truncated_len
= ordered
->truncated_len
;
424 TP_printk_btrfs("root=%llu(%s) ino=%llu file_offset=%llu "
425 "start=%llu len=%llu disk_len=%llu "
426 "truncated_len=%llu "
427 "bytes_left=%llu flags=%s compress_type=%d "
429 show_root_type(__entry
->root_objectid
),
430 (unsigned long long)__entry
->ino
,
431 (unsigned long long)__entry
->file_offset
,
432 (unsigned long long)__entry
->start
,
433 (unsigned long long)__entry
->len
,
434 (unsigned long long)__entry
->disk_len
,
435 (unsigned long long)__entry
->truncated_len
,
436 (unsigned long long)__entry
->bytes_left
,
437 show_ordered_flags(__entry
->flags
),
438 __entry
->compress_type
, __entry
->refs
)
441 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_add
,
443 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
445 TP_ARGS(inode
, ordered
)
448 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_remove
,
450 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
452 TP_ARGS(inode
, ordered
)
455 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_start
,
457 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
459 TP_ARGS(inode
, ordered
)
462 DEFINE_EVENT(btrfs__ordered_extent
, btrfs_ordered_extent_put
,
464 TP_PROTO(struct inode
*inode
, struct btrfs_ordered_extent
*ordered
),
466 TP_ARGS(inode
, ordered
)
469 DECLARE_EVENT_CLASS(btrfs__writepage
,
471 TP_PROTO(struct page
*page
, struct inode
*inode
,
472 struct writeback_control
*wbc
),
474 TP_ARGS(page
, inode
, wbc
),
476 TP_STRUCT__entry_btrfs(
477 __field( ino_t
, ino
)
478 __field( pgoff_t
, index
)
479 __field( long, nr_to_write
)
480 __field( long, pages_skipped
)
481 __field( loff_t
, range_start
)
482 __field( loff_t
, range_end
)
483 __field( char, for_kupdate
)
484 __field( char, for_reclaim
)
485 __field( char, range_cyclic
)
486 __field( pgoff_t
, writeback_index
)
487 __field( u64
, root_objectid
)
490 TP_fast_assign_btrfs(btrfs_sb(inode
->i_sb
),
491 __entry
->ino
= inode
->i_ino
;
492 __entry
->index
= page
->index
;
493 __entry
->nr_to_write
= wbc
->nr_to_write
;
494 __entry
->pages_skipped
= wbc
->pages_skipped
;
495 __entry
->range_start
= wbc
->range_start
;
496 __entry
->range_end
= wbc
->range_end
;
497 __entry
->for_kupdate
= wbc
->for_kupdate
;
498 __entry
->for_reclaim
= wbc
->for_reclaim
;
499 __entry
->range_cyclic
= wbc
->range_cyclic
;
500 __entry
->writeback_index
= inode
->i_mapping
->writeback_index
;
501 __entry
->root_objectid
=
502 BTRFS_I(inode
)->root
->root_key
.objectid
;
505 TP_printk_btrfs("root=%llu(%s) ino=%lu page_index=%lu "
506 "nr_to_write=%ld pages_skipped=%ld range_start=%llu "
507 "range_end=%llu for_kupdate=%d "
508 "for_reclaim=%d range_cyclic=%d writeback_index=%lu",
509 show_root_type(__entry
->root_objectid
),
510 (unsigned long)__entry
->ino
, __entry
->index
,
511 __entry
->nr_to_write
, __entry
->pages_skipped
,
512 __entry
->range_start
, __entry
->range_end
,
513 __entry
->for_kupdate
,
514 __entry
->for_reclaim
, __entry
->range_cyclic
,
515 (unsigned long)__entry
->writeback_index
)
518 DEFINE_EVENT(btrfs__writepage
, __extent_writepage
,
520 TP_PROTO(struct page
*page
, struct inode
*inode
,
521 struct writeback_control
*wbc
),
523 TP_ARGS(page
, inode
, wbc
)
526 TRACE_EVENT(btrfs_writepage_end_io_hook
,
528 TP_PROTO(struct page
*page
, u64 start
, u64 end
, int uptodate
),
530 TP_ARGS(page
, start
, end
, uptodate
),
532 TP_STRUCT__entry_btrfs(
533 __field( ino_t
, ino
)
534 __field( pgoff_t
, index
)
535 __field( u64
, start
)
537 __field( int, uptodate
)
538 __field( u64
, root_objectid
)
541 TP_fast_assign_btrfs(btrfs_sb(page
->mapping
->host
->i_sb
),
542 __entry
->ino
= page
->mapping
->host
->i_ino
;
543 __entry
->index
= page
->index
;
544 __entry
->start
= start
;
546 __entry
->uptodate
= uptodate
;
547 __entry
->root_objectid
=
548 BTRFS_I(page
->mapping
->host
)->root
->root_key
.objectid
;
551 TP_printk_btrfs("root=%llu(%s) ino=%lu page_index=%lu start=%llu "
552 "end=%llu uptodate=%d",
553 show_root_type(__entry
->root_objectid
),
554 (unsigned long)__entry
->ino
, (unsigned long)__entry
->index
,
555 (unsigned long long)__entry
->start
,
556 (unsigned long long)__entry
->end
, __entry
->uptodate
)
559 TRACE_EVENT(btrfs_sync_file
,
561 TP_PROTO(struct file
*file
, int datasync
),
563 TP_ARGS(file
, datasync
),
565 TP_STRUCT__entry_btrfs(
566 __field( ino_t
, ino
)
567 __field( ino_t
, parent
)
568 __field( int, datasync
)
569 __field( u64
, root_objectid
)
573 struct dentry
*dentry
= file
->f_path
.dentry
;
574 struct inode
*inode
= d_inode(dentry
);
576 TP_fast_assign_fsid(btrfs_sb(file
->f_path
.dentry
->d_sb
));
577 __entry
->ino
= inode
->i_ino
;
578 __entry
->parent
= d_inode(dentry
->d_parent
)->i_ino
;
579 __entry
->datasync
= datasync
;
580 __entry
->root_objectid
=
581 BTRFS_I(inode
)->root
->root_key
.objectid
;
584 TP_printk_btrfs("root=%llu(%s) ino=%ld parent=%ld datasync=%d",
585 show_root_type(__entry
->root_objectid
),
586 (unsigned long)__entry
->ino
, (unsigned long)__entry
->parent
,
590 TRACE_EVENT(btrfs_sync_fs
,
592 TP_PROTO(struct btrfs_fs_info
*fs_info
, int wait
),
594 TP_ARGS(fs_info
, wait
),
596 TP_STRUCT__entry_btrfs(
600 TP_fast_assign_btrfs(fs_info
,
601 __entry
->wait
= wait
;
604 TP_printk_btrfs("wait = %d", __entry
->wait
)
607 TRACE_EVENT(btrfs_add_block_group
,
609 TP_PROTO(struct btrfs_fs_info
*fs_info
,
610 struct btrfs_block_group_cache
*block_group
, int create
),
612 TP_ARGS(fs_info
, block_group
, create
),
615 __array( u8
, fsid
, BTRFS_UUID_SIZE
)
616 __field( u64
, offset
)
618 __field( u64
, flags
)
619 __field( u64
, bytes_used
)
620 __field( u64
, bytes_super
)
621 __field( int, create
)
625 memcpy(__entry
->fsid
, fs_info
->fsid
, BTRFS_UUID_SIZE
);
626 __entry
->offset
= block_group
->key
.objectid
;
627 __entry
->size
= block_group
->key
.offset
;
628 __entry
->flags
= block_group
->flags
;
629 __entry
->bytes_used
=
630 btrfs_block_group_used(&block_group
->item
);
631 __entry
->bytes_super
= block_group
->bytes_super
;
632 __entry
->create
= create
;
635 TP_printk("%pU: block_group offset=%llu size=%llu "
636 "flags=%llu(%s) bytes_used=%llu bytes_super=%llu "
637 "create=%d", __entry
->fsid
,
638 (unsigned long long)__entry
->offset
,
639 (unsigned long long)__entry
->size
,
640 (unsigned long long)__entry
->flags
,
641 __print_flags((unsigned long)__entry
->flags
, "|",
643 (unsigned long long)__entry
->bytes_used
,
644 (unsigned long long)__entry
->bytes_super
, __entry
->create
)
647 #define show_ref_action(action) \
648 __print_symbolic(action, \
649 { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \
650 { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \
651 { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \
652 { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
655 DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref
,
657 TP_PROTO(struct btrfs_fs_info
*fs_info
,
658 struct btrfs_delayed_ref_node
*ref
,
659 struct btrfs_delayed_tree_ref
*full_ref
,
662 TP_ARGS(fs_info
, ref
, full_ref
, action
),
664 TP_STRUCT__entry_btrfs(
665 __field( u64
, bytenr
)
666 __field( u64
, num_bytes
)
667 __field( int, action
)
668 __field( u64
, parent
)
669 __field( u64
, ref_root
)
670 __field( int, level
)
675 TP_fast_assign_btrfs(fs_info
,
676 __entry
->bytenr
= ref
->bytenr
;
677 __entry
->num_bytes
= ref
->num_bytes
;
678 __entry
->action
= action
;
679 __entry
->parent
= full_ref
->parent
;
680 __entry
->ref_root
= full_ref
->root
;
681 __entry
->level
= full_ref
->level
;
682 __entry
->type
= ref
->type
;
683 __entry
->seq
= ref
->seq
;
686 TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s "
687 "parent=%llu(%s) ref_root=%llu(%s) level=%d "
689 (unsigned long long)__entry
->bytenr
,
690 (unsigned long long)__entry
->num_bytes
,
691 show_ref_action(__entry
->action
),
692 show_root_type(__entry
->parent
),
693 show_root_type(__entry
->ref_root
),
694 __entry
->level
, show_ref_type(__entry
->type
),
695 (unsigned long long)__entry
->seq
)
698 DEFINE_EVENT(btrfs_delayed_tree_ref
, add_delayed_tree_ref
,
700 TP_PROTO(struct btrfs_fs_info
*fs_info
,
701 struct btrfs_delayed_ref_node
*ref
,
702 struct btrfs_delayed_tree_ref
*full_ref
,
705 TP_ARGS(fs_info
, ref
, full_ref
, action
)
708 DEFINE_EVENT(btrfs_delayed_tree_ref
, run_delayed_tree_ref
,
710 TP_PROTO(struct btrfs_fs_info
*fs_info
,
711 struct btrfs_delayed_ref_node
*ref
,
712 struct btrfs_delayed_tree_ref
*full_ref
,
715 TP_ARGS(fs_info
, ref
, full_ref
, action
)
718 DECLARE_EVENT_CLASS(btrfs_delayed_data_ref
,
720 TP_PROTO(struct btrfs_fs_info
*fs_info
,
721 struct btrfs_delayed_ref_node
*ref
,
722 struct btrfs_delayed_data_ref
*full_ref
,
725 TP_ARGS(fs_info
, ref
, full_ref
, action
),
727 TP_STRUCT__entry_btrfs(
728 __field( u64
, bytenr
)
729 __field( u64
, num_bytes
)
730 __field( int, action
)
731 __field( u64
, parent
)
732 __field( u64
, ref_root
)
733 __field( u64
, owner
)
734 __field( u64
, offset
)
739 TP_fast_assign_btrfs(fs_info
,
740 __entry
->bytenr
= ref
->bytenr
;
741 __entry
->num_bytes
= ref
->num_bytes
;
742 __entry
->action
= action
;
743 __entry
->parent
= full_ref
->parent
;
744 __entry
->ref_root
= full_ref
->root
;
745 __entry
->owner
= full_ref
->objectid
;
746 __entry
->offset
= full_ref
->offset
;
747 __entry
->type
= ref
->type
;
748 __entry
->seq
= ref
->seq
;
751 TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s "
752 "parent=%llu(%s) ref_root=%llu(%s) owner=%llu "
753 "offset=%llu type=%s seq=%llu",
754 (unsigned long long)__entry
->bytenr
,
755 (unsigned long long)__entry
->num_bytes
,
756 show_ref_action(__entry
->action
),
757 show_root_type(__entry
->parent
),
758 show_root_type(__entry
->ref_root
),
759 (unsigned long long)__entry
->owner
,
760 (unsigned long long)__entry
->offset
,
761 show_ref_type(__entry
->type
),
762 (unsigned long long)__entry
->seq
)
765 DEFINE_EVENT(btrfs_delayed_data_ref
, add_delayed_data_ref
,
767 TP_PROTO(struct btrfs_fs_info
*fs_info
,
768 struct btrfs_delayed_ref_node
*ref
,
769 struct btrfs_delayed_data_ref
*full_ref
,
772 TP_ARGS(fs_info
, ref
, full_ref
, action
)
775 DEFINE_EVENT(btrfs_delayed_data_ref
, run_delayed_data_ref
,
777 TP_PROTO(struct btrfs_fs_info
*fs_info
,
778 struct btrfs_delayed_ref_node
*ref
,
779 struct btrfs_delayed_data_ref
*full_ref
,
782 TP_ARGS(fs_info
, ref
, full_ref
, action
)
785 DECLARE_EVENT_CLASS(btrfs_delayed_ref_head
,
787 TP_PROTO(struct btrfs_fs_info
*fs_info
,
788 struct btrfs_delayed_ref_node
*ref
,
789 struct btrfs_delayed_ref_head
*head_ref
,
792 TP_ARGS(fs_info
, ref
, head_ref
, action
),
794 TP_STRUCT__entry_btrfs(
795 __field( u64
, bytenr
)
796 __field( u64
, num_bytes
)
797 __field( int, action
)
798 __field( int, is_data
)
801 TP_fast_assign_btrfs(fs_info
,
802 __entry
->bytenr
= ref
->bytenr
;
803 __entry
->num_bytes
= ref
->num_bytes
;
804 __entry
->action
= action
;
805 __entry
->is_data
= head_ref
->is_data
;
808 TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d",
809 (unsigned long long)__entry
->bytenr
,
810 (unsigned long long)__entry
->num_bytes
,
811 show_ref_action(__entry
->action
),
815 DEFINE_EVENT(btrfs_delayed_ref_head
, add_delayed_ref_head
,
817 TP_PROTO(struct btrfs_fs_info
*fs_info
,
818 struct btrfs_delayed_ref_node
*ref
,
819 struct btrfs_delayed_ref_head
*head_ref
,
822 TP_ARGS(fs_info
, ref
, head_ref
, action
)
825 DEFINE_EVENT(btrfs_delayed_ref_head
, run_delayed_ref_head
,
827 TP_PROTO(struct btrfs_fs_info
*fs_info
,
828 struct btrfs_delayed_ref_node
*ref
,
829 struct btrfs_delayed_ref_head
*head_ref
,
832 TP_ARGS(fs_info
, ref
, head_ref
, action
)
835 #define show_chunk_type(type) \
836 __print_flags(type, "|", \
837 { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \
838 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
839 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
840 { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \
841 { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \
842 { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \
843 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
844 { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \
845 { BTRFS_BLOCK_GROUP_RAID6, "RAID6" })
847 DECLARE_EVENT_CLASS(btrfs__chunk
,
849 TP_PROTO(struct btrfs_fs_info
*fs_info
, struct map_lookup
*map
,
850 u64 offset
, u64 size
),
852 TP_ARGS(fs_info
, map
, offset
, size
),
854 TP_STRUCT__entry_btrfs(
855 __field( int, num_stripes
)
857 __field( int, sub_stripes
)
858 __field( u64
, offset
)
860 __field( u64
, root_objectid
)
863 TP_fast_assign_btrfs(fs_info
,
864 __entry
->num_stripes
= map
->num_stripes
;
865 __entry
->type
= map
->type
;
866 __entry
->sub_stripes
= map
->sub_stripes
;
867 __entry
->offset
= offset
;
868 __entry
->size
= size
;
869 __entry
->root_objectid
= fs_info
->chunk_root
->root_key
.objectid
;
872 TP_printk_btrfs("root=%llu(%s) offset=%llu size=%llu "
873 "num_stripes=%d sub_stripes=%d type=%s",
874 show_root_type(__entry
->root_objectid
),
875 (unsigned long long)__entry
->offset
,
876 (unsigned long long)__entry
->size
,
877 __entry
->num_stripes
, __entry
->sub_stripes
,
878 show_chunk_type(__entry
->type
))
881 DEFINE_EVENT(btrfs__chunk
, btrfs_chunk_alloc
,
883 TP_PROTO(struct btrfs_fs_info
*fs_info
, struct map_lookup
*map
,
884 u64 offset
, u64 size
),
886 TP_ARGS(fs_info
, map
, offset
, size
)
889 DEFINE_EVENT(btrfs__chunk
, btrfs_chunk_free
,
891 TP_PROTO(struct btrfs_fs_info
*fs_info
, struct map_lookup
*map
,
892 u64 offset
, u64 size
),
894 TP_ARGS(fs_info
, map
, offset
, size
)
897 TRACE_EVENT(btrfs_cow_block
,
899 TP_PROTO(struct btrfs_root
*root
, struct extent_buffer
*buf
,
900 struct extent_buffer
*cow
),
902 TP_ARGS(root
, buf
, cow
),
904 TP_STRUCT__entry_btrfs(
905 __field( u64
, root_objectid
)
906 __field( u64
, buf_start
)
908 __field( u64
, cow_start
)
909 __field( int, buf_level
)
910 __field( int, cow_level
)
913 TP_fast_assign_btrfs(root
->fs_info
,
914 __entry
->root_objectid
= root
->root_key
.objectid
;
915 __entry
->buf_start
= buf
->start
;
916 __entry
->refs
= atomic_read(&buf
->refs
);
917 __entry
->cow_start
= cow
->start
;
918 __entry
->buf_level
= btrfs_header_level(buf
);
919 __entry
->cow_level
= btrfs_header_level(cow
);
922 TP_printk_btrfs("root=%llu(%s) refs=%d orig_buf=%llu "
923 "(orig_level=%d) cow_buf=%llu (cow_level=%d)",
924 show_root_type(__entry
->root_objectid
),
926 (unsigned long long)__entry
->buf_start
,
928 (unsigned long long)__entry
->cow_start
,
932 TRACE_EVENT(btrfs_space_reservation
,
934 TP_PROTO(struct btrfs_fs_info
*fs_info
, char *type
, u64 val
,
935 u64 bytes
, int reserve
),
937 TP_ARGS(fs_info
, type
, val
, bytes
, reserve
),
939 TP_STRUCT__entry_btrfs(
940 __string( type
, type
)
942 __field( u64
, bytes
)
943 __field( int, reserve
)
946 TP_fast_assign_btrfs(fs_info
,
947 __assign_str(type
, type
);
949 __entry
->bytes
= bytes
;
950 __entry
->reserve
= reserve
;
953 TP_printk_btrfs("%s: %Lu %s %Lu", __get_str(type
), __entry
->val
,
954 __entry
->reserve
? "reserve" : "release",
958 #define show_flush_action(action) \
959 __print_symbolic(action, \
960 { BTRFS_RESERVE_NO_FLUSH, "BTRFS_RESERVE_NO_FLUSH"}, \
961 { BTRFS_RESERVE_FLUSH_LIMIT, "BTRFS_RESERVE_FLUSH_LIMIT"}, \
962 { BTRFS_RESERVE_FLUSH_ALL, "BTRFS_RESERVE_FLUSH_ALL"})
964 TRACE_EVENT(btrfs_trigger_flush
,
966 TP_PROTO(struct btrfs_fs_info
*fs_info
, u64 flags
, u64 bytes
,
967 int flush
, char *reason
),
969 TP_ARGS(fs_info
, flags
, bytes
, flush
, reason
),
972 __array( u8
, fsid
, BTRFS_UUID_SIZE
)
973 __field( u64
, flags
)
974 __field( u64
, bytes
)
975 __field( int, flush
)
976 __string( reason
, reason
)
980 memcpy(__entry
->fsid
, fs_info
->fsid
, BTRFS_UUID_SIZE
);
981 __entry
->flags
= flags
;
982 __entry
->bytes
= bytes
;
983 __entry
->flush
= flush
;
984 __assign_str(reason
, reason
)
987 TP_printk("%pU: %s: flush=%d(%s) flags=%llu(%s) bytes=%llu",
988 __entry
->fsid
, __get_str(reason
), __entry
->flush
,
989 show_flush_action(__entry
->flush
),
990 (unsigned long long)__entry
->flags
,
991 __print_flags((unsigned long)__entry
->flags
, "|",
993 (unsigned long long)__entry
->bytes
)
996 #define show_flush_state(state) \
997 __print_symbolic(state, \
998 { FLUSH_DELAYED_ITEMS_NR, "FLUSH_DELAYED_ITEMS_NR"}, \
999 { FLUSH_DELAYED_ITEMS, "FLUSH_DELAYED_ITEMS"}, \
1000 { FLUSH_DELALLOC, "FLUSH_DELALLOC"}, \
1001 { FLUSH_DELALLOC_WAIT, "FLUSH_DELALLOC_WAIT"}, \
1002 { ALLOC_CHUNK, "ALLOC_CHUNK"}, \
1003 { COMMIT_TRANS, "COMMIT_TRANS"})
1005 TRACE_EVENT(btrfs_flush_space
,
1007 TP_PROTO(struct btrfs_fs_info
*fs_info
, u64 flags
, u64 num_bytes
,
1008 u64 orig_bytes
, int state
, int ret
),
1010 TP_ARGS(fs_info
, flags
, num_bytes
, orig_bytes
, state
, ret
),
1013 __array( u8
, fsid
, BTRFS_UUID_SIZE
)
1014 __field( u64
, flags
)
1015 __field( u64
, num_bytes
)
1016 __field( u64
, orig_bytes
)
1017 __field( int, state
)
1022 memcpy(__entry
->fsid
, fs_info
->fsid
, BTRFS_UUID_SIZE
);
1023 __entry
->flags
= flags
;
1024 __entry
->num_bytes
= num_bytes
;
1025 __entry
->orig_bytes
= orig_bytes
;
1026 __entry
->state
= state
;
1030 TP_printk("%pU: state=%d(%s) flags=%llu(%s) num_bytes=%llu "
1031 "orig_bytes=%llu ret=%d", __entry
->fsid
, __entry
->state
,
1032 show_flush_state(__entry
->state
),
1033 (unsigned long long)__entry
->flags
,
1034 __print_flags((unsigned long)__entry
->flags
, "|",
1036 (unsigned long long)__entry
->num_bytes
,
1037 (unsigned long long)__entry
->orig_bytes
, __entry
->ret
)
1040 DECLARE_EVENT_CLASS(btrfs__reserved_extent
,
1042 TP_PROTO(struct btrfs_fs_info
*fs_info
, u64 start
, u64 len
),
1044 TP_ARGS(fs_info
, start
, len
),
1046 TP_STRUCT__entry_btrfs(
1047 __field( u64
, start
)
1051 TP_fast_assign_btrfs(fs_info
,
1052 __entry
->start
= start
;
1056 TP_printk_btrfs("root=%llu(%s) start=%llu len=%llu",
1057 show_root_type(BTRFS_EXTENT_TREE_OBJECTID
),
1058 (unsigned long long)__entry
->start
,
1059 (unsigned long long)__entry
->len
)
1062 DEFINE_EVENT(btrfs__reserved_extent
, btrfs_reserved_extent_alloc
,
1064 TP_PROTO(struct btrfs_fs_info
*fs_info
, u64 start
, u64 len
),
1066 TP_ARGS(fs_info
, start
, len
)
1069 DEFINE_EVENT(btrfs__reserved_extent
, btrfs_reserved_extent_free
,
1071 TP_PROTO(struct btrfs_fs_info
*fs_info
, u64 start
, u64 len
),
1073 TP_ARGS(fs_info
, start
, len
)
1076 TRACE_EVENT(find_free_extent
,
1078 TP_PROTO(struct btrfs_fs_info
*fs_info
, u64 num_bytes
, u64 empty_size
,
1081 TP_ARGS(fs_info
, num_bytes
, empty_size
, data
),
1083 TP_STRUCT__entry_btrfs(
1084 __field( u64
, num_bytes
)
1085 __field( u64
, empty_size
)
1086 __field( u64
, data
)
1089 TP_fast_assign_btrfs(fs_info
,
1090 __entry
->num_bytes
= num_bytes
;
1091 __entry
->empty_size
= empty_size
;
1092 __entry
->data
= data
;
1095 TP_printk_btrfs("root=%Lu(%s) len=%Lu empty_size=%Lu flags=%Lu(%s)",
1096 show_root_type(BTRFS_EXTENT_TREE_OBJECTID
),
1097 __entry
->num_bytes
, __entry
->empty_size
, __entry
->data
,
1098 __print_flags((unsigned long)__entry
->data
, "|",
1102 DECLARE_EVENT_CLASS(btrfs__reserve_extent
,
1104 TP_PROTO(struct btrfs_fs_info
*fs_info
,
1105 struct btrfs_block_group_cache
*block_group
, u64 start
,
1108 TP_ARGS(fs_info
, block_group
, start
, len
),
1110 TP_STRUCT__entry_btrfs(
1111 __field( u64
, bg_objectid
)
1112 __field( u64
, flags
)
1113 __field( u64
, start
)
1117 TP_fast_assign_btrfs(fs_info
,
1118 __entry
->bg_objectid
= block_group
->key
.objectid
;
1119 __entry
->flags
= block_group
->flags
;
1120 __entry
->start
= start
;
1124 TP_printk_btrfs("root=%Lu(%s) block_group=%Lu flags=%Lu(%s) "
1125 "start=%Lu len=%Lu",
1126 show_root_type(BTRFS_EXTENT_TREE_OBJECTID
),
1127 __entry
->bg_objectid
,
1128 __entry
->flags
, __print_flags((unsigned long)__entry
->flags
,
1129 "|", BTRFS_GROUP_FLAGS
),
1130 __entry
->start
, __entry
->len
)
1133 DEFINE_EVENT(btrfs__reserve_extent
, btrfs_reserve_extent
,
1135 TP_PROTO(struct btrfs_fs_info
*fs_info
,
1136 struct btrfs_block_group_cache
*block_group
, u64 start
,
1139 TP_ARGS(fs_info
, block_group
, start
, len
)
1142 DEFINE_EVENT(btrfs__reserve_extent
, btrfs_reserve_extent_cluster
,
1144 TP_PROTO(struct btrfs_fs_info
*fs_info
,
1145 struct btrfs_block_group_cache
*block_group
, u64 start
,
1148 TP_ARGS(fs_info
, block_group
, start
, len
)
1151 TRACE_EVENT(btrfs_find_cluster
,
1153 TP_PROTO(struct btrfs_block_group_cache
*block_group
, u64 start
,
1154 u64 bytes
, u64 empty_size
, u64 min_bytes
),
1156 TP_ARGS(block_group
, start
, bytes
, empty_size
, min_bytes
),
1158 TP_STRUCT__entry_btrfs(
1159 __field( u64
, bg_objectid
)
1160 __field( u64
, flags
)
1161 __field( u64
, start
)
1162 __field( u64
, bytes
)
1163 __field( u64
, empty_size
)
1164 __field( u64
, min_bytes
)
1167 TP_fast_assign_btrfs(block_group
->fs_info
,
1168 __entry
->bg_objectid
= block_group
->key
.objectid
;
1169 __entry
->flags
= block_group
->flags
;
1170 __entry
->start
= start
;
1171 __entry
->bytes
= bytes
;
1172 __entry
->empty_size
= empty_size
;
1173 __entry
->min_bytes
= min_bytes
;
1176 TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) start=%Lu len=%Lu "
1177 "empty_size=%Lu min_bytes=%Lu", __entry
->bg_objectid
,
1179 __print_flags((unsigned long)__entry
->flags
, "|",
1180 BTRFS_GROUP_FLAGS
), __entry
->start
,
1181 __entry
->bytes
, __entry
->empty_size
, __entry
->min_bytes
)
1184 TRACE_EVENT(btrfs_failed_cluster_setup
,
1186 TP_PROTO(struct btrfs_block_group_cache
*block_group
),
1188 TP_ARGS(block_group
),
1190 TP_STRUCT__entry_btrfs(
1191 __field( u64
, bg_objectid
)
1194 TP_fast_assign_btrfs(block_group
->fs_info
,
1195 __entry
->bg_objectid
= block_group
->key
.objectid
;
1198 TP_printk_btrfs("block_group=%Lu", __entry
->bg_objectid
)
1201 TRACE_EVENT(btrfs_setup_cluster
,
1203 TP_PROTO(struct btrfs_block_group_cache
*block_group
,
1204 struct btrfs_free_cluster
*cluster
, u64 size
, int bitmap
),
1206 TP_ARGS(block_group
, cluster
, size
, bitmap
),
1208 TP_STRUCT__entry_btrfs(
1209 __field( u64
, bg_objectid
)
1210 __field( u64
, flags
)
1211 __field( u64
, start
)
1212 __field( u64
, max_size
)
1213 __field( u64
, size
)
1214 __field( int, bitmap
)
1217 TP_fast_assign_btrfs(block_group
->fs_info
,
1218 __entry
->bg_objectid
= block_group
->key
.objectid
;
1219 __entry
->flags
= block_group
->flags
;
1220 __entry
->start
= cluster
->window_start
;
1221 __entry
->max_size
= cluster
->max_size
;
1222 __entry
->size
= size
;
1223 __entry
->bitmap
= bitmap
;
1226 TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) window_start=%Lu "
1227 "size=%Lu max_size=%Lu bitmap=%d",
1228 __entry
->bg_objectid
,
1230 __print_flags((unsigned long)__entry
->flags
, "|",
1231 BTRFS_GROUP_FLAGS
), __entry
->start
,
1232 __entry
->size
, __entry
->max_size
, __entry
->bitmap
)
1235 struct extent_state
;
1236 TRACE_EVENT(alloc_extent_state
,
1238 TP_PROTO(struct extent_state
*state
, gfp_t mask
, unsigned long IP
),
1240 TP_ARGS(state
, mask
, IP
),
1243 __field(struct extent_state
*, state
)
1244 __field(gfp_t
, mask
)
1245 __field(unsigned long, ip
)
1249 __entry
->state
= state
,
1250 __entry
->mask
= mask
,
1254 TP_printk("state=%p mask=%s caller=%pS", __entry
->state
,
1255 show_gfp_flags(__entry
->mask
), (void *)__entry
->ip
)
1258 TRACE_EVENT(free_extent_state
,
1260 TP_PROTO(struct extent_state
*state
, unsigned long IP
),
1265 __field(struct extent_state
*, state
)
1266 __field(unsigned long, ip
)
1270 __entry
->state
= state
,
1274 TP_printk("state=%p caller=%pS", __entry
->state
,
1275 (void *)__entry
->ip
)
1278 DECLARE_EVENT_CLASS(btrfs__work
,
1280 TP_PROTO(struct btrfs_work
*work
),
1284 TP_STRUCT__entry_btrfs(
1285 __field( void *, work
)
1286 __field( void *, wq
)
1287 __field( void *, func
)
1288 __field( void *, ordered_func
)
1289 __field( void *, ordered_free
)
1290 __field( void *, normal_work
)
1293 TP_fast_assign_btrfs(btrfs_work_owner(work
),
1294 __entry
->work
= work
;
1295 __entry
->wq
= work
->wq
;
1296 __entry
->func
= work
->func
;
1297 __entry
->ordered_func
= work
->ordered_func
;
1298 __entry
->ordered_free
= work
->ordered_free
;
1299 __entry
->normal_work
= &work
->normal_work
;
1302 TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%pf ordered_func=%p "
1304 __entry
->work
, __entry
->normal_work
, __entry
->wq
,
1305 __entry
->func
, __entry
->ordered_func
, __entry
->ordered_free
)
1309 * For situiations when the work is freed, we pass fs_info and a tag that that
1310 * matches address of the work structure so it can be paired with the
1313 DECLARE_EVENT_CLASS(btrfs__work__done
,
1315 TP_PROTO(struct btrfs_fs_info
*fs_info
, void *wtag
),
1317 TP_ARGS(fs_info
, wtag
),
1319 TP_STRUCT__entry_btrfs(
1320 __field( void *, wtag
)
1323 TP_fast_assign_btrfs(fs_info
,
1324 __entry
->wtag
= wtag
;
1327 TP_printk_btrfs("work->%p", __entry
->wtag
)
1330 DEFINE_EVENT(btrfs__work
, btrfs_work_queued
,
1332 TP_PROTO(struct btrfs_work
*work
),
1337 DEFINE_EVENT(btrfs__work
, btrfs_work_sched
,
1339 TP_PROTO(struct btrfs_work
*work
),
1344 DEFINE_EVENT(btrfs__work__done
, btrfs_all_work_done
,
1346 TP_PROTO(struct btrfs_fs_info
*fs_info
, void *wtag
),
1348 TP_ARGS(fs_info
, wtag
)
1351 DEFINE_EVENT(btrfs__work
, btrfs_ordered_sched
,
1353 TP_PROTO(struct btrfs_work
*work
),
1358 DECLARE_EVENT_CLASS(btrfs__workqueue
,
1360 TP_PROTO(struct __btrfs_workqueue
*wq
, const char *name
, int high
),
1362 TP_ARGS(wq
, name
, high
),
1364 TP_STRUCT__entry_btrfs(
1365 __field( void *, wq
)
1366 __string( name
, name
)
1367 __field( int , high
)
1370 TP_fast_assign_btrfs(btrfs_workqueue_owner(wq
),
1372 __assign_str(name
, name
);
1373 __entry
->high
= high
;
1376 TP_printk_btrfs("name=%s%s wq=%p", __get_str(name
),
1377 __print_flags(__entry
->high
, "",
1378 {(WQ_HIGHPRI
), "-high"}),
1382 DEFINE_EVENT(btrfs__workqueue
, btrfs_workqueue_alloc
,
1384 TP_PROTO(struct __btrfs_workqueue
*wq
, const char *name
, int high
),
1386 TP_ARGS(wq
, name
, high
)
1389 DECLARE_EVENT_CLASS(btrfs__workqueue_done
,
1391 TP_PROTO(struct __btrfs_workqueue
*wq
),
1395 TP_STRUCT__entry_btrfs(
1396 __field( void *, wq
)
1399 TP_fast_assign_btrfs(btrfs_workqueue_owner(wq
),
1403 TP_printk_btrfs("wq=%p", __entry
->wq
)
1406 DEFINE_EVENT(btrfs__workqueue_done
, btrfs_workqueue_destroy
,
1408 TP_PROTO(struct __btrfs_workqueue
*wq
),
1413 #define BTRFS_QGROUP_OPERATIONS \
1414 { QGROUP_RESERVE, "reserve" }, \
1415 { QGROUP_RELEASE, "release" }, \
1416 { QGROUP_FREE, "free" }
1418 DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data
,
1420 TP_PROTO(struct inode
*inode
, u64 start
, u64 len
, u64 reserved
, int op
),
1422 TP_ARGS(inode
, start
, len
, reserved
, op
),
1424 TP_STRUCT__entry_btrfs(
1425 __field( u64
, rootid
)
1426 __field( unsigned long, ino
)
1427 __field( u64
, start
)
1429 __field( u64
, reserved
)
1433 TP_fast_assign_btrfs(btrfs_sb(inode
->i_sb
),
1434 __entry
->rootid
= BTRFS_I(inode
)->root
->objectid
;
1435 __entry
->ino
= inode
->i_ino
;
1436 __entry
->start
= start
;
1438 __entry
->reserved
= reserved
;
1442 TP_printk_btrfs("root=%llu ino=%lu start=%llu len=%llu reserved=%llu op=%s",
1443 __entry
->rootid
, __entry
->ino
, __entry
->start
, __entry
->len
,
1445 __print_flags((unsigned long)__entry
->op
, "",
1446 BTRFS_QGROUP_OPERATIONS
)
1450 DEFINE_EVENT(btrfs__qgroup_rsv_data
, btrfs_qgroup_reserve_data
,
1452 TP_PROTO(struct inode
*inode
, u64 start
, u64 len
, u64 reserved
, int op
),
1454 TP_ARGS(inode
, start
, len
, reserved
, op
)
1457 DEFINE_EVENT(btrfs__qgroup_rsv_data
, btrfs_qgroup_release_data
,
1459 TP_PROTO(struct inode
*inode
, u64 start
, u64 len
, u64 reserved
, int op
),
1461 TP_ARGS(inode
, start
, len
, reserved
, op
)
1464 DECLARE_EVENT_CLASS(btrfs__qgroup_delayed_ref
,
1466 TP_PROTO(struct btrfs_fs_info
*fs_info
, u64 ref_root
, u64 reserved
),
1468 TP_ARGS(fs_info
, ref_root
, reserved
),
1470 TP_STRUCT__entry_btrfs(
1471 __field( u64
, ref_root
)
1472 __field( u64
, reserved
)
1475 TP_fast_assign_btrfs(fs_info
,
1476 __entry
->ref_root
= ref_root
;
1477 __entry
->reserved
= reserved
;
1480 TP_printk_btrfs("root=%llu reserved=%llu op=free",
1481 __entry
->ref_root
, __entry
->reserved
)
1484 DEFINE_EVENT(btrfs__qgroup_delayed_ref
, btrfs_qgroup_free_delayed_ref
,
1486 TP_PROTO(struct btrfs_fs_info
*fs_info
, u64 ref_root
, u64 reserved
),
1488 TP_ARGS(fs_info
, ref_root
, reserved
)
1491 DECLARE_EVENT_CLASS(btrfs_qgroup_extent
,
1492 TP_PROTO(struct btrfs_fs_info
*fs_info
,
1493 struct btrfs_qgroup_extent_record
*rec
),
1495 TP_ARGS(fs_info
, rec
),
1497 TP_STRUCT__entry_btrfs(
1498 __field( u64
, bytenr
)
1499 __field( u64
, num_bytes
)
1502 TP_fast_assign_btrfs(fs_info
,
1503 __entry
->bytenr
= rec
->bytenr
,
1504 __entry
->num_bytes
= rec
->num_bytes
;
1507 TP_printk_btrfs("bytenr=%llu num_bytes=%llu",
1508 (unsigned long long)__entry
->bytenr
,
1509 (unsigned long long)__entry
->num_bytes
)
1512 DEFINE_EVENT(btrfs_qgroup_extent
, btrfs_qgroup_account_extents
,
1514 TP_PROTO(struct btrfs_fs_info
*fs_info
,
1515 struct btrfs_qgroup_extent_record
*rec
),
1517 TP_ARGS(fs_info
, rec
)
1520 DEFINE_EVENT(btrfs_qgroup_extent
, btrfs_qgroup_trace_extent
,
1522 TP_PROTO(struct btrfs_fs_info
*fs_info
,
1523 struct btrfs_qgroup_extent_record
*rec
),
1525 TP_ARGS(fs_info
, rec
)
1528 TRACE_EVENT(btrfs_qgroup_account_extent
,
1530 TP_PROTO(struct btrfs_fs_info
*fs_info
, u64 bytenr
,
1531 u64 num_bytes
, u64 nr_old_roots
, u64 nr_new_roots
),
1533 TP_ARGS(fs_info
, bytenr
, num_bytes
, nr_old_roots
, nr_new_roots
),
1535 TP_STRUCT__entry_btrfs(
1536 __field( u64
, bytenr
)
1537 __field( u64
, num_bytes
)
1538 __field( u64
, nr_old_roots
)
1539 __field( u64
, nr_new_roots
)
1542 TP_fast_assign_btrfs(fs_info
,
1543 __entry
->bytenr
= bytenr
;
1544 __entry
->num_bytes
= num_bytes
;
1545 __entry
->nr_old_roots
= nr_old_roots
;
1546 __entry
->nr_new_roots
= nr_new_roots
;
1549 TP_printk_btrfs("bytenr=%llu num_bytes=%llu nr_old_roots=%llu "
1550 "nr_new_roots=%llu",
1553 __entry
->nr_old_roots
,
1554 __entry
->nr_new_roots
)
1557 TRACE_EVENT(qgroup_update_counters
,
1559 TP_PROTO(struct btrfs_fs_info
*fs_info
, u64 qgid
,
1560 u64 cur_old_count
, u64 cur_new_count
),
1562 TP_ARGS(fs_info
, qgid
, cur_old_count
, cur_new_count
),
1564 TP_STRUCT__entry_btrfs(
1565 __field( u64
, qgid
)
1566 __field( u64
, cur_old_count
)
1567 __field( u64
, cur_new_count
)
1570 TP_fast_assign_btrfs(fs_info
,
1571 __entry
->qgid
= qgid
;
1572 __entry
->cur_old_count
= cur_old_count
;
1573 __entry
->cur_new_count
= cur_new_count
;
1576 TP_printk_btrfs("qgid=%llu cur_old_count=%llu cur_new_count=%llu",
1578 __entry
->cur_old_count
,
1579 __entry
->cur_new_count
)
1582 TRACE_EVENT(qgroup_update_reserve
,
1584 TP_PROTO(struct btrfs_fs_info
*fs_info
, struct btrfs_qgroup
*qgroup
,
1587 TP_ARGS(fs_info
, qgroup
, diff
),
1589 TP_STRUCT__entry_btrfs(
1590 __field( u64
, qgid
)
1591 __field( u64
, cur_reserved
)
1592 __field( s64
, diff
)
1595 TP_fast_assign_btrfs(fs_info
,
1596 __entry
->qgid
= qgroup
->qgroupid
;
1597 __entry
->cur_reserved
= qgroup
->reserved
;
1598 __entry
->diff
= diff
;
1601 TP_printk_btrfs("qgid=%llu cur_reserved=%llu diff=%lld",
1602 __entry
->qgid
, __entry
->cur_reserved
, __entry
->diff
)
1605 TRACE_EVENT(qgroup_meta_reserve
,
1607 TP_PROTO(struct btrfs_root
*root
, s64 diff
),
1609 TP_ARGS(root
, diff
),
1611 TP_STRUCT__entry_btrfs(
1612 __field( u64
, refroot
)
1613 __field( s64
, diff
)
1616 TP_fast_assign_btrfs(root
->fs_info
,
1617 __entry
->refroot
= root
->objectid
;
1618 __entry
->diff
= diff
;
1621 TP_printk_btrfs("refroot=%llu(%s) diff=%lld",
1622 show_root_type(__entry
->refroot
), __entry
->diff
)
1625 #endif /* _TRACE_BTRFS_H */
1627 /* This part must be outside protection */
1628 #include <trace/define_trace.h>