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