Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
btrfs.h
Go to the documentation of this file.
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM btrfs
3 
4 #if !defined(_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_BTRFS_H
6 
7 #include <linux/writeback.h>
8 #include <linux/tracepoint.h>
10 
11 struct btrfs_root;
12 struct btrfs_fs_info;
13 struct btrfs_inode;
14 struct extent_map;
21 struct btrfs_free_cluster;
22 struct map_lookup;
23 struct extent_buffer;
24 
25 #define show_ref_type(type) \
26  __print_symbolic(type, \
27  { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \
28  { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \
29  { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \
30  { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \
31  { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" })
32 
33 #define __show_root_type(obj) \
34  __print_symbolic_u64(obj, \
35  { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \
36  { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \
37  { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \
38  { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \
39  { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \
40  { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \
41  { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \
42  { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \
43  { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \
44  { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
45 
46 #define show_root_type(obj) \
47  obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
48  (obj <= BTRFS_CSUM_TREE_OBJECTID )) ? __show_root_type(obj) : "-"
49 
50 #define BTRFS_GROUP_FLAGS \
51  { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \
52  { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
53  { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
54  { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \
55  { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \
56  { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \
57  { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}
58 
59 #define BTRFS_UUID_SIZE 16
60 
61 TRACE_EVENT(btrfs_transaction_commit,
62 
63  TP_PROTO(struct btrfs_root *root),
64 
65  TP_ARGS(root),
66 
70  ),
71 
73  __entry->generation = root->fs_info->generation;
74  __entry->root_objectid = root->root_key.objectid;
75  ),
76 
77  TP_printk("root = %llu(%s), gen = %llu",
78  show_root_type(__entry->root_objectid),
79  (unsigned long long)__entry->generation)
80 );
81 
82 DECLARE_EVENT_CLASS(btrfs__inode,
83 
84  TP_PROTO(struct inode *inode),
85 
86  TP_ARGS(inode),
87 
89  __field( ino_t, ino )
90  __field( blkcnt_t, blocks )
91  __field( u64, disk_i_size )
93  __field( u64, last_trans )
94  __field( u64, logged_trans )
96  ),
97 
99  __entry->ino = inode->i_ino;
100  __entry->blocks = inode->i_blocks;
101  __entry->disk_i_size = BTRFS_I(inode)->disk_i_size;
102  __entry->generation = BTRFS_I(inode)->generation;
103  __entry->last_trans = BTRFS_I(inode)->last_trans;
104  __entry->logged_trans = BTRFS_I(inode)->logged_trans;
105  __entry->root_objectid =
106  BTRFS_I(inode)->root->root_key.objectid;
107  ),
108 
109  TP_printk("root = %llu(%s), gen = %llu, ino = %lu, blocks = %llu, "
110  "disk_i_size = %llu, last_trans = %llu, logged_trans = %llu",
111  show_root_type(__entry->root_objectid),
112  (unsigned long long)__entry->generation,
113  (unsigned long)__entry->ino,
114  (unsigned long long)__entry->blocks,
115  (unsigned long long)__entry->disk_i_size,
116  (unsigned long long)__entry->last_trans,
117  (unsigned long long)__entry->logged_trans)
118 );
119 
120 DEFINE_EVENT(btrfs__inode, btrfs_inode_new,
121 
122  TP_PROTO(struct inode *inode),
123 
124  TP_ARGS(inode)
125 );
126 
127 DEFINE_EVENT(btrfs__inode, btrfs_inode_request,
128 
129  TP_PROTO(struct inode *inode),
130 
131  TP_ARGS(inode)
132 );
133 
134 DEFINE_EVENT(btrfs__inode, btrfs_inode_evict,
135 
136  TP_PROTO(struct inode *inode),
137 
138  TP_ARGS(inode)
139 );
140 
141 #define __show_map_type(type) \
142  __print_symbolic_u64(type, \
143  { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \
144  { EXTENT_MAP_HOLE, "HOLE" }, \
145  { EXTENT_MAP_INLINE, "INLINE" }, \
146  { EXTENT_MAP_DELALLOC, "DELALLOC" })
147 
148 #define show_map_type(type) \
149  type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type)
150 
151 #define show_map_flags(flag) \
152  __print_flags(flag, "|", \
153  { EXTENT_FLAG_PINNED, "PINNED" }, \
154  { EXTENT_FLAG_COMPRESSED, "COMPRESSED" }, \
155  { EXTENT_FLAG_VACANCY, "VACANCY" }, \
156  { EXTENT_FLAG_PREALLOC, "PREALLOC" })
157 
159 
160  TP_PROTO(struct btrfs_root *root, struct extent_map *map),
161 
162  TP_ARGS(root, map),
163 
166  __field( u64, start )
167  __field( u64, len )
168  __field( u64, orig_start )
169  __field( u64, block_start )
170  __field( u64, block_len )
171  __field( unsigned long, flags )
172  __field( int, refs )
173  __field( unsigned int, compress_type )
174  ),
175 
177  __entry->root_objectid = root->root_key.objectid;
178  __entry->start = map->start;
179  __entry->len = map->len;
180  __entry->orig_start = map->orig_start;
181  __entry->block_start = map->block_start;
182  __entry->block_len = map->block_len;
183  __entry->flags = map->flags;
184  __entry->refs = atomic_read(&map->refs);
185  __entry->compress_type = map->compress_type;
186  ),
187 
188  TP_printk("root = %llu(%s), start = %llu, len = %llu, "
189  "orig_start = %llu, block_start = %llu(%s), "
190  "block_len = %llu, flags = %s, refs = %u, "
191  "compress_type = %u",
192  show_root_type(__entry->root_objectid),
193  (unsigned long long)__entry->start,
194  (unsigned long long)__entry->len,
195  (unsigned long long)__entry->orig_start,
196  show_map_type(__entry->block_start),
197  (unsigned long long)__entry->block_len,
198  show_map_flags(__entry->flags),
199  __entry->refs, __entry->compress_type)
200 );
201 
202 #define show_ordered_flags(flags) \
203  __print_symbolic(flags, \
204  { BTRFS_ORDERED_IO_DONE, "IO_DONE" }, \
205  { BTRFS_ORDERED_COMPLETE, "COMPLETE" }, \
206  { BTRFS_ORDERED_NOCOW, "NOCOW" }, \
207  { BTRFS_ORDERED_COMPRESSED, "COMPRESSED" }, \
208  { BTRFS_ORDERED_PREALLOC, "PREALLOC" }, \
209  { BTRFS_ORDERED_DIRECT, "DIRECT" })
210 
211 DECLARE_EVENT_CLASS(btrfs__ordered_extent,
212 
213  TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
214 
215  TP_ARGS(inode, ordered),
216 
218  __field( ino_t, ino )
220  __field( u64, start )
221  __field( u64, len )
222  __field( u64, disk_len )
223  __field( u64, bytes_left )
224  __field( unsigned long, flags )
225  __field( int, compress_type )
226  __field( int, refs )
228  ),
229 
231  __entry->ino = inode->i_ino;
232  __entry->file_offset = ordered->file_offset;
233  __entry->start = ordered->start;
234  __entry->len = ordered->len;
235  __entry->disk_len = ordered->disk_len;
236  __entry->bytes_left = ordered->bytes_left;
237  __entry->flags = ordered->flags;
238  __entry->compress_type = ordered->compress_type;
239  __entry->refs = atomic_read(&ordered->refs);
240  __entry->root_objectid =
241  BTRFS_I(inode)->root->root_key.objectid;
242  ),
243 
244  TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, "
245  "start = %llu, len = %llu, disk_len = %llu, "
246  "bytes_left = %llu, flags = %s, compress_type = %d, "
247  "refs = %d",
248  show_root_type(__entry->root_objectid),
249  (unsigned long long)__entry->ino,
250  (unsigned long long)__entry->file_offset,
251  (unsigned long long)__entry->start,
252  (unsigned long long)__entry->len,
253  (unsigned long long)__entry->disk_len,
254  (unsigned long long)__entry->bytes_left,
255  show_ordered_flags(__entry->flags),
256  __entry->compress_type, __entry->refs)
257 );
258 
259 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add,
260 
261  TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
262 
263  TP_ARGS(inode, ordered)
264 );
265 
266 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove,
267 
268  TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
269 
270  TP_ARGS(inode, ordered)
271 );
272 
273 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start,
274 
275  TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
276 
277  TP_ARGS(inode, ordered)
278 );
279 
280 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put,
281 
282  TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
283 
284  TP_ARGS(inode, ordered)
285 );
286 
287 DECLARE_EVENT_CLASS(btrfs__writepage,
288 
289  TP_PROTO(struct page *page, struct inode *inode,
290  struct writeback_control *wbc),
291 
292  TP_ARGS(page, inode, wbc),
293 
295  __field( ino_t, ino )
296  __field( pgoff_t, index )
297  __field( long, nr_to_write )
298  __field( long, pages_skipped )
299  __field( loff_t, range_start )
300  __field( loff_t, range_end )
301  __field( char, for_kupdate )
302  __field( char, for_reclaim )
303  __field( char, range_cyclic )
306  ),
307 
309  __entry->ino = inode->i_ino;
310  __entry->index = page->index;
311  __entry->nr_to_write = wbc->nr_to_write;
312  __entry->pages_skipped = wbc->pages_skipped;
313  __entry->range_start = wbc->range_start;
314  __entry->range_end = wbc->range_end;
315  __entry->for_kupdate = wbc->for_kupdate;
316  __entry->for_reclaim = wbc->for_reclaim;
317  __entry->range_cyclic = wbc->range_cyclic;
318  __entry->writeback_index = inode->i_mapping->writeback_index;
319  __entry->root_objectid =
320  BTRFS_I(inode)->root->root_key.objectid;
321  ),
322 
323  TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, "
324  "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, "
325  "range_end = %llu, for_kupdate = %d, "
326  "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu",
327  show_root_type(__entry->root_objectid),
328  (unsigned long)__entry->ino, __entry->index,
329  __entry->nr_to_write, __entry->pages_skipped,
330  __entry->range_start, __entry->range_end,
331  __entry->for_kupdate,
332  __entry->for_reclaim, __entry->range_cyclic,
333  (unsigned long)__entry->writeback_index)
334 );
335 
336 DEFINE_EVENT(btrfs__writepage, __extent_writepage,
337 
338  TP_PROTO(struct page *page, struct inode *inode,
339  struct writeback_control *wbc),
340 
341  TP_ARGS(page, inode, wbc)
342 );
343 
344 TRACE_EVENT(btrfs_writepage_end_io_hook,
345 
346  TP_PROTO(struct page *page, u64 start, u64 end, int uptodate),
347 
348  TP_ARGS(page, start, end, uptodate),
349 
351  __field( ino_t, ino )
352  __field( pgoff_t, index )
353  __field( u64, start )
354  __field( u64, end )
355  __field( int, uptodate )
357  ),
358 
360  __entry->ino = page->mapping->host->i_ino;
361  __entry->index = page->index;
362  __entry->start = start;
363  __entry->end = end;
364  __entry->uptodate = uptodate;
365  __entry->root_objectid =
366  BTRFS_I(page->mapping->host)->root->root_key.objectid;
367  ),
368 
369  TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, "
370  "end = %llu, uptodate = %d",
371  show_root_type(__entry->root_objectid),
372  (unsigned long)__entry->ino, (unsigned long)__entry->index,
373  (unsigned long long)__entry->start,
374  (unsigned long long)__entry->end, __entry->uptodate)
375 );
376 
378 
379  TP_PROTO(struct file *file, int datasync),
380 
381  TP_ARGS(file, datasync),
382 
384  __field( ino_t, ino )
385  __field( ino_t, parent )
386  __field( int, datasync )
388  ),
389 
391  struct dentry *dentry = file->f_path.dentry;
392  struct inode *inode = dentry->d_inode;
393 
394  __entry->ino = inode->i_ino;
395  __entry->parent = dentry->d_parent->d_inode->i_ino;
396  __entry->datasync = datasync;
397  __entry->root_objectid =
398  BTRFS_I(inode)->root->root_key.objectid;
399  ),
400 
401  TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d",
402  show_root_type(__entry->root_objectid),
403  (unsigned long)__entry->ino, (unsigned long)__entry->parent,
404  __entry->datasync)
405 );
406 
408 
409  TP_PROTO(int wait),
410 
411  TP_ARGS(wait),
412 
414  __field( int, wait )
415  ),
416 
418  __entry->wait = wait;
419  ),
420 
421  TP_printk("wait = %d", __entry->wait)
422 );
423 
424 #define show_ref_action(action) \
425  __print_symbolic(action, \
426  { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \
427  { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \
428  { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \
429  { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
430 
431 
433 
434  TP_PROTO(struct btrfs_delayed_ref_node *ref,
435  struct btrfs_delayed_tree_ref *full_ref,
436  int action),
437 
438  TP_ARGS(ref, full_ref, action),
439 
441  __field( u64, bytenr )
442  __field( u64, num_bytes )
443  __field( int, action )
444  __field( u64, parent )
445  __field( u64, ref_root )
446  __field( int, level )
447  __field( int, type )
448  __field( u64, seq )
449  ),
450 
452  __entry->bytenr = ref->bytenr;
453  __entry->num_bytes = ref->num_bytes;
454  __entry->action = action;
455  __entry->parent = full_ref->parent;
456  __entry->ref_root = full_ref->root;
457  __entry->level = full_ref->level;
458  __entry->type = ref->type;
459  __entry->seq = ref->seq;
460  ),
461 
462  TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
463  "parent = %llu(%s), ref_root = %llu(%s), level = %d, "
464  "type = %s, seq = %llu",
465  (unsigned long long)__entry->bytenr,
466  (unsigned long long)__entry->num_bytes,
467  show_ref_action(__entry->action),
468  show_root_type(__entry->parent),
469  show_root_type(__entry->ref_root),
470  __entry->level, show_ref_type(__entry->type),
471  (unsigned long long)__entry->seq)
472 );
473 
475 
476  TP_PROTO(struct btrfs_delayed_ref_node *ref,
477  struct btrfs_delayed_data_ref *full_ref,
478  int action),
479 
480  TP_ARGS(ref, full_ref, action),
481 
483  __field( u64, bytenr )
484  __field( u64, num_bytes )
485  __field( int, action )
486  __field( u64, parent )
487  __field( u64, ref_root )
488  __field( u64, owner )
489  __field( u64, offset )
490  __field( int, type )
491  __field( u64, seq )
492  ),
493 
495  __entry->bytenr = ref->bytenr;
496  __entry->num_bytes = ref->num_bytes;
497  __entry->action = action;
498  __entry->parent = full_ref->parent;
499  __entry->ref_root = full_ref->root;
500  __entry->owner = full_ref->objectid;
501  __entry->offset = full_ref->offset;
502  __entry->type = ref->type;
503  __entry->seq = ref->seq;
504  ),
505 
506  TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
507  "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, "
508  "offset = %llu, type = %s, seq = %llu",
509  (unsigned long long)__entry->bytenr,
510  (unsigned long long)__entry->num_bytes,
511  show_ref_action(__entry->action),
512  show_root_type(__entry->parent),
513  show_root_type(__entry->ref_root),
514  (unsigned long long)__entry->owner,
515  (unsigned long long)__entry->offset,
516  show_ref_type(__entry->type),
517  (unsigned long long)__entry->seq)
518 );
519 
521 
522  TP_PROTO(struct btrfs_delayed_ref_node *ref,
523  struct btrfs_delayed_ref_head *head_ref,
524  int action),
525 
526  TP_ARGS(ref, head_ref, action),
527 
529  __field( u64, bytenr )
530  __field( u64, num_bytes )
531  __field( int, action )
532  __field( int, is_data )
533  ),
534 
536  __entry->bytenr = ref->bytenr;
537  __entry->num_bytes = ref->num_bytes;
538  __entry->action = action;
539  __entry->is_data = head_ref->is_data;
540  ),
541 
542  TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d",
543  (unsigned long long)__entry->bytenr,
544  (unsigned long long)__entry->num_bytes,
545  show_ref_action(__entry->action),
546  __entry->is_data)
547 );
548 
549 #define show_chunk_type(type) \
550  __print_flags(type, "|", \
551  { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \
552  { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
553  { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
554  { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \
555  { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \
556  { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \
557  { BTRFS_BLOCK_GROUP_RAID10, "RAID10"})
558 
559 DECLARE_EVENT_CLASS(btrfs__chunk,
560 
561  TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
562  u64 offset, u64 size),
563 
564  TP_ARGS(root, map, offset, size),
565 
567  __field( int, num_stripes )
568  __field( u64, type )
569  __field( int, sub_stripes )
570  __field( u64, offset )
571  __field( u64, size )
573  ),
574 
576  __entry->num_stripes = map->num_stripes;
577  __entry->type = map->type;
578  __entry->sub_stripes = map->sub_stripes;
579  __entry->offset = offset;
580  __entry->size = size;
581  __entry->root_objectid = root->root_key.objectid;
582  ),
583 
584  TP_printk("root = %llu(%s), offset = %llu, size = %llu, "
585  "num_stripes = %d, sub_stripes = %d, type = %s",
586  show_root_type(__entry->root_objectid),
587  (unsigned long long)__entry->offset,
588  (unsigned long long)__entry->size,
589  __entry->num_stripes, __entry->sub_stripes,
590  show_chunk_type(__entry->type))
591 );
592 
593 DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc,
594 
595  TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
596  u64 offset, u64 size),
597 
598  TP_ARGS(root, map, offset, size)
599 );
600 
601 DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free,
602 
603  TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
604  u64 offset, u64 size),
605 
606  TP_ARGS(root, map, offset, size)
607 );
608 
610 
611  TP_PROTO(struct btrfs_root *root, struct extent_buffer *buf,
612  struct extent_buffer *cow),
613 
614  TP_ARGS(root, buf, cow),
615 
618  __field( u64, buf_start )
619  __field( int, refs )
620  __field( u64, cow_start )
621  __field( int, buf_level )
622  __field( int, cow_level )
623  ),
624 
626  __entry->root_objectid = root->root_key.objectid;
627  __entry->buf_start = buf->start;
628  __entry->refs = atomic_read(&buf->refs);
629  __entry->cow_start = cow->start;
630  __entry->buf_level = btrfs_header_level(buf);
631  __entry->cow_level = btrfs_header_level(cow);
632  ),
633 
634  TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu "
635  "(orig_level = %d), cow_buf = %llu (cow_level = %d)",
636  show_root_type(__entry->root_objectid),
637  __entry->refs,
638  (unsigned long long)__entry->buf_start,
639  __entry->buf_level,
640  (unsigned long long)__entry->cow_start,
641  __entry->cow_level)
642 );
643 
644 TRACE_EVENT(btrfs_space_reservation,
645 
646  TP_PROTO(struct btrfs_fs_info *fs_info, char *type, u64 val,
647  u64 bytes, int reserve),
648 
649  TP_ARGS(fs_info, type, val, bytes, reserve),
650 
653  __string( type, type )
654  __field( u64, val )
655  __field( u64, bytes )
656  __field( int, reserve )
657  ),
658 
660  memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE);
661  __assign_str(type, type);
662  __entry->val = val;
663  __entry->bytes = bytes;
664  __entry->reserve = reserve;
665  ),
666 
667  TP_printk("%pU: %s: %Lu %s %Lu", __entry->fsid, __get_str(type),
668  __entry->val, __entry->reserve ? "reserve" : "release",
669  __entry->bytes)
670 );
671 
672 DECLARE_EVENT_CLASS(btrfs__reserved_extent,
673 
674  TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
675 
676  TP_ARGS(root, start, len),
677 
680  __field( u64, start )
681  __field( u64, len )
682  ),
683 
685  __entry->root_objectid = root->root_key.objectid;
686  __entry->start = start;
687  __entry->len = len;
688  ),
689 
690  TP_printk("root = %llu(%s), start = %llu, len = %llu",
691  show_root_type(__entry->root_objectid),
692  (unsigned long long)__entry->start,
693  (unsigned long long)__entry->len)
694 );
695 
696 DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc,
697 
698  TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
699 
700  TP_ARGS(root, start, len)
701 );
702 
703 DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free,
704 
705  TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
706 
707  TP_ARGS(root, start, len)
708 );
709 
710 TRACE_EVENT(find_free_extent,
711 
712  TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size,
713  u64 data),
714 
715  TP_ARGS(root, num_bytes, empty_size, data),
716 
719  __field( u64, num_bytes )
720  __field( u64, empty_size )
721  __field( u64, data )
722  ),
723 
725  __entry->root_objectid = root->root_key.objectid;
726  __entry->num_bytes = num_bytes;
727  __entry->empty_size = empty_size;
728  __entry->data = data;
729  ),
730 
731  TP_printk("root = %Lu(%s), len = %Lu, empty_size = %Lu, "
732  "flags = %Lu(%s)", show_root_type(__entry->root_objectid),
733  __entry->num_bytes, __entry->empty_size, __entry->data,
734  __print_flags((unsigned long)__entry->data, "|",
736 );
737 
738 DECLARE_EVENT_CLASS(btrfs__reserve_extent,
739 
740  TP_PROTO(struct btrfs_root *root,
741  struct btrfs_block_group_cache *block_group, u64 start,
742  u64 len),
743 
744  TP_ARGS(root, block_group, start, len),
745 
748  __field( u64, bg_objectid )
749  __field( u64, flags )
750  __field( u64, start )
751  __field( u64, len )
752  ),
753 
755  __entry->root_objectid = root->root_key.objectid;
756  __entry->bg_objectid = block_group->key.objectid;
757  __entry->flags = block_group->flags;
758  __entry->start = start;
759  __entry->len = len;
760  ),
761 
762  TP_printk("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), "
763  "start = %Lu, len = %Lu",
764  show_root_type(__entry->root_objectid), __entry->bg_objectid,
765  __entry->flags, __print_flags((unsigned long)__entry->flags,
766  "|", BTRFS_GROUP_FLAGS),
767  __entry->start, __entry->len)
768 );
769 
770 DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent,
771 
772  TP_PROTO(struct btrfs_root *root,
773  struct btrfs_block_group_cache *block_group, u64 start,
774  u64 len),
775 
776  TP_ARGS(root, block_group, start, len)
777 );
778 
779 DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
780 
781  TP_PROTO(struct btrfs_root *root,
782  struct btrfs_block_group_cache *block_group, u64 start,
783  u64 len),
784 
785  TP_ARGS(root, block_group, start, len)
786 );
787 
788 TRACE_EVENT(btrfs_find_cluster,
789 
790  TP_PROTO(struct btrfs_block_group_cache *block_group, u64 start,
791  u64 bytes, u64 empty_size, u64 min_bytes),
792 
793  TP_ARGS(block_group, start, bytes, empty_size, min_bytes),
794 
796  __field( u64, bg_objectid )
797  __field( u64, flags )
798  __field( u64, start )
799  __field( u64, bytes )
800  __field( u64, empty_size )
801  __field( u64, min_bytes )
802  ),
803 
805  __entry->bg_objectid = block_group->key.objectid;
806  __entry->flags = block_group->flags;
807  __entry->start = start;
808  __entry->bytes = bytes;
809  __entry->empty_size = empty_size;
810  __entry->min_bytes = min_bytes;
811  ),
812 
813  TP_printk("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu,"
814  " empty_size = %Lu, min_bytes = %Lu", __entry->bg_objectid,
815  __entry->flags,
816  __print_flags((unsigned long)__entry->flags, "|",
817  BTRFS_GROUP_FLAGS), __entry->start,
818  __entry->bytes, __entry->empty_size, __entry->min_bytes)
819 );
820 
821 TRACE_EVENT(btrfs_failed_cluster_setup,
822 
823  TP_PROTO(struct btrfs_block_group_cache *block_group),
824 
825  TP_ARGS(block_group),
826 
828  __field( u64, bg_objectid )
829  ),
830 
832  __entry->bg_objectid = block_group->key.objectid;
833  ),
834 
835  TP_printk("block_group = %Lu", __entry->bg_objectid)
836 );
837 
838 TRACE_EVENT(btrfs_setup_cluster,
839 
840  TP_PROTO(struct btrfs_block_group_cache *block_group,
841  struct btrfs_free_cluster *cluster, u64 size, int bitmap),
842 
843  TP_ARGS(block_group, cluster, size, bitmap),
844 
846  __field( u64, bg_objectid )
847  __field( u64, flags )
848  __field( u64, start )
849  __field( u64, max_size )
850  __field( u64, size )
851  __field( int, bitmap )
852  ),
853 
855  __entry->bg_objectid = block_group->key.objectid;
856  __entry->flags = block_group->flags;
857  __entry->start = cluster->window_start;
858  __entry->max_size = cluster->max_size;
859  __entry->size = size;
860  __entry->bitmap = bitmap;
861  ),
862 
863  TP_printk("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, "
864  "size = %Lu, max_size = %Lu, bitmap = %d",
865  __entry->bg_objectid,
866  __entry->flags,
867  __print_flags((unsigned long)__entry->flags, "|",
868  BTRFS_GROUP_FLAGS), __entry->start,
869  __entry->size, __entry->max_size, __entry->bitmap)
870 );
871 
872 struct extent_state;
873 TRACE_EVENT(alloc_extent_state,
874 
875  TP_PROTO(struct extent_state *state, gfp_t mask, unsigned long IP),
876 
877  TP_ARGS(state, mask, IP),
878 
880  __field(struct extent_state *, state)
881  __field(gfp_t, mask)
882  __field(unsigned long, ip)
883  ),
884 
886  __entry->state = state,
887  __entry->mask = mask,
888  __entry->ip = IP
889  ),
890 
891  TP_printk("state=%p; mask = %s; caller = %pF", __entry->state,
892  show_gfp_flags(__entry->mask), (void *)__entry->ip)
893 );
894 
896 
897  TP_PROTO(struct extent_state *state, unsigned long IP),
898 
899  TP_ARGS(state, IP),
900 
902  __field(struct extent_state *, state)
903  __field(unsigned long, ip)
904  ),
905 
907  __entry->state = state,
908  __entry->ip = IP
909  ),
910 
911  TP_printk(" state=%p; caller = %pF", __entry->state,
912  (void *)__entry->ip)
913 );
914 
915 #endif /* _TRACE_BTRFS_H */
916 
917 /* This part must be outside protection */
918 #include <trace/define_trace.h>