unify {de,}mangle_poll(), get rid of kernel-side POLL...
[cris-mirror.git] / include / trace / events / btrfs.h
blobc3ac5ec865198e0dfbe5da979dbc32ca2c71bfe0
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM btrfs
5 #if !defined(_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_BTRFS_H
8 #include <linux/writeback.h>
9 #include <linux/tracepoint.h>
10 #include <trace/events/mmflags.h>
12 struct btrfs_root;
13 struct btrfs_fs_info;
14 struct btrfs_inode;
15 struct extent_map;
16 struct btrfs_file_extent_item;
17 struct btrfs_ordered_extent;
18 struct btrfs_delayed_ref_node;
19 struct btrfs_delayed_tree_ref;
20 struct btrfs_delayed_data_ref;
21 struct btrfs_delayed_ref_head;
22 struct btrfs_block_group_cache;
23 struct btrfs_free_cluster;
24 struct map_lookup;
25 struct extent_buffer;
26 struct btrfs_work;
27 struct __btrfs_workqueue;
28 struct btrfs_qgroup_extent_record;
29 struct btrfs_qgroup;
30 struct prelim_ref;
32 TRACE_DEFINE_ENUM(FLUSH_DELAYED_ITEMS_NR);
33 TRACE_DEFINE_ENUM(FLUSH_DELAYED_ITEMS);
34 TRACE_DEFINE_ENUM(FLUSH_DELALLOC);
35 TRACE_DEFINE_ENUM(FLUSH_DELALLOC_WAIT);
36 TRACE_DEFINE_ENUM(ALLOC_CHUNK);
37 TRACE_DEFINE_ENUM(COMMIT_TRANS);
39 #define show_ref_type(type) \
40 __print_symbolic(type, \
41 { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \
42 { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \
43 { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \
44 { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \
45 { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" })
47 #define __show_root_type(obj) \
48 __print_symbolic_u64(obj, \
49 { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \
50 { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \
51 { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \
52 { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \
53 { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \
54 { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \
55 { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \
56 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \
57 { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \
58 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \
59 { BTRFS_UUID_TREE_OBJECTID, "UUID_TREE" }, \
60 { BTRFS_FREE_SPACE_TREE_OBJECTID, "FREE_SPACE_TREE" }, \
61 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
63 #define show_root_type(obj) \
64 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
65 (obj >= BTRFS_ROOT_TREE_OBJECTID && \
66 obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
68 #define show_fi_type(type) \
69 __print_symbolic(type, \
70 { BTRFS_FILE_EXTENT_INLINE, "INLINE" }, \
71 { BTRFS_FILE_EXTENT_REG, "REG" }, \
72 { BTRFS_FILE_EXTENT_PREALLOC, "PREALLOC"})
74 #define BTRFS_GROUP_FLAGS \
75 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \
76 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
77 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
78 { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \
79 { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \
80 { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \
81 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
82 { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \
83 { BTRFS_BLOCK_GROUP_RAID6, "RAID6"}
85 #define BTRFS_FSID_SIZE 16
86 #define TP_STRUCT__entry_fsid __array(u8, fsid, BTRFS_FSID_SIZE)
88 #define TP_fast_assign_fsid(fs_info) \
89 memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE)
91 #define TP_STRUCT__entry_btrfs(args...) \
92 TP_STRUCT__entry( \
93 TP_STRUCT__entry_fsid \
94 args)
95 #define TP_fast_assign_btrfs(fs_info, args...) \
96 TP_fast_assign( \
97 TP_fast_assign_fsid(fs_info); \
98 args)
99 #define TP_printk_btrfs(fmt, args...) \
100 TP_printk("%pU: " fmt, __entry->fsid, args)
102 TRACE_EVENT(btrfs_transaction_commit,
104 TP_PROTO(const struct btrfs_root *root),
106 TP_ARGS(root),
108 TP_STRUCT__entry_btrfs(
109 __field( u64, generation )
110 __field( u64, root_objectid )
113 TP_fast_assign_btrfs(root->fs_info,
114 __entry->generation = root->fs_info->generation;
115 __entry->root_objectid = root->root_key.objectid;
118 TP_printk_btrfs("root = %llu(%s), gen = %llu",
119 show_root_type(__entry->root_objectid),
120 (unsigned long long)__entry->generation)
123 DECLARE_EVENT_CLASS(btrfs__inode,
125 TP_PROTO(const struct inode *inode),
127 TP_ARGS(inode),
129 TP_STRUCT__entry_btrfs(
130 __field( ino_t, ino )
131 __field( blkcnt_t, blocks )
132 __field( u64, disk_i_size )
133 __field( u64, generation )
134 __field( u64, last_trans )
135 __field( u64, logged_trans )
136 __field( u64, root_objectid )
139 TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
140 __entry->ino = inode->i_ino;
141 __entry->blocks = inode->i_blocks;
142 __entry->disk_i_size = BTRFS_I(inode)->disk_i_size;
143 __entry->generation = BTRFS_I(inode)->generation;
144 __entry->last_trans = BTRFS_I(inode)->last_trans;
145 __entry->logged_trans = BTRFS_I(inode)->logged_trans;
146 __entry->root_objectid =
147 BTRFS_I(inode)->root->root_key.objectid;
150 TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%lu blocks=%llu "
151 "disk_i_size=%llu last_trans=%llu logged_trans=%llu",
152 show_root_type(__entry->root_objectid),
153 (unsigned long long)__entry->generation,
154 (unsigned long)__entry->ino,
155 (unsigned long long)__entry->blocks,
156 (unsigned long long)__entry->disk_i_size,
157 (unsigned long long)__entry->last_trans,
158 (unsigned long long)__entry->logged_trans)
161 DEFINE_EVENT(btrfs__inode, btrfs_inode_new,
163 TP_PROTO(const struct inode *inode),
165 TP_ARGS(inode)
168 DEFINE_EVENT(btrfs__inode, btrfs_inode_request,
170 TP_PROTO(const struct inode *inode),
172 TP_ARGS(inode)
175 DEFINE_EVENT(btrfs__inode, btrfs_inode_evict,
177 TP_PROTO(const struct inode *inode),
179 TP_ARGS(inode)
182 #define __show_map_type(type) \
183 __print_symbolic_u64(type, \
184 { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \
185 { EXTENT_MAP_HOLE, "HOLE" }, \
186 { EXTENT_MAP_INLINE, "INLINE" }, \
187 { EXTENT_MAP_DELALLOC, "DELALLOC" })
189 #define show_map_type(type) \
190 type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type)
192 #define show_map_flags(flag) \
193 __print_flags(flag, "|", \
194 { (1 << EXTENT_FLAG_PINNED), "PINNED" },\
195 { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\
196 { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\
197 { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\
198 { (1 << EXTENT_FLAG_FILLING), "FILLING" },\
199 { (1 << EXTENT_FLAG_FS_MAPPING), "FS_MAPPING" })
201 TRACE_EVENT_CONDITION(btrfs_get_extent,
203 TP_PROTO(const struct btrfs_root *root, const struct btrfs_inode *inode,
204 const struct extent_map *map),
206 TP_ARGS(root, inode, map),
208 TP_CONDITION(map),
210 TP_STRUCT__entry_btrfs(
211 __field( u64, root_objectid )
212 __field( u64, ino )
213 __field( u64, start )
214 __field( u64, len )
215 __field( u64, orig_start )
216 __field( u64, block_start )
217 __field( u64, block_len )
218 __field( unsigned long, flags )
219 __field( int, refs )
220 __field( unsigned int, compress_type )
223 TP_fast_assign_btrfs(root->fs_info,
224 __entry->root_objectid = root->root_key.objectid;
225 __entry->ino = btrfs_ino(inode);
226 __entry->start = map->start;
227 __entry->len = map->len;
228 __entry->orig_start = map->orig_start;
229 __entry->block_start = map->block_start;
230 __entry->block_len = map->block_len;
231 __entry->flags = map->flags;
232 __entry->refs = refcount_read(&map->refs);
233 __entry->compress_type = map->compress_type;
236 TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu "
237 "orig_start=%llu block_start=%llu(%s) "
238 "block_len=%llu flags=%s refs=%u "
239 "compress_type=%u",
240 show_root_type(__entry->root_objectid),
241 (unsigned long long)__entry->ino,
242 (unsigned long long)__entry->start,
243 (unsigned long long)__entry->len,
244 (unsigned long long)__entry->orig_start,
245 show_map_type(__entry->block_start),
246 (unsigned long long)__entry->block_len,
247 show_map_flags(__entry->flags),
248 __entry->refs, __entry->compress_type)
251 /* file extent item */
252 DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular,
254 TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
255 struct btrfs_file_extent_item *fi, u64 start),
257 TP_ARGS(bi, l, fi, start),
259 TP_STRUCT__entry_btrfs(
260 __field( u64, root_obj )
261 __field( u64, ino )
262 __field( loff_t, isize )
263 __field( u64, disk_isize )
264 __field( u64, num_bytes )
265 __field( u64, ram_bytes )
266 __field( u64, disk_bytenr )
267 __field( u64, disk_num_bytes )
268 __field( u64, extent_offset )
269 __field( u8, extent_type )
270 __field( u8, compression )
271 __field( u64, extent_start )
272 __field( u64, extent_end )
275 TP_fast_assign_btrfs(bi->root->fs_info,
276 __entry->root_obj = bi->root->objectid;
277 __entry->ino = btrfs_ino(bi);
278 __entry->isize = bi->vfs_inode.i_size;
279 __entry->disk_isize = bi->disk_i_size;
280 __entry->num_bytes = btrfs_file_extent_num_bytes(l, fi);
281 __entry->ram_bytes = btrfs_file_extent_ram_bytes(l, fi);
282 __entry->disk_bytenr = btrfs_file_extent_disk_bytenr(l, fi);
283 __entry->disk_num_bytes = btrfs_file_extent_disk_num_bytes(l, fi);
284 __entry->extent_offset = btrfs_file_extent_offset(l, fi);
285 __entry->extent_type = btrfs_file_extent_type(l, fi);
286 __entry->compression = btrfs_file_extent_compression(l, fi);
287 __entry->extent_start = start;
288 __entry->extent_end = (start + __entry->num_bytes);
291 TP_printk_btrfs(
292 "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu "
293 "file extent range=[%llu %llu] "
294 "(num_bytes=%llu ram_bytes=%llu disk_bytenr=%llu "
295 "disk_num_bytes=%llu extent_offset=%llu type=%s "
296 "compression=%u",
297 show_root_type(__entry->root_obj), __entry->ino,
298 __entry->isize,
299 __entry->disk_isize, __entry->extent_start,
300 __entry->extent_end, __entry->num_bytes, __entry->ram_bytes,
301 __entry->disk_bytenr, __entry->disk_num_bytes,
302 __entry->extent_offset, show_fi_type(__entry->extent_type),
303 __entry->compression)
306 DECLARE_EVENT_CLASS(
307 btrfs__file_extent_item_inline,
309 TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
310 struct btrfs_file_extent_item *fi, int slot, u64 start),
312 TP_ARGS(bi, l, fi, slot, start),
314 TP_STRUCT__entry_btrfs(
315 __field( u64, root_obj )
316 __field( u64, ino )
317 __field( loff_t, isize )
318 __field( u64, disk_isize )
319 __field( u8, extent_type )
320 __field( u8, compression )
321 __field( u64, extent_start )
322 __field( u64, extent_end )
325 TP_fast_assign_btrfs(
326 bi->root->fs_info,
327 __entry->root_obj = bi->root->objectid;
328 __entry->ino = btrfs_ino(bi);
329 __entry->isize = bi->vfs_inode.i_size;
330 __entry->disk_isize = bi->disk_i_size;
331 __entry->extent_type = btrfs_file_extent_type(l, fi);
332 __entry->compression = btrfs_file_extent_compression(l, fi);
333 __entry->extent_start = start;
334 __entry->extent_end = (start + btrfs_file_extent_inline_len(l, slot, fi));
337 TP_printk_btrfs(
338 "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu "
339 "file extent range=[%llu %llu] "
340 "extent_type=%s compression=%u",
341 show_root_type(__entry->root_obj), __entry->ino, __entry->isize,
342 __entry->disk_isize, __entry->extent_start,
343 __entry->extent_end, show_fi_type(__entry->extent_type),
344 __entry->compression)
347 DEFINE_EVENT(
348 btrfs__file_extent_item_regular, btrfs_get_extent_show_fi_regular,
350 TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
351 struct btrfs_file_extent_item *fi, u64 start),
353 TP_ARGS(bi, l, fi, start)
356 DEFINE_EVENT(
357 btrfs__file_extent_item_regular, btrfs_truncate_show_fi_regular,
359 TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
360 struct btrfs_file_extent_item *fi, u64 start),
362 TP_ARGS(bi, l, fi, start)
365 DEFINE_EVENT(
366 btrfs__file_extent_item_inline, btrfs_get_extent_show_fi_inline,
368 TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
369 struct btrfs_file_extent_item *fi, int slot, u64 start),
371 TP_ARGS(bi, l, fi, slot, start)
374 DEFINE_EVENT(
375 btrfs__file_extent_item_inline, btrfs_truncate_show_fi_inline,
377 TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
378 struct btrfs_file_extent_item *fi, int slot, u64 start),
380 TP_ARGS(bi, l, fi, slot, start)
383 #define show_ordered_flags(flags) \
384 __print_flags(flags, "|", \
385 { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \
386 { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \
387 { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \
388 { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \
389 { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \
390 { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \
391 { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \
392 { (1 << BTRFS_ORDERED_UPDATED_ISIZE), "UPDATED_ISIZE" }, \
393 { (1 << BTRFS_ORDERED_LOGGED_CSUM), "LOGGED_CSUM" }, \
394 { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" })
397 DECLARE_EVENT_CLASS(btrfs__ordered_extent,
399 TP_PROTO(const struct inode *inode,
400 const struct btrfs_ordered_extent *ordered),
402 TP_ARGS(inode, ordered),
404 TP_STRUCT__entry_btrfs(
405 __field( ino_t, ino )
406 __field( u64, file_offset )
407 __field( u64, start )
408 __field( u64, len )
409 __field( u64, disk_len )
410 __field( u64, bytes_left )
411 __field( unsigned long, flags )
412 __field( int, compress_type )
413 __field( int, refs )
414 __field( u64, root_objectid )
415 __field( u64, truncated_len )
418 TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
419 __entry->ino = inode->i_ino;
420 __entry->file_offset = ordered->file_offset;
421 __entry->start = ordered->start;
422 __entry->len = ordered->len;
423 __entry->disk_len = ordered->disk_len;
424 __entry->bytes_left = ordered->bytes_left;
425 __entry->flags = ordered->flags;
426 __entry->compress_type = ordered->compress_type;
427 __entry->refs = refcount_read(&ordered->refs);
428 __entry->root_objectid =
429 BTRFS_I(inode)->root->root_key.objectid;
430 __entry->truncated_len = ordered->truncated_len;
433 TP_printk_btrfs("root=%llu(%s) ino=%llu file_offset=%llu "
434 "start=%llu len=%llu disk_len=%llu "
435 "truncated_len=%llu "
436 "bytes_left=%llu flags=%s compress_type=%d "
437 "refs=%d",
438 show_root_type(__entry->root_objectid),
439 (unsigned long long)__entry->ino,
440 (unsigned long long)__entry->file_offset,
441 (unsigned long long)__entry->start,
442 (unsigned long long)__entry->len,
443 (unsigned long long)__entry->disk_len,
444 (unsigned long long)__entry->truncated_len,
445 (unsigned long long)__entry->bytes_left,
446 show_ordered_flags(__entry->flags),
447 __entry->compress_type, __entry->refs)
450 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add,
452 TP_PROTO(const struct inode *inode,
453 const struct btrfs_ordered_extent *ordered),
455 TP_ARGS(inode, ordered)
458 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove,
460 TP_PROTO(const struct inode *inode,
461 const struct btrfs_ordered_extent *ordered),
463 TP_ARGS(inode, ordered)
466 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start,
468 TP_PROTO(const struct inode *inode,
469 const struct btrfs_ordered_extent *ordered),
471 TP_ARGS(inode, ordered)
474 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put,
476 TP_PROTO(const struct inode *inode,
477 const struct btrfs_ordered_extent *ordered),
479 TP_ARGS(inode, ordered)
482 DECLARE_EVENT_CLASS(btrfs__writepage,
484 TP_PROTO(const struct page *page, const struct inode *inode,
485 const struct writeback_control *wbc),
487 TP_ARGS(page, inode, wbc),
489 TP_STRUCT__entry_btrfs(
490 __field( ino_t, ino )
491 __field( pgoff_t, index )
492 __field( long, nr_to_write )
493 __field( long, pages_skipped )
494 __field( loff_t, range_start )
495 __field( loff_t, range_end )
496 __field( char, for_kupdate )
497 __field( char, for_reclaim )
498 __field( char, range_cyclic )
499 __field( pgoff_t, writeback_index )
500 __field( u64, root_objectid )
503 TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
504 __entry->ino = inode->i_ino;
505 __entry->index = page->index;
506 __entry->nr_to_write = wbc->nr_to_write;
507 __entry->pages_skipped = wbc->pages_skipped;
508 __entry->range_start = wbc->range_start;
509 __entry->range_end = wbc->range_end;
510 __entry->for_kupdate = wbc->for_kupdate;
511 __entry->for_reclaim = wbc->for_reclaim;
512 __entry->range_cyclic = wbc->range_cyclic;
513 __entry->writeback_index = inode->i_mapping->writeback_index;
514 __entry->root_objectid =
515 BTRFS_I(inode)->root->root_key.objectid;
518 TP_printk_btrfs("root=%llu(%s) ino=%lu page_index=%lu "
519 "nr_to_write=%ld pages_skipped=%ld range_start=%llu "
520 "range_end=%llu for_kupdate=%d "
521 "for_reclaim=%d range_cyclic=%d writeback_index=%lu",
522 show_root_type(__entry->root_objectid),
523 (unsigned long)__entry->ino, __entry->index,
524 __entry->nr_to_write, __entry->pages_skipped,
525 __entry->range_start, __entry->range_end,
526 __entry->for_kupdate,
527 __entry->for_reclaim, __entry->range_cyclic,
528 (unsigned long)__entry->writeback_index)
531 DEFINE_EVENT(btrfs__writepage, __extent_writepage,
533 TP_PROTO(const struct page *page, const struct inode *inode,
534 const struct writeback_control *wbc),
536 TP_ARGS(page, inode, wbc)
539 TRACE_EVENT(btrfs_writepage_end_io_hook,
541 TP_PROTO(const struct page *page, u64 start, u64 end, int uptodate),
543 TP_ARGS(page, start, end, uptodate),
545 TP_STRUCT__entry_btrfs(
546 __field( ino_t, ino )
547 __field( pgoff_t, index )
548 __field( u64, start )
549 __field( u64, end )
550 __field( int, uptodate )
551 __field( u64, root_objectid )
554 TP_fast_assign_btrfs(btrfs_sb(page->mapping->host->i_sb),
555 __entry->ino = page->mapping->host->i_ino;
556 __entry->index = page->index;
557 __entry->start = start;
558 __entry->end = end;
559 __entry->uptodate = uptodate;
560 __entry->root_objectid =
561 BTRFS_I(page->mapping->host)->root->root_key.objectid;
564 TP_printk_btrfs("root=%llu(%s) ino=%lu page_index=%lu start=%llu "
565 "end=%llu uptodate=%d",
566 show_root_type(__entry->root_objectid),
567 (unsigned long)__entry->ino, (unsigned long)__entry->index,
568 (unsigned long long)__entry->start,
569 (unsigned long long)__entry->end, __entry->uptodate)
572 TRACE_EVENT(btrfs_sync_file,
574 TP_PROTO(const struct file *file, int datasync),
576 TP_ARGS(file, datasync),
578 TP_STRUCT__entry_btrfs(
579 __field( ino_t, ino )
580 __field( ino_t, parent )
581 __field( int, datasync )
582 __field( u64, root_objectid )
585 TP_fast_assign(
586 const struct dentry *dentry = file->f_path.dentry;
587 const struct inode *inode = d_inode(dentry);
589 TP_fast_assign_fsid(btrfs_sb(file->f_path.dentry->d_sb));
590 __entry->ino = inode->i_ino;
591 __entry->parent = d_inode(dentry->d_parent)->i_ino;
592 __entry->datasync = datasync;
593 __entry->root_objectid =
594 BTRFS_I(inode)->root->root_key.objectid;
597 TP_printk_btrfs("root=%llu(%s) ino=%ld parent=%ld datasync=%d",
598 show_root_type(__entry->root_objectid),
599 (unsigned long)__entry->ino, (unsigned long)__entry->parent,
600 __entry->datasync)
603 TRACE_EVENT(btrfs_sync_fs,
605 TP_PROTO(const struct btrfs_fs_info *fs_info, int wait),
607 TP_ARGS(fs_info, wait),
609 TP_STRUCT__entry_btrfs(
610 __field( int, wait )
613 TP_fast_assign_btrfs(fs_info,
614 __entry->wait = wait;
617 TP_printk_btrfs("wait = %d", __entry->wait)
620 TRACE_EVENT(btrfs_add_block_group,
622 TP_PROTO(const struct btrfs_fs_info *fs_info,
623 const struct btrfs_block_group_cache *block_group, int create),
625 TP_ARGS(fs_info, block_group, create),
627 TP_STRUCT__entry(
628 __array( u8, fsid, BTRFS_FSID_SIZE )
629 __field( u64, offset )
630 __field( u64, size )
631 __field( u64, flags )
632 __field( u64, bytes_used )
633 __field( u64, bytes_super )
634 __field( int, create )
637 TP_fast_assign(
638 memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE);
639 __entry->offset = block_group->key.objectid;
640 __entry->size = block_group->key.offset;
641 __entry->flags = block_group->flags;
642 __entry->bytes_used =
643 btrfs_block_group_used(&block_group->item);
644 __entry->bytes_super = block_group->bytes_super;
645 __entry->create = create;
648 TP_printk("%pU: block_group offset=%llu size=%llu "
649 "flags=%llu(%s) bytes_used=%llu bytes_super=%llu "
650 "create=%d", __entry->fsid,
651 (unsigned long long)__entry->offset,
652 (unsigned long long)__entry->size,
653 (unsigned long long)__entry->flags,
654 __print_flags((unsigned long)__entry->flags, "|",
655 BTRFS_GROUP_FLAGS),
656 (unsigned long long)__entry->bytes_used,
657 (unsigned long long)__entry->bytes_super, __entry->create)
660 #define show_ref_action(action) \
661 __print_symbolic(action, \
662 { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \
663 { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \
664 { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \
665 { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
668 DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref,
670 TP_PROTO(const struct btrfs_fs_info *fs_info,
671 const struct btrfs_delayed_ref_node *ref,
672 const struct btrfs_delayed_tree_ref *full_ref,
673 int action),
675 TP_ARGS(fs_info, ref, full_ref, action),
677 TP_STRUCT__entry_btrfs(
678 __field( u64, bytenr )
679 __field( u64, num_bytes )
680 __field( int, action )
681 __field( u64, parent )
682 __field( u64, ref_root )
683 __field( int, level )
684 __field( int, type )
685 __field( u64, seq )
688 TP_fast_assign_btrfs(fs_info,
689 __entry->bytenr = ref->bytenr;
690 __entry->num_bytes = ref->num_bytes;
691 __entry->action = action;
692 __entry->parent = full_ref->parent;
693 __entry->ref_root = full_ref->root;
694 __entry->level = full_ref->level;
695 __entry->type = ref->type;
696 __entry->seq = ref->seq;
699 TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s "
700 "parent=%llu(%s) ref_root=%llu(%s) level=%d "
701 "type=%s seq=%llu",
702 (unsigned long long)__entry->bytenr,
703 (unsigned long long)__entry->num_bytes,
704 show_ref_action(__entry->action),
705 show_root_type(__entry->parent),
706 show_root_type(__entry->ref_root),
707 __entry->level, show_ref_type(__entry->type),
708 (unsigned long long)__entry->seq)
711 DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref,
713 TP_PROTO(const struct btrfs_fs_info *fs_info,
714 const struct btrfs_delayed_ref_node *ref,
715 const struct btrfs_delayed_tree_ref *full_ref,
716 int action),
718 TP_ARGS(fs_info, ref, full_ref, action)
721 DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref,
723 TP_PROTO(const struct btrfs_fs_info *fs_info,
724 const struct btrfs_delayed_ref_node *ref,
725 const struct btrfs_delayed_tree_ref *full_ref,
726 int action),
728 TP_ARGS(fs_info, ref, full_ref, action)
731 DECLARE_EVENT_CLASS(btrfs_delayed_data_ref,
733 TP_PROTO(const struct btrfs_fs_info *fs_info,
734 const struct btrfs_delayed_ref_node *ref,
735 const struct btrfs_delayed_data_ref *full_ref,
736 int action),
738 TP_ARGS(fs_info, ref, full_ref, action),
740 TP_STRUCT__entry_btrfs(
741 __field( u64, bytenr )
742 __field( u64, num_bytes )
743 __field( int, action )
744 __field( u64, parent )
745 __field( u64, ref_root )
746 __field( u64, owner )
747 __field( u64, offset )
748 __field( int, type )
749 __field( u64, seq )
752 TP_fast_assign_btrfs(fs_info,
753 __entry->bytenr = ref->bytenr;
754 __entry->num_bytes = ref->num_bytes;
755 __entry->action = action;
756 __entry->parent = full_ref->parent;
757 __entry->ref_root = full_ref->root;
758 __entry->owner = full_ref->objectid;
759 __entry->offset = full_ref->offset;
760 __entry->type = ref->type;
761 __entry->seq = ref->seq;
764 TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s "
765 "parent=%llu(%s) ref_root=%llu(%s) owner=%llu "
766 "offset=%llu type=%s seq=%llu",
767 (unsigned long long)__entry->bytenr,
768 (unsigned long long)__entry->num_bytes,
769 show_ref_action(__entry->action),
770 show_root_type(__entry->parent),
771 show_root_type(__entry->ref_root),
772 (unsigned long long)__entry->owner,
773 (unsigned long long)__entry->offset,
774 show_ref_type(__entry->type),
775 (unsigned long long)__entry->seq)
778 DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref,
780 TP_PROTO(const struct btrfs_fs_info *fs_info,
781 const struct btrfs_delayed_ref_node *ref,
782 const struct btrfs_delayed_data_ref *full_ref,
783 int action),
785 TP_ARGS(fs_info, ref, full_ref, action)
788 DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref,
790 TP_PROTO(const struct btrfs_fs_info *fs_info,
791 const struct btrfs_delayed_ref_node *ref,
792 const struct btrfs_delayed_data_ref *full_ref,
793 int action),
795 TP_ARGS(fs_info, ref, full_ref, action)
798 DECLARE_EVENT_CLASS(btrfs_delayed_ref_head,
800 TP_PROTO(const struct btrfs_fs_info *fs_info,
801 const struct btrfs_delayed_ref_head *head_ref,
802 int action),
804 TP_ARGS(fs_info, head_ref, action),
806 TP_STRUCT__entry_btrfs(
807 __field( u64, bytenr )
808 __field( u64, num_bytes )
809 __field( int, action )
810 __field( int, is_data )
813 TP_fast_assign_btrfs(fs_info,
814 __entry->bytenr = head_ref->bytenr;
815 __entry->num_bytes = head_ref->num_bytes;
816 __entry->action = action;
817 __entry->is_data = head_ref->is_data;
820 TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d",
821 (unsigned long long)__entry->bytenr,
822 (unsigned long long)__entry->num_bytes,
823 show_ref_action(__entry->action),
824 __entry->is_data)
827 DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head,
829 TP_PROTO(const struct btrfs_fs_info *fs_info,
830 const struct btrfs_delayed_ref_head *head_ref,
831 int action),
833 TP_ARGS(fs_info, head_ref, action)
836 DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head,
838 TP_PROTO(const struct btrfs_fs_info *fs_info,
839 const struct btrfs_delayed_ref_head *head_ref,
840 int action),
842 TP_ARGS(fs_info, head_ref, action)
845 #define show_chunk_type(type) \
846 __print_flags(type, "|", \
847 { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \
848 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
849 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
850 { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \
851 { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \
852 { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \
853 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
854 { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \
855 { BTRFS_BLOCK_GROUP_RAID6, "RAID6" })
857 DECLARE_EVENT_CLASS(btrfs__chunk,
859 TP_PROTO(const struct btrfs_fs_info *fs_info,
860 const struct map_lookup *map, u64 offset, u64 size),
862 TP_ARGS(fs_info, map, offset, size),
864 TP_STRUCT__entry_btrfs(
865 __field( int, num_stripes )
866 __field( u64, type )
867 __field( int, sub_stripes )
868 __field( u64, offset )
869 __field( u64, size )
870 __field( u64, root_objectid )
873 TP_fast_assign_btrfs(fs_info,
874 __entry->num_stripes = map->num_stripes;
875 __entry->type = map->type;
876 __entry->sub_stripes = map->sub_stripes;
877 __entry->offset = offset;
878 __entry->size = size;
879 __entry->root_objectid = fs_info->chunk_root->root_key.objectid;
882 TP_printk_btrfs("root=%llu(%s) offset=%llu size=%llu "
883 "num_stripes=%d sub_stripes=%d type=%s",
884 show_root_type(__entry->root_objectid),
885 (unsigned long long)__entry->offset,
886 (unsigned long long)__entry->size,
887 __entry->num_stripes, __entry->sub_stripes,
888 show_chunk_type(__entry->type))
891 DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc,
893 TP_PROTO(const struct btrfs_fs_info *fs_info,
894 const struct map_lookup *map, u64 offset, u64 size),
896 TP_ARGS(fs_info, map, offset, size)
899 DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free,
901 TP_PROTO(const struct btrfs_fs_info *fs_info,
902 const struct map_lookup *map, u64 offset, u64 size),
904 TP_ARGS(fs_info, map, offset, size)
907 TRACE_EVENT(btrfs_cow_block,
909 TP_PROTO(const struct btrfs_root *root, const struct extent_buffer *buf,
910 const struct extent_buffer *cow),
912 TP_ARGS(root, buf, cow),
914 TP_STRUCT__entry_btrfs(
915 __field( u64, root_objectid )
916 __field( u64, buf_start )
917 __field( int, refs )
918 __field( u64, cow_start )
919 __field( int, buf_level )
920 __field( int, cow_level )
923 TP_fast_assign_btrfs(root->fs_info,
924 __entry->root_objectid = root->root_key.objectid;
925 __entry->buf_start = buf->start;
926 __entry->refs = atomic_read(&buf->refs);
927 __entry->cow_start = cow->start;
928 __entry->buf_level = btrfs_header_level(buf);
929 __entry->cow_level = btrfs_header_level(cow);
932 TP_printk_btrfs("root=%llu(%s) refs=%d orig_buf=%llu "
933 "(orig_level=%d) cow_buf=%llu (cow_level=%d)",
934 show_root_type(__entry->root_objectid),
935 __entry->refs,
936 (unsigned long long)__entry->buf_start,
937 __entry->buf_level,
938 (unsigned long long)__entry->cow_start,
939 __entry->cow_level)
942 TRACE_EVENT(btrfs_space_reservation,
944 TP_PROTO(const struct btrfs_fs_info *fs_info, char *type, u64 val,
945 u64 bytes, int reserve),
947 TP_ARGS(fs_info, type, val, bytes, reserve),
949 TP_STRUCT__entry_btrfs(
950 __string( type, type )
951 __field( u64, val )
952 __field( u64, bytes )
953 __field( int, reserve )
956 TP_fast_assign_btrfs(fs_info,
957 __assign_str(type, type);
958 __entry->val = val;
959 __entry->bytes = bytes;
960 __entry->reserve = reserve;
963 TP_printk_btrfs("%s: %Lu %s %Lu", __get_str(type), __entry->val,
964 __entry->reserve ? "reserve" : "release",
965 __entry->bytes)
968 #define show_flush_action(action) \
969 __print_symbolic(action, \
970 { BTRFS_RESERVE_NO_FLUSH, "BTRFS_RESERVE_NO_FLUSH"}, \
971 { BTRFS_RESERVE_FLUSH_LIMIT, "BTRFS_RESERVE_FLUSH_LIMIT"}, \
972 { BTRFS_RESERVE_FLUSH_ALL, "BTRFS_RESERVE_FLUSH_ALL"})
974 TRACE_EVENT(btrfs_trigger_flush,
976 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes,
977 int flush, char *reason),
979 TP_ARGS(fs_info, flags, bytes, flush, reason),
981 TP_STRUCT__entry(
982 __array( u8, fsid, BTRFS_FSID_SIZE )
983 __field( u64, flags )
984 __field( u64, bytes )
985 __field( int, flush )
986 __string( reason, reason )
989 TP_fast_assign(
990 memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE);
991 __entry->flags = flags;
992 __entry->bytes = bytes;
993 __entry->flush = flush;
994 __assign_str(reason, reason)
997 TP_printk("%pU: %s: flush=%d(%s) flags=%llu(%s) bytes=%llu",
998 __entry->fsid, __get_str(reason), __entry->flush,
999 show_flush_action(__entry->flush),
1000 (unsigned long long)__entry->flags,
1001 __print_flags((unsigned long)__entry->flags, "|",
1002 BTRFS_GROUP_FLAGS),
1003 (unsigned long long)__entry->bytes)
1006 #define show_flush_state(state) \
1007 __print_symbolic(state, \
1008 { FLUSH_DELAYED_ITEMS_NR, "FLUSH_DELAYED_ITEMS_NR"}, \
1009 { FLUSH_DELAYED_ITEMS, "FLUSH_DELAYED_ITEMS"}, \
1010 { FLUSH_DELALLOC, "FLUSH_DELALLOC"}, \
1011 { FLUSH_DELALLOC_WAIT, "FLUSH_DELALLOC_WAIT"}, \
1012 { ALLOC_CHUNK, "ALLOC_CHUNK"}, \
1013 { COMMIT_TRANS, "COMMIT_TRANS"})
1015 TRACE_EVENT(btrfs_flush_space,
1017 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 num_bytes,
1018 int state, int ret),
1020 TP_ARGS(fs_info, flags, num_bytes, state, ret),
1022 TP_STRUCT__entry(
1023 __array( u8, fsid, BTRFS_FSID_SIZE )
1024 __field( u64, flags )
1025 __field( u64, num_bytes )
1026 __field( int, state )
1027 __field( int, ret )
1030 TP_fast_assign(
1031 memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE);
1032 __entry->flags = flags;
1033 __entry->num_bytes = num_bytes;
1034 __entry->state = state;
1035 __entry->ret = ret;
1038 TP_printk("%pU: state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d",
1039 __entry->fsid, __entry->state,
1040 show_flush_state(__entry->state),
1041 (unsigned long long)__entry->flags,
1042 __print_flags((unsigned long)__entry->flags, "|",
1043 BTRFS_GROUP_FLAGS),
1044 (unsigned long long)__entry->num_bytes, __entry->ret)
1047 DECLARE_EVENT_CLASS(btrfs__reserved_extent,
1049 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
1051 TP_ARGS(fs_info, start, len),
1053 TP_STRUCT__entry_btrfs(
1054 __field( u64, start )
1055 __field( u64, len )
1058 TP_fast_assign_btrfs(fs_info,
1059 __entry->start = start;
1060 __entry->len = len;
1063 TP_printk_btrfs("root=%llu(%s) start=%llu len=%llu",
1064 show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
1065 (unsigned long long)__entry->start,
1066 (unsigned long long)__entry->len)
1069 DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc,
1071 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
1073 TP_ARGS(fs_info, start, len)
1076 DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free,
1078 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
1080 TP_ARGS(fs_info, start, len)
1083 TRACE_EVENT(find_free_extent,
1085 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes,
1086 u64 empty_size, u64 data),
1088 TP_ARGS(fs_info, num_bytes, empty_size, data),
1090 TP_STRUCT__entry_btrfs(
1091 __field( u64, num_bytes )
1092 __field( u64, empty_size )
1093 __field( u64, data )
1096 TP_fast_assign_btrfs(fs_info,
1097 __entry->num_bytes = num_bytes;
1098 __entry->empty_size = empty_size;
1099 __entry->data = data;
1102 TP_printk_btrfs("root=%Lu(%s) len=%Lu empty_size=%Lu flags=%Lu(%s)",
1103 show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
1104 __entry->num_bytes, __entry->empty_size, __entry->data,
1105 __print_flags((unsigned long)__entry->data, "|",
1106 BTRFS_GROUP_FLAGS))
1109 DECLARE_EVENT_CLASS(btrfs__reserve_extent,
1111 TP_PROTO(const struct btrfs_fs_info *fs_info,
1112 const struct btrfs_block_group_cache *block_group, u64 start,
1113 u64 len),
1115 TP_ARGS(fs_info, block_group, start, len),
1117 TP_STRUCT__entry_btrfs(
1118 __field( u64, bg_objectid )
1119 __field( u64, flags )
1120 __field( u64, start )
1121 __field( u64, len )
1124 TP_fast_assign_btrfs(fs_info,
1125 __entry->bg_objectid = block_group->key.objectid;
1126 __entry->flags = block_group->flags;
1127 __entry->start = start;
1128 __entry->len = len;
1131 TP_printk_btrfs("root=%Lu(%s) block_group=%Lu flags=%Lu(%s) "
1132 "start=%Lu len=%Lu",
1133 show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
1134 __entry->bg_objectid,
1135 __entry->flags, __print_flags((unsigned long)__entry->flags,
1136 "|", BTRFS_GROUP_FLAGS),
1137 __entry->start, __entry->len)
1140 DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent,
1142 TP_PROTO(const struct btrfs_fs_info *fs_info,
1143 const struct btrfs_block_group_cache *block_group, u64 start,
1144 u64 len),
1146 TP_ARGS(fs_info, block_group, start, len)
1149 DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
1151 TP_PROTO(const struct btrfs_fs_info *fs_info,
1152 const struct btrfs_block_group_cache *block_group, u64 start,
1153 u64 len),
1155 TP_ARGS(fs_info, block_group, start, len)
1158 TRACE_EVENT(btrfs_find_cluster,
1160 TP_PROTO(const struct btrfs_block_group_cache *block_group, u64 start,
1161 u64 bytes, u64 empty_size, u64 min_bytes),
1163 TP_ARGS(block_group, start, bytes, empty_size, min_bytes),
1165 TP_STRUCT__entry_btrfs(
1166 __field( u64, bg_objectid )
1167 __field( u64, flags )
1168 __field( u64, start )
1169 __field( u64, bytes )
1170 __field( u64, empty_size )
1171 __field( u64, min_bytes )
1174 TP_fast_assign_btrfs(block_group->fs_info,
1175 __entry->bg_objectid = block_group->key.objectid;
1176 __entry->flags = block_group->flags;
1177 __entry->start = start;
1178 __entry->bytes = bytes;
1179 __entry->empty_size = empty_size;
1180 __entry->min_bytes = min_bytes;
1183 TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) start=%Lu len=%Lu "
1184 "empty_size=%Lu min_bytes=%Lu", __entry->bg_objectid,
1185 __entry->flags,
1186 __print_flags((unsigned long)__entry->flags, "|",
1187 BTRFS_GROUP_FLAGS), __entry->start,
1188 __entry->bytes, __entry->empty_size, __entry->min_bytes)
1191 TRACE_EVENT(btrfs_failed_cluster_setup,
1193 TP_PROTO(const struct btrfs_block_group_cache *block_group),
1195 TP_ARGS(block_group),
1197 TP_STRUCT__entry_btrfs(
1198 __field( u64, bg_objectid )
1201 TP_fast_assign_btrfs(block_group->fs_info,
1202 __entry->bg_objectid = block_group->key.objectid;
1205 TP_printk_btrfs("block_group=%Lu", __entry->bg_objectid)
1208 TRACE_EVENT(btrfs_setup_cluster,
1210 TP_PROTO(const struct btrfs_block_group_cache *block_group,
1211 const struct btrfs_free_cluster *cluster,
1212 u64 size, int bitmap),
1214 TP_ARGS(block_group, cluster, size, bitmap),
1216 TP_STRUCT__entry_btrfs(
1217 __field( u64, bg_objectid )
1218 __field( u64, flags )
1219 __field( u64, start )
1220 __field( u64, max_size )
1221 __field( u64, size )
1222 __field( int, bitmap )
1225 TP_fast_assign_btrfs(block_group->fs_info,
1226 __entry->bg_objectid = block_group->key.objectid;
1227 __entry->flags = block_group->flags;
1228 __entry->start = cluster->window_start;
1229 __entry->max_size = cluster->max_size;
1230 __entry->size = size;
1231 __entry->bitmap = bitmap;
1234 TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) window_start=%Lu "
1235 "size=%Lu max_size=%Lu bitmap=%d",
1236 __entry->bg_objectid,
1237 __entry->flags,
1238 __print_flags((unsigned long)__entry->flags, "|",
1239 BTRFS_GROUP_FLAGS), __entry->start,
1240 __entry->size, __entry->max_size, __entry->bitmap)
1243 struct extent_state;
1244 TRACE_EVENT(alloc_extent_state,
1246 TP_PROTO(const struct extent_state *state,
1247 gfp_t mask, unsigned long IP),
1249 TP_ARGS(state, mask, IP),
1251 TP_STRUCT__entry(
1252 __field(const struct extent_state *, state)
1253 __field(gfp_t, mask)
1254 __field(unsigned long, ip)
1257 TP_fast_assign(
1258 __entry->state = state,
1259 __entry->mask = mask,
1260 __entry->ip = IP
1263 TP_printk("state=%p mask=%s caller=%pS", __entry->state,
1264 show_gfp_flags(__entry->mask), (const void *)__entry->ip)
1267 TRACE_EVENT(free_extent_state,
1269 TP_PROTO(const struct extent_state *state, unsigned long IP),
1271 TP_ARGS(state, IP),
1273 TP_STRUCT__entry(
1274 __field(const struct extent_state *, state)
1275 __field(unsigned long, ip)
1278 TP_fast_assign(
1279 __entry->state = state,
1280 __entry->ip = IP
1283 TP_printk("state=%p caller=%pS", __entry->state,
1284 (const void *)__entry->ip)
1287 DECLARE_EVENT_CLASS(btrfs__work,
1289 TP_PROTO(const struct btrfs_work *work),
1291 TP_ARGS(work),
1293 TP_STRUCT__entry_btrfs(
1294 __field( const void *, work )
1295 __field( const void *, wq )
1296 __field( const void *, func )
1297 __field( const void *, ordered_func )
1298 __field( const void *, ordered_free )
1299 __field( const void *, normal_work )
1302 TP_fast_assign_btrfs(btrfs_work_owner(work),
1303 __entry->work = work;
1304 __entry->wq = work->wq;
1305 __entry->func = work->func;
1306 __entry->ordered_func = work->ordered_func;
1307 __entry->ordered_free = work->ordered_free;
1308 __entry->normal_work = &work->normal_work;
1311 TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%pf ordered_func=%p "
1312 "ordered_free=%p",
1313 __entry->work, __entry->normal_work, __entry->wq,
1314 __entry->func, __entry->ordered_func, __entry->ordered_free)
1318 * For situiations when the work is freed, we pass fs_info and a tag that that
1319 * matches address of the work structure so it can be paired with the
1320 * scheduling event.
1322 DECLARE_EVENT_CLASS(btrfs__work__done,
1324 TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag),
1326 TP_ARGS(fs_info, wtag),
1328 TP_STRUCT__entry_btrfs(
1329 __field( const void *, wtag )
1332 TP_fast_assign_btrfs(fs_info,
1333 __entry->wtag = wtag;
1336 TP_printk_btrfs("work->%p", __entry->wtag)
1339 DEFINE_EVENT(btrfs__work, btrfs_work_queued,
1341 TP_PROTO(const struct btrfs_work *work),
1343 TP_ARGS(work)
1346 DEFINE_EVENT(btrfs__work, btrfs_work_sched,
1348 TP_PROTO(const struct btrfs_work *work),
1350 TP_ARGS(work)
1353 DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done,
1355 TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag),
1357 TP_ARGS(fs_info, wtag)
1360 DEFINE_EVENT(btrfs__work, btrfs_ordered_sched,
1362 TP_PROTO(const struct btrfs_work *work),
1364 TP_ARGS(work)
1367 DECLARE_EVENT_CLASS(btrfs__workqueue,
1369 TP_PROTO(const struct __btrfs_workqueue *wq,
1370 const char *name, int high),
1372 TP_ARGS(wq, name, high),
1374 TP_STRUCT__entry_btrfs(
1375 __field( const void *, wq )
1376 __string( name, name )
1377 __field( int , high )
1380 TP_fast_assign_btrfs(btrfs_workqueue_owner(wq),
1381 __entry->wq = wq;
1382 __assign_str(name, name);
1383 __entry->high = high;
1386 TP_printk_btrfs("name=%s%s wq=%p", __get_str(name),
1387 __print_flags(__entry->high, "",
1388 {(WQ_HIGHPRI), "-high"}),
1389 __entry->wq)
1392 DEFINE_EVENT(btrfs__workqueue, btrfs_workqueue_alloc,
1394 TP_PROTO(const struct __btrfs_workqueue *wq,
1395 const char *name, int high),
1397 TP_ARGS(wq, name, high)
1400 DECLARE_EVENT_CLASS(btrfs__workqueue_done,
1402 TP_PROTO(const struct __btrfs_workqueue *wq),
1404 TP_ARGS(wq),
1406 TP_STRUCT__entry_btrfs(
1407 __field( const void *, wq )
1410 TP_fast_assign_btrfs(btrfs_workqueue_owner(wq),
1411 __entry->wq = wq;
1414 TP_printk_btrfs("wq=%p", __entry->wq)
1417 DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy,
1419 TP_PROTO(const struct __btrfs_workqueue *wq),
1421 TP_ARGS(wq)
1424 #define BTRFS_QGROUP_OPERATIONS \
1425 { QGROUP_RESERVE, "reserve" }, \
1426 { QGROUP_RELEASE, "release" }, \
1427 { QGROUP_FREE, "free" }
1429 DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data,
1431 TP_PROTO(const struct inode *inode, u64 start, u64 len,
1432 u64 reserved, int op),
1434 TP_ARGS(inode, start, len, reserved, op),
1436 TP_STRUCT__entry_btrfs(
1437 __field( u64, rootid )
1438 __field( unsigned long, ino )
1439 __field( u64, start )
1440 __field( u64, len )
1441 __field( u64, reserved )
1442 __field( int, op )
1445 TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
1446 __entry->rootid = BTRFS_I(inode)->root->objectid;
1447 __entry->ino = inode->i_ino;
1448 __entry->start = start;
1449 __entry->len = len;
1450 __entry->reserved = reserved;
1451 __entry->op = op;
1454 TP_printk_btrfs("root=%llu ino=%lu start=%llu len=%llu reserved=%llu op=%s",
1455 __entry->rootid, __entry->ino, __entry->start, __entry->len,
1456 __entry->reserved,
1457 __print_flags((unsigned long)__entry->op, "",
1458 BTRFS_QGROUP_OPERATIONS)
1462 DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_reserve_data,
1464 TP_PROTO(const struct inode *inode, u64 start, u64 len,
1465 u64 reserved, int op),
1467 TP_ARGS(inode, start, len, reserved, op)
1470 DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_release_data,
1472 TP_PROTO(const struct inode *inode, u64 start, u64 len,
1473 u64 reserved, int op),
1475 TP_ARGS(inode, start, len, reserved, op)
1478 DECLARE_EVENT_CLASS(btrfs__qgroup_delayed_ref,
1480 TP_PROTO(const struct btrfs_fs_info *fs_info,
1481 u64 ref_root, u64 reserved),
1483 TP_ARGS(fs_info, ref_root, reserved),
1485 TP_STRUCT__entry_btrfs(
1486 __field( u64, ref_root )
1487 __field( u64, reserved )
1490 TP_fast_assign_btrfs(fs_info,
1491 __entry->ref_root = ref_root;
1492 __entry->reserved = reserved;
1495 TP_printk_btrfs("root=%llu reserved=%llu op=free",
1496 __entry->ref_root, __entry->reserved)
1499 DEFINE_EVENT(btrfs__qgroup_delayed_ref, btrfs_qgroup_free_delayed_ref,
1501 TP_PROTO(const struct btrfs_fs_info *fs_info,
1502 u64 ref_root, u64 reserved),
1504 TP_ARGS(fs_info, ref_root, reserved)
1507 DECLARE_EVENT_CLASS(btrfs_qgroup_extent,
1508 TP_PROTO(const struct btrfs_fs_info *fs_info,
1509 const struct btrfs_qgroup_extent_record *rec),
1511 TP_ARGS(fs_info, rec),
1513 TP_STRUCT__entry_btrfs(
1514 __field( u64, bytenr )
1515 __field( u64, num_bytes )
1518 TP_fast_assign_btrfs(fs_info,
1519 __entry->bytenr = rec->bytenr,
1520 __entry->num_bytes = rec->num_bytes;
1523 TP_printk_btrfs("bytenr=%llu num_bytes=%llu",
1524 (unsigned long long)__entry->bytenr,
1525 (unsigned long long)__entry->num_bytes)
1528 DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents,
1530 TP_PROTO(const struct btrfs_fs_info *fs_info,
1531 const struct btrfs_qgroup_extent_record *rec),
1533 TP_ARGS(fs_info, rec)
1536 DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_trace_extent,
1538 TP_PROTO(const struct btrfs_fs_info *fs_info,
1539 const struct btrfs_qgroup_extent_record *rec),
1541 TP_ARGS(fs_info, rec)
1544 TRACE_EVENT(btrfs_qgroup_account_extent,
1546 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 bytenr,
1547 u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots),
1549 TP_ARGS(fs_info, bytenr, num_bytes, nr_old_roots, nr_new_roots),
1551 TP_STRUCT__entry_btrfs(
1552 __field( u64, bytenr )
1553 __field( u64, num_bytes )
1554 __field( u64, nr_old_roots )
1555 __field( u64, nr_new_roots )
1558 TP_fast_assign_btrfs(fs_info,
1559 __entry->bytenr = bytenr;
1560 __entry->num_bytes = num_bytes;
1561 __entry->nr_old_roots = nr_old_roots;
1562 __entry->nr_new_roots = nr_new_roots;
1565 TP_printk_btrfs("bytenr=%llu num_bytes=%llu nr_old_roots=%llu "
1566 "nr_new_roots=%llu",
1567 __entry->bytenr,
1568 __entry->num_bytes,
1569 __entry->nr_old_roots,
1570 __entry->nr_new_roots)
1573 TRACE_EVENT(qgroup_update_counters,
1575 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 qgid,
1576 u64 cur_old_count, u64 cur_new_count),
1578 TP_ARGS(fs_info, qgid, cur_old_count, cur_new_count),
1580 TP_STRUCT__entry_btrfs(
1581 __field( u64, qgid )
1582 __field( u64, cur_old_count )
1583 __field( u64, cur_new_count )
1586 TP_fast_assign_btrfs(fs_info,
1587 __entry->qgid = qgid;
1588 __entry->cur_old_count = cur_old_count;
1589 __entry->cur_new_count = cur_new_count;
1592 TP_printk_btrfs("qgid=%llu cur_old_count=%llu cur_new_count=%llu",
1593 __entry->qgid,
1594 __entry->cur_old_count,
1595 __entry->cur_new_count)
1598 TRACE_EVENT(qgroup_update_reserve,
1600 TP_PROTO(struct btrfs_fs_info *fs_info, struct btrfs_qgroup *qgroup,
1601 s64 diff),
1603 TP_ARGS(fs_info, qgroup, diff),
1605 TP_STRUCT__entry_btrfs(
1606 __field( u64, qgid )
1607 __field( u64, cur_reserved )
1608 __field( s64, diff )
1611 TP_fast_assign_btrfs(fs_info,
1612 __entry->qgid = qgroup->qgroupid;
1613 __entry->cur_reserved = qgroup->reserved;
1614 __entry->diff = diff;
1617 TP_printk_btrfs("qgid=%llu cur_reserved=%llu diff=%lld",
1618 __entry->qgid, __entry->cur_reserved, __entry->diff)
1621 TRACE_EVENT(qgroup_meta_reserve,
1623 TP_PROTO(struct btrfs_root *root, s64 diff),
1625 TP_ARGS(root, diff),
1627 TP_STRUCT__entry_btrfs(
1628 __field( u64, refroot )
1629 __field( s64, diff )
1632 TP_fast_assign_btrfs(root->fs_info,
1633 __entry->refroot = root->objectid;
1634 __entry->diff = diff;
1637 TP_printk_btrfs("refroot=%llu(%s) diff=%lld",
1638 show_root_type(__entry->refroot), __entry->diff)
1641 DECLARE_EVENT_CLASS(btrfs__prelim_ref,
1642 TP_PROTO(const struct btrfs_fs_info *fs_info,
1643 const struct prelim_ref *oldref,
1644 const struct prelim_ref *newref, u64 tree_size),
1645 TP_ARGS(fs_info, newref, oldref, tree_size),
1647 TP_STRUCT__entry_btrfs(
1648 __field( u64, root_id )
1649 __field( u64, objectid )
1650 __field( u8, type )
1651 __field( u64, offset )
1652 __field( int, level )
1653 __field( int, old_count )
1654 __field( u64, parent )
1655 __field( u64, bytenr )
1656 __field( int, mod_count )
1657 __field( u64, tree_size )
1660 TP_fast_assign_btrfs(fs_info,
1661 __entry->root_id = oldref->root_id;
1662 __entry->objectid = oldref->key_for_search.objectid;
1663 __entry->type = oldref->key_for_search.type;
1664 __entry->offset = oldref->key_for_search.offset;
1665 __entry->level = oldref->level;
1666 __entry->old_count = oldref->count;
1667 __entry->parent = oldref->parent;
1668 __entry->bytenr = oldref->wanted_disk_byte;
1669 __entry->mod_count = newref ? newref->count : 0;
1670 __entry->tree_size = tree_size;
1673 TP_printk_btrfs("root_id=%llu key=[%llu,%u,%llu] level=%d count=[%d+%d=%d] parent=%llu wanted_disk_byte=%llu nodes=%llu",
1674 (unsigned long long)__entry->root_id,
1675 (unsigned long long)__entry->objectid, __entry->type,
1676 (unsigned long long)__entry->offset, __entry->level,
1677 __entry->old_count, __entry->mod_count,
1678 __entry->old_count + __entry->mod_count,
1679 (unsigned long long)__entry->parent,
1680 (unsigned long long)__entry->bytenr,
1681 (unsigned long long)__entry->tree_size)
1684 DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_merge,
1685 TP_PROTO(const struct btrfs_fs_info *fs_info,
1686 const struct prelim_ref *oldref,
1687 const struct prelim_ref *newref, u64 tree_size),
1688 TP_ARGS(fs_info, oldref, newref, tree_size)
1691 DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_insert,
1692 TP_PROTO(const struct btrfs_fs_info *fs_info,
1693 const struct prelim_ref *oldref,
1694 const struct prelim_ref *newref, u64 tree_size),
1695 TP_ARGS(fs_info, oldref, newref, tree_size)
1698 TRACE_EVENT(btrfs_inode_mod_outstanding_extents,
1699 TP_PROTO(struct btrfs_root *root, u64 ino, int mod),
1701 TP_ARGS(root, ino, mod),
1703 TP_STRUCT__entry_btrfs(
1704 __field( u64, root_objectid )
1705 __field( u64, ino )
1706 __field( int, mod )
1709 TP_fast_assign_btrfs(root->fs_info,
1710 __entry->root_objectid = root->objectid;
1711 __entry->ino = ino;
1712 __entry->mod = mod;
1715 TP_printk_btrfs("root=%llu(%s) ino=%llu mod=%d",
1716 show_root_type(__entry->root_objectid),
1717 (unsigned long long)__entry->ino, __entry->mod)
1719 #endif /* _TRACE_BTRFS_H */
1721 /* This part must be outside protection */
1722 #include <trace/define_trace.h>