Fix: remove unused gfpflags.h from btrfs and compaction instrumentation
[lttng-modules.git] / instrumentation / events / lttng-module / btrfs.h
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_
13 struct btrfs_root;
14 struct btrfs_fs_info;
15 struct btrfs_inode;
16 struct extent_map;
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 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
23 struct btrfs_block_group_cache;
24 struct btrfs_free_cluster;
25 #endif
26 struct map_lookup;
27 struct extent_buffer;
28 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
29 struct extent_state;
30 #endif
31 #endif
32
33 #define BTRFS_UUID_SIZE 16
34
35 LTTNG_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
47 LTTNG_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
65 LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__inode, btrfs_inode_new,
66
67 TP_PROTO(struct inode *inode),
68
69 TP_ARGS(inode)
70 )
71
72 LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__inode, btrfs_inode_request,
73
74 TP_PROTO(struct inode *inode),
75
76 TP_ARGS(inode)
77 )
78
79 LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__inode, btrfs_inode_evict,
80
81 TP_PROTO(struct inode *inode),
82
83 TP_ARGS(inode)
84 )
85
86 LTTNG_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
105 LTTNG_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
126 LTTNG_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
133 LTTNG_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
140 LTTNG_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
147 LTTNG_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
154 LTTNG_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
181 LTTNG_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
193 LTTNG_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
210 LTTNG_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 LTTNG_TRACEPOINT_EVENT(btrfs_sync_fs,
226
227 TP_PROTO(int wait),
228
229 TP_ARGS(wait),
230
231 TP_FIELDS(
232 ctf_integer(int, wait, wait)
233 )
234 )
235
236 LTTNG_TRACEPOINT_EVENT(btrfs_delayed_tree_ref,
237
238 TP_PROTO(struct btrfs_delayed_ref_node *ref,
239 struct btrfs_delayed_tree_ref *full_ref,
240 int action),
241
242 TP_ARGS(ref, full_ref, action),
243
244 TP_FIELDS(
245 ctf_integer(u64, bytenr, ref->bytenr)
246 ctf_integer(u64, num_bytes, ref->num_bytes)
247 ctf_integer(int, action, action)
248 ctf_integer(u64, parent, full_ref->parent)
249 ctf_integer(u64, ref_root, full_ref->root)
250 ctf_integer(int, level, full_ref->level)
251 ctf_integer(int, type, ref->type)
252 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
253 ctf_integer(u64, seq, ref->seq)
254 #endif
255 )
256 )
257
258 LTTNG_TRACEPOINT_EVENT(btrfs_delayed_data_ref,
259
260 TP_PROTO(struct btrfs_delayed_ref_node *ref,
261 struct btrfs_delayed_data_ref *full_ref,
262 int action),
263
264 TP_ARGS(ref, full_ref, action),
265
266 TP_FIELDS(
267 ctf_integer(u64, bytenr, ref->bytenr)
268 ctf_integer(u64, num_bytes, ref->num_bytes)
269 ctf_integer(int, action, action)
270 ctf_integer(u64, parent, full_ref->parent)
271 ctf_integer(u64, ref_root, full_ref->root)
272 ctf_integer(u64, owner, full_ref->objectid)
273 ctf_integer(u64, offset, full_ref->offset)
274 ctf_integer(int, type, ref->type)
275 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
276 ctf_integer(u64, seq, ref->seq)
277 #endif
278 )
279 )
280
281 LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
282
283 TP_PROTO(struct btrfs_delayed_ref_node *ref,
284 struct btrfs_delayed_ref_head *head_ref,
285 int action),
286
287 TP_ARGS(ref, head_ref, action),
288
289 TP_FIELDS(
290 ctf_integer(u64, bytenr, ref->bytenr)
291 ctf_integer(u64, num_bytes, ref->num_bytes)
292 ctf_integer(int, action, action)
293 ctf_integer(int, is_data, head_ref->is_data)
294 )
295 )
296
297 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__chunk,
298
299 TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
300 u64 offset, u64 size),
301
302 TP_ARGS(root, map, offset, size),
303
304 TP_FIELDS(
305 ctf_integer(int, num_stripes, map->num_stripes)
306 ctf_integer(u64, type, map->type)
307 ctf_integer(int, sub_stripes, map->sub_stripes)
308 ctf_integer(u64, offset, offset)
309 ctf_integer(u64, size, size)
310 ctf_integer(u64, root_objectid, root->root_key.objectid)
311 )
312 )
313
314 LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__chunk, btrfs_chunk_alloc,
315
316 TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
317 u64 offset, u64 size),
318
319 TP_ARGS(root, map, offset, size)
320 )
321
322 LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__chunk, btrfs_chunk_free,
323
324 TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
325 u64 offset, u64 size),
326
327 TP_ARGS(root, map, offset, size)
328 )
329
330 LTTNG_TRACEPOINT_EVENT(btrfs_cow_block,
331
332 TP_PROTO(struct btrfs_root *root, struct extent_buffer *buf,
333 struct extent_buffer *cow),
334
335 TP_ARGS(root, buf, cow),
336
337 TP_FIELDS(
338 ctf_integer(u64, root_objectid, root->root_key.objectid)
339 ctf_integer(u64, buf_start, buf->start)
340 ctf_integer(int, refs, atomic_read(&buf->refs))
341 ctf_integer(u64, cow_start, cow->start)
342 ctf_integer(int, buf_level, btrfs_header_level(buf))
343 ctf_integer(int, cow_level, btrfs_header_level(cow))
344 )
345 )
346
347 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
348 LTTNG_TRACEPOINT_EVENT(btrfs_space_reservation,
349
350 TP_PROTO(struct btrfs_fs_info *fs_info, char *type, u64 val,
351 u64 bytes, int reserve),
352
353 TP_ARGS(fs_info, type, val, bytes, reserve),
354
355 TP_FIELDS(
356 ctf_array(u8, fsid, fs_info->fsid, BTRFS_UUID_SIZE)
357 ctf_string(type, type)
358 ctf_integer(u64, val, val)
359 ctf_integer(u64, bytes, bytes)
360 ctf_integer(int, reserve, reserve)
361 )
362 )
363 #endif
364
365 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserved_extent,
366
367 TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
368
369 TP_ARGS(root, start, len),
370
371 TP_FIELDS(
372 ctf_integer(u64, root_objectid, root->root_key.objectid)
373 ctf_integer(u64, start, start)
374 ctf_integer(u64, len, len)
375 )
376 )
377
378 LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserved_extent, btrfs_reserved_extent_alloc,
379
380 TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
381
382 TP_ARGS(root, start, len)
383 )
384
385 LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserved_extent, btrfs_reserved_extent_free,
386
387 TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
388
389 TP_ARGS(root, start, len)
390 )
391
392 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
393 LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
394
395 btrfs_find_free_extent,
396
397 TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size,
398 u64 data),
399
400 TP_ARGS(root, num_bytes, empty_size, data),
401
402 TP_FIELDS(
403 ctf_integer(u64, root_objectid, root->root_key.objectid)
404 ctf_integer(u64, num_bytes, num_bytes)
405 ctf_integer(u64, empty_size, empty_size)
406 ctf_integer(u64, data, data)
407 )
408 )
409
410 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
411
412 TP_PROTO(struct btrfs_root *root,
413 struct btrfs_block_group_cache *block_group, u64 start,
414 u64 len),
415
416 TP_ARGS(root, block_group, start, len),
417
418 TP_FIELDS(
419 ctf_integer(u64, root_objectid, root->root_key.objectid)
420 ctf_integer(u64, bg_objectid, block_group->key.objectid)
421 ctf_integer(u64, flags, block_group->flags)
422 ctf_integer(u64, start, start)
423 ctf_integer(u64, len, len)
424 )
425 )
426
427 LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent,
428
429 TP_PROTO(struct btrfs_root *root,
430 struct btrfs_block_group_cache *block_group, u64 start,
431 u64 len),
432
433 TP_ARGS(root, block_group, start, len)
434 )
435
436 LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
437
438 TP_PROTO(struct btrfs_root *root,
439 struct btrfs_block_group_cache *block_group, u64 start,
440 u64 len),
441
442 TP_ARGS(root, block_group, start, len)
443 )
444
445 LTTNG_TRACEPOINT_EVENT(btrfs_find_cluster,
446
447 TP_PROTO(struct btrfs_block_group_cache *block_group, u64 start,
448 u64 bytes, u64 empty_size, u64 min_bytes),
449
450 TP_ARGS(block_group, start, bytes, empty_size, min_bytes),
451
452 TP_FIELDS(
453 ctf_integer(u64, bg_objectid, block_group->key.objectid)
454 ctf_integer(u64, flags, block_group->flags)
455 ctf_integer(u64, start, start)
456 ctf_integer(u64, bytes, bytes)
457 ctf_integer(u64, empty_size, empty_size)
458 ctf_integer(u64, min_bytes, min_bytes)
459 )
460 )
461
462 LTTNG_TRACEPOINT_EVENT(btrfs_failed_cluster_setup,
463
464 TP_PROTO(struct btrfs_block_group_cache *block_group),
465
466 TP_ARGS(block_group),
467
468 TP_FIELDS(
469 ctf_integer(u64, bg_objectid, block_group->key.objectid)
470 )
471 )
472
473 LTTNG_TRACEPOINT_EVENT(btrfs_setup_cluster,
474
475 TP_PROTO(struct btrfs_block_group_cache *block_group,
476 struct btrfs_free_cluster *cluster, u64 size, int bitmap),
477
478 TP_ARGS(block_group, cluster, size, bitmap),
479
480 TP_FIELDS(
481 ctf_integer(u64, bg_objectid, block_group->key.objectid)
482 ctf_integer(u64, flags, block_group->flags)
483 ctf_integer(u64, start, cluster->window_start)
484 ctf_integer(u64, max_size, cluster->max_size)
485 ctf_integer(u64, size, size)
486 ctf_integer(int, bitmap, bitmap)
487 )
488 )
489 #endif
490
491 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
492 LTTNG_TRACEPOINT_EVENT_MAP(alloc_extent_state,
493
494 btrfs_alloc_extent_state,
495
496 TP_PROTO(struct extent_state *state, gfp_t mask, unsigned long IP),
497
498 TP_ARGS(state, mask, IP),
499
500 TP_FIELDS(
501 ctf_integer_hex(struct extent_state *, state, state)
502 ctf_integer(gfp_t, mask, mask)
503 ctf_integer(unsigned long, ip, IP)
504 )
505 )
506
507 LTTNG_TRACEPOINT_EVENT_MAP(free_extent_state,
508
509 btrfs_free_extent_state,
510
511 TP_PROTO(struct extent_state *state, unsigned long IP),
512
513 TP_ARGS(state, IP),
514
515 TP_FIELDS(
516 ctf_integer_hex(struct extent_state *, state, state)
517 ctf_integer(unsigned long, ip, IP)
518 )
519 )
520 #endif
521
522 #endif /* LTTNG_TRACE_BTRFS_H */
523
524 /* This part must be outside protection */
525 #include <probes/define_trace.h>
This page took 0.040156 seconds and 5 git commands to generate.