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