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