timer instrumentation: adapt to ktime_t without union
[lttng-modules.git] / instrumentation / events / lttng-module / btrfs.h
... / ...
CommitLineData
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM btrfs
3
4#if !defined(LTTNG_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ)
5#define LTTNG_TRACE_BTRFS_H
6
7#include <probes/lttng-tracepoint-event.h>
8#include <linux/writeback.h>
9#include <linux/version.h>
10
11#ifndef _TRACE_BTRFS_DEF_
12#define _TRACE_BTRFS_DEF_
13struct btrfs_root;
14struct btrfs_fs_info;
15struct btrfs_inode;
16struct extent_map;
17struct btrfs_ordered_extent;
18struct btrfs_delayed_ref_node;
19struct btrfs_delayed_tree_ref;
20struct btrfs_delayed_data_ref;
21struct btrfs_delayed_ref_head;
22#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
23struct btrfs_block_group_cache;
24struct btrfs_free_cluster;
25#endif
26struct map_lookup;
27struct extent_buffer;
28#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
29struct extent_state;
30#endif
31#endif
32
33#define BTRFS_UUID_SIZE 16
34
35LTTNG_TRACEPOINT_EVENT(btrfs_transaction_commit,
36
37 TP_PROTO(struct btrfs_root *root),
38
39 TP_ARGS(root),
40
41 TP_FIELDS(
42 ctf_integer(u64, generation, root->fs_info->generation)
43 ctf_integer(u64, root_objectid, root->root_key.objectid)
44 )
45)
46
47LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__inode,
48
49 TP_PROTO(struct inode *inode),
50
51 TP_ARGS(inode),
52
53 TP_FIELDS(
54 ctf_integer(ino_t, ino, inode->i_ino)
55 ctf_integer(blkcnt_t, blocks, inode->i_blocks)
56 ctf_integer(u64, disk_i_size, BTRFS_I(inode)->disk_i_size)
57 ctf_integer(u64, generation, BTRFS_I(inode)->generation)
58 ctf_integer(u64, last_trans, BTRFS_I(inode)->last_trans)
59 ctf_integer(u64, logged_trans, BTRFS_I(inode)->logged_trans)
60 ctf_integer(u64, root_objectid,
61 BTRFS_I(inode)->root->root_key.objectid)
62 )
63)
64
65LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__inode, btrfs_inode_new,
66
67 TP_PROTO(struct inode *inode),
68
69 TP_ARGS(inode)
70)
71
72LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__inode, btrfs_inode_request,
73
74 TP_PROTO(struct inode *inode),
75
76 TP_ARGS(inode)
77)
78
79LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__inode, btrfs_inode_evict,
80
81 TP_PROTO(struct inode *inode),
82
83 TP_ARGS(inode)
84)
85
86LTTNG_TRACEPOINT_EVENT(btrfs_get_extent,
87
88 TP_PROTO(struct btrfs_root *root, struct extent_map *map),
89
90 TP_ARGS(root, map),
91
92 TP_FIELDS(
93 ctf_integer(u64, root_objectid, root->root_key.objectid)
94 ctf_integer(u64, start, map->start)
95 ctf_integer(u64, len, map->len)
96 ctf_integer(u64, orig_start, map->orig_start)
97 ctf_integer(u64, block_start, map->block_start)
98 ctf_integer(u64, block_len, map->block_len)
99 ctf_integer(unsigned long, flags, map->flags)
100 ctf_integer(int, refs, atomic_read(&map->refs))
101 ctf_integer(unsigned int, compress_type, map->compress_type)
102 )
103)
104
105LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__ordered_extent,
106
107 TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
108
109 TP_ARGS(inode, ordered),
110
111 TP_FIELDS(
112 ctf_integer(ino_t, ino, inode->i_ino)
113 ctf_integer(u64, file_offset, ordered->file_offset)
114 ctf_integer(u64, start, ordered->start)
115 ctf_integer(u64, len, ordered->len)
116 ctf_integer(u64, disk_len, ordered->disk_len)
117 ctf_integer(u64, bytes_left, ordered->bytes_left)
118 ctf_integer(unsigned long, flags, ordered->flags)
119 ctf_integer(int, compress_type, ordered->compress_type)
120 ctf_integer(int, refs, atomic_read(&ordered->refs))
121 ctf_integer(u64, root_objectid,
122 BTRFS_I(inode)->root->root_key.objectid)
123 )
124)
125
126LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_add,
127
128 TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
129
130 TP_ARGS(inode, ordered)
131)
132
133LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_remove,
134
135 TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
136
137 TP_ARGS(inode, ordered)
138)
139
140LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_start,
141
142 TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
143
144 TP_ARGS(inode, ordered)
145)
146
147LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_put,
148
149 TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
150
151 TP_ARGS(inode, ordered)
152)
153
154LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__writepage,
155
156 TP_PROTO(struct page *page, struct inode *inode,
157 struct writeback_control *wbc),
158
159 TP_ARGS(page, inode, wbc),
160
161 TP_FIELDS(
162 ctf_integer(ino_t, ino, inode->i_ino)
163 ctf_integer(pgoff_t, index, page->index)
164 ctf_integer(long, nr_to_write, wbc->nr_to_write)
165 ctf_integer(long, pages_skipped, wbc->pages_skipped)
166 ctf_integer(loff_t, range_start, wbc->range_start)
167 ctf_integer(loff_t, range_end, wbc->range_end)
168#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
169 ctf_integer(char, nonblocking, wbc->nonblocking)
170#endif
171 ctf_integer(char, for_kupdate, wbc->for_kupdate)
172 ctf_integer(char, for_reclaim, wbc->for_reclaim)
173 ctf_integer(char, range_cyclic, wbc->range_cyclic)
174 ctf_integer(pgoff_t, writeback_index,
175 inode->i_mapping->writeback_index)
176 ctf_integer(u64, root_objectid,
177 BTRFS_I(inode)->root->root_key.objectid)
178 )
179)
180
181LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs__writepage,
182
183 __extent_writepage,
184
185 btrfs__extent_writepage,
186
187 TP_PROTO(struct page *page, struct inode *inode,
188 struct writeback_control *wbc),
189
190 TP_ARGS(page, inode, wbc)
191)
192
193LTTNG_TRACEPOINT_EVENT(btrfs_writepage_end_io_hook,
194
195 TP_PROTO(struct page *page, u64 start, u64 end, int uptodate),
196
197 TP_ARGS(page, start, end, uptodate),
198
199 TP_FIELDS(
200 ctf_integer(ino_t, ino, page->mapping->host->i_ino)
201 ctf_integer(pgoff_t, index, page->index)
202 ctf_integer(u64, start, start)
203 ctf_integer(u64, end, end)
204 ctf_integer(int, uptodate, uptodate)
205 ctf_integer(u64, root_objectid,
206 BTRFS_I(page->mapping->host)->root->root_key.objectid)
207 )
208)
209
210LTTNG_TRACEPOINT_EVENT(btrfs_sync_file,
211
212 TP_PROTO(struct file *file, int datasync),
213
214 TP_ARGS(file, datasync),
215
216 TP_FIELDS(
217 ctf_integer(ino_t, ino, file->f_path.dentry->d_inode->i_ino)
218 ctf_integer(ino_t, parent, file->f_path.dentry->d_parent->d_inode->i_ino)
219 ctf_integer(int, datasync, datasync)
220 ctf_integer(u64, root_objectid,
221 BTRFS_I(file->f_path.dentry->d_inode)->root->root_key.objectid)
222 )
223)
224
225#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
226LTTNG_TRACEPOINT_EVENT(btrfs_sync_fs,
227
228 TP_PROTO(struct btrfs_fs_info *fs_info, int wait),
229
230 TP_ARGS(fs_info, wait),
231
232 TP_FIELDS(
233 ctf_integer(int, wait, wait)
234 )
235)
236#else
237LTTNG_TRACEPOINT_EVENT(btrfs_sync_fs,
238
239 TP_PROTO(int wait),
240
241 TP_ARGS(wait),
242
243 TP_FIELDS(
244 ctf_integer(int, wait, wait)
245 )
246)
247#endif
248
249LTTNG_TRACEPOINT_EVENT(btrfs_add_block_group,
250
251 TP_PROTO(struct btrfs_fs_info *fs_info,
252 struct btrfs_block_group_cache *block_group, int create),
253
254 TP_ARGS(fs_info, block_group, create),
255
256 TP_FIELDS(
257 ctf_array(u8, fsid, fs_info->fsid, BTRFS_UUID_SIZE)
258 ctf_integer(u64, offset, block_group->key.objectid)
259 ctf_integer(u64, size, block_group->key.offset)
260 ctf_integer(u64, flags, block_group->flags)
261 ctf_integer(u64, bytes_used, btrfs_block_group_used(&block_group->item))
262 ctf_integer(u64, bytes_super, block_group->bytes_super)
263 ctf_integer(int, create, create)
264 )
265)
266
267#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
268LTTNG_TRACEPOINT_EVENT(btrfs_delayed_tree_ref,
269
270 TP_PROTO(struct btrfs_fs_info *fs_info,
271 struct btrfs_delayed_ref_node *ref,
272 struct btrfs_delayed_tree_ref *full_ref,
273 int action),
274
275 TP_ARGS(fs_info, ref, full_ref, action),
276
277 TP_FIELDS(
278 ctf_integer(u64, bytenr, ref->bytenr)
279 ctf_integer(u64, num_bytes, ref->num_bytes)
280 ctf_integer(int, action, action)
281 ctf_integer(u64, parent, full_ref->parent)
282 ctf_integer(u64, ref_root, full_ref->root)
283 ctf_integer(int, level, full_ref->level)
284 ctf_integer(int, type, ref->type)
285 ctf_integer(u64, seq, ref->seq)
286 )
287)
288#else
289LTTNG_TRACEPOINT_EVENT(btrfs_delayed_tree_ref,
290
291 TP_PROTO(struct btrfs_delayed_ref_node *ref,
292 struct btrfs_delayed_tree_ref *full_ref,
293 int action),
294
295 TP_ARGS(ref, full_ref, action),
296
297 TP_FIELDS(
298 ctf_integer(u64, bytenr, ref->bytenr)
299 ctf_integer(u64, num_bytes, ref->num_bytes)
300 ctf_integer(int, action, action)
301 ctf_integer(u64, parent, full_ref->parent)
302 ctf_integer(u64, ref_root, full_ref->root)
303 ctf_integer(int, level, full_ref->level)
304 ctf_integer(int, type, ref->type)
305#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
306 ctf_integer(u64, seq, ref->seq)
307#endif
308 )
309)
310#endif
311
312LTTNG_TRACEPOINT_EVENT(btrfs_delayed_data_ref,
313
314 TP_PROTO(struct btrfs_delayed_ref_node *ref,
315 struct btrfs_delayed_data_ref *full_ref,
316 int action),
317
318 TP_ARGS(ref, full_ref, action),
319
320 TP_FIELDS(
321 ctf_integer(u64, bytenr, ref->bytenr)
322 ctf_integer(u64, num_bytes, ref->num_bytes)
323 ctf_integer(int, action, action)
324 ctf_integer(u64, parent, full_ref->parent)
325 ctf_integer(u64, ref_root, full_ref->root)
326 ctf_integer(u64, owner, full_ref->objectid)
327 ctf_integer(u64, offset, full_ref->offset)
328 ctf_integer(int, type, ref->type)
329#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
330 ctf_integer(u64, seq, ref->seq)
331#endif
332 )
333)
334
335#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
336LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
337
338 TP_PROTO(struct btrfs_fs_info *fs_info,
339 struct btrfs_delayed_ref_node *ref,
340 struct btrfs_delayed_ref_head *head_ref,
341 int action),
342
343 TP_ARGS(fs_info, ref, head_ref, action),
344
345 TP_FIELDS(
346 ctf_integer(u64, bytenr, ref->bytenr)
347 ctf_integer(u64, num_bytes, ref->num_bytes)
348 ctf_integer(int, action, action)
349 ctf_integer(int, is_data, head_ref->is_data)
350 )
351)
352
353#else
354LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
355
356 TP_PROTO(struct btrfs_delayed_ref_node *ref,
357 struct btrfs_delayed_ref_head *head_ref,
358 int action),
359
360 TP_ARGS(ref, head_ref, action),
361
362 TP_FIELDS(
363 ctf_integer(u64, bytenr, ref->bytenr)
364 ctf_integer(u64, num_bytes, ref->num_bytes)
365 ctf_integer(int, action, action)
366 ctf_integer(int, is_data, head_ref->is_data)
367 )
368)
369#endif
370
371LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__chunk,
372
373 TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
374 u64 offset, u64 size),
375
376 TP_ARGS(root, map, offset, size),
377
378 TP_FIELDS(
379 ctf_integer(int, num_stripes, map->num_stripes)
380 ctf_integer(u64, type, map->type)
381 ctf_integer(int, sub_stripes, map->sub_stripes)
382 ctf_integer(u64, offset, offset)
383 ctf_integer(u64, size, size)
384 ctf_integer(u64, root_objectid, root->root_key.objectid)
385 )
386)
387
388LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__chunk, btrfs_chunk_alloc,
389
390 TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
391 u64 offset, u64 size),
392
393 TP_ARGS(root, map, offset, size)
394)
395
396LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__chunk, btrfs_chunk_free,
397
398 TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
399 u64 offset, u64 size),
400
401 TP_ARGS(root, map, offset, size)
402)
403
404LTTNG_TRACEPOINT_EVENT(btrfs_cow_block,
405
406 TP_PROTO(struct btrfs_root *root, struct extent_buffer *buf,
407 struct extent_buffer *cow),
408
409 TP_ARGS(root, buf, cow),
410
411 TP_FIELDS(
412 ctf_integer(u64, root_objectid, root->root_key.objectid)
413 ctf_integer(u64, buf_start, buf->start)
414 ctf_integer(int, refs, atomic_read(&buf->refs))
415 ctf_integer(u64, cow_start, cow->start)
416 ctf_integer(int, buf_level, btrfs_header_level(buf))
417 ctf_integer(int, cow_level, btrfs_header_level(cow))
418 )
419)
420
421#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
422LTTNG_TRACEPOINT_EVENT(btrfs_space_reservation,
423
424 TP_PROTO(struct btrfs_fs_info *fs_info, char *type, u64 val,
425 u64 bytes, int reserve),
426
427 TP_ARGS(fs_info, type, val, bytes, reserve),
428
429 TP_FIELDS(
430 ctf_array(u8, fsid, fs_info->fsid, BTRFS_UUID_SIZE)
431 ctf_string(type, type)
432 ctf_integer(u64, val, val)
433 ctf_integer(u64, bytes, bytes)
434 ctf_integer(int, reserve, reserve)
435 )
436)
437#endif
438
439LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserved_extent,
440
441 TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
442
443 TP_ARGS(root, start, len),
444
445 TP_FIELDS(
446 ctf_integer(u64, root_objectid, root->root_key.objectid)
447 ctf_integer(u64, start, start)
448 ctf_integer(u64, len, len)
449 )
450)
451
452LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserved_extent, btrfs_reserved_extent_alloc,
453
454 TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
455
456 TP_ARGS(root, start, len)
457)
458
459LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserved_extent, btrfs_reserved_extent_free,
460
461 TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
462
463 TP_ARGS(root, start, len)
464)
465
466#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
467LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
468
469 btrfs_find_free_extent,
470
471 TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size,
472 u64 data),
473
474 TP_ARGS(root, num_bytes, empty_size, data),
475
476 TP_FIELDS(
477 ctf_integer(u64, root_objectid, root->root_key.objectid)
478 ctf_integer(u64, num_bytes, num_bytes)
479 ctf_integer(u64, empty_size, empty_size)
480 ctf_integer(u64, data, data)
481 )
482)
483
484LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
485
486 TP_PROTO(struct btrfs_root *root,
487 struct btrfs_block_group_cache *block_group, u64 start,
488 u64 len),
489
490 TP_ARGS(root, block_group, start, len),
491
492 TP_FIELDS(
493 ctf_integer(u64, root_objectid, root->root_key.objectid)
494 ctf_integer(u64, bg_objectid, block_group->key.objectid)
495 ctf_integer(u64, flags, block_group->flags)
496 ctf_integer(u64, start, start)
497 ctf_integer(u64, len, len)
498 )
499)
500
501LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent,
502
503 TP_PROTO(struct btrfs_root *root,
504 struct btrfs_block_group_cache *block_group, u64 start,
505 u64 len),
506
507 TP_ARGS(root, block_group, start, len)
508)
509
510LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
511
512 TP_PROTO(struct btrfs_root *root,
513 struct btrfs_block_group_cache *block_group, u64 start,
514 u64 len),
515
516 TP_ARGS(root, block_group, start, len)
517)
518
519LTTNG_TRACEPOINT_EVENT(btrfs_find_cluster,
520
521 TP_PROTO(struct btrfs_block_group_cache *block_group, u64 start,
522 u64 bytes, u64 empty_size, u64 min_bytes),
523
524 TP_ARGS(block_group, start, bytes, empty_size, min_bytes),
525
526 TP_FIELDS(
527 ctf_integer(u64, bg_objectid, block_group->key.objectid)
528 ctf_integer(u64, flags, block_group->flags)
529 ctf_integer(u64, start, start)
530 ctf_integer(u64, bytes, bytes)
531 ctf_integer(u64, empty_size, empty_size)
532 ctf_integer(u64, min_bytes, min_bytes)
533 )
534)
535
536LTTNG_TRACEPOINT_EVENT(btrfs_failed_cluster_setup,
537
538 TP_PROTO(struct btrfs_block_group_cache *block_group),
539
540 TP_ARGS(block_group),
541
542 TP_FIELDS(
543 ctf_integer(u64, bg_objectid, block_group->key.objectid)
544 )
545)
546
547LTTNG_TRACEPOINT_EVENT(btrfs_setup_cluster,
548
549 TP_PROTO(struct btrfs_block_group_cache *block_group,
550 struct btrfs_free_cluster *cluster, u64 size, int bitmap),
551
552 TP_ARGS(block_group, cluster, size, bitmap),
553
554 TP_FIELDS(
555 ctf_integer(u64, bg_objectid, block_group->key.objectid)
556 ctf_integer(u64, flags, block_group->flags)
557 ctf_integer(u64, start, cluster->window_start)
558 ctf_integer(u64, max_size, cluster->max_size)
559 ctf_integer(u64, size, size)
560 ctf_integer(int, bitmap, bitmap)
561 )
562)
563#endif
564
565#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
566LTTNG_TRACEPOINT_EVENT_MAP(alloc_extent_state,
567
568 btrfs_alloc_extent_state,
569
570 TP_PROTO(struct extent_state *state, gfp_t mask, unsigned long IP),
571
572 TP_ARGS(state, mask, IP),
573
574 TP_FIELDS(
575 ctf_integer_hex(struct extent_state *, state, state)
576 ctf_integer(gfp_t, mask, mask)
577 ctf_integer(unsigned long, ip, IP)
578 )
579)
580
581LTTNG_TRACEPOINT_EVENT_MAP(free_extent_state,
582
583 btrfs_free_extent_state,
584
585 TP_PROTO(struct extent_state *state, unsigned long IP),
586
587 TP_ARGS(state, IP),
588
589 TP_FIELDS(
590 ctf_integer_hex(struct extent_state *, state, state)
591 ctf_integer(unsigned long, ip, IP)
592 )
593)
594#endif
595
596#endif /* LTTNG_TRACE_BTRFS_H */
597
598/* This part must be outside protection */
599#include <probes/define_trace.h>
This page took 0.024338 seconds and 4 git commands to generate.