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 | ||
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 | ||
144 | TRACE_EVENT(btrfs_transaction_commit, | |
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 | ||
165 | DECLARE_EVENT_CLASS(btrfs__inode, | |
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 | ||
203 | DEFINE_EVENT(btrfs__inode, btrfs_inode_new, | |
204 | ||
205 | TP_PROTO(struct inode *inode), | |
206 | ||
207 | TP_ARGS(inode) | |
208 | ) | |
209 | ||
210 | DEFINE_EVENT(btrfs__inode, btrfs_inode_request, | |
211 | ||
212 | TP_PROTO(struct inode *inode), | |
213 | ||
214 | TP_ARGS(inode) | |
215 | ) | |
216 | ||
217 | DEFINE_EVENT(btrfs__inode, btrfs_inode_evict, | |
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 | ||
b87700e3 AG |
265 | TRACE_EVENT(btrfs_get_extent, |
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 | ||
c126f575 MD |
309 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) |
310 | ||
311 | #define show_ordered_flags(flags) \ | |
312 | __print_symbolic(flags, \ | |
313 | { BTRFS_ORDERED_IO_DONE, "IO_DONE" }, \ | |
314 | { BTRFS_ORDERED_COMPLETE, "COMPLETE" }, \ | |
315 | { BTRFS_ORDERED_NOCOW, "NOCOW" }, \ | |
316 | { BTRFS_ORDERED_COMPRESSED, "COMPRESSED" }, \ | |
317 | { BTRFS_ORDERED_PREALLOC, "PREALLOC" }, \ | |
318 | { BTRFS_ORDERED_DIRECT, "DIRECT" }, \ | |
319 | { BTRFS_ORDERED_IOERR, "IOERR" }, \ | |
320 | { BTRFS_ORDERED_UPDATED_ISIZE, "UPDATED_ISIZE" }, \ | |
321 | { BTRFS_ORDERED_LOGGED_CSUM, "LOGGED_CSUM" }) | |
322 | ||
323 | #else | |
324 | ||
b87700e3 AG |
325 | #define show_ordered_flags(flags) \ |
326 | __print_symbolic(flags, \ | |
327 | { BTRFS_ORDERED_IO_DONE, "IO_DONE" }, \ | |
328 | { BTRFS_ORDERED_COMPLETE, "COMPLETE" }, \ | |
329 | { BTRFS_ORDERED_NOCOW, "NOCOW" }, \ | |
330 | { BTRFS_ORDERED_COMPRESSED, "COMPRESSED" }, \ | |
331 | { BTRFS_ORDERED_PREALLOC, "PREALLOC" }, \ | |
332 | { BTRFS_ORDERED_DIRECT, "DIRECT" }) | |
333 | ||
c126f575 MD |
334 | #endif |
335 | ||
b87700e3 AG |
336 | DECLARE_EVENT_CLASS(btrfs__ordered_extent, |
337 | ||
338 | TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), | |
339 | ||
340 | TP_ARGS(inode, ordered), | |
341 | ||
342 | TP_STRUCT__entry( | |
343 | __field( ino_t, ino ) | |
344 | __field( u64, file_offset ) | |
345 | __field( u64, start ) | |
346 | __field( u64, len ) | |
347 | __field( u64, disk_len ) | |
348 | __field( u64, bytes_left ) | |
349 | __field( unsigned long, flags ) | |
350 | __field( int, compress_type ) | |
351 | __field( int, refs ) | |
352 | __field( u64, root_objectid ) | |
353 | ), | |
354 | ||
355 | TP_fast_assign( | |
356 | tp_assign(ino, inode->i_ino) | |
357 | tp_assign(file_offset, ordered->file_offset) | |
358 | tp_assign(start, ordered->start) | |
359 | tp_assign(len, ordered->len) | |
360 | tp_assign(disk_len, ordered->disk_len) | |
361 | tp_assign(bytes_left, ordered->bytes_left) | |
362 | tp_assign(flags, ordered->flags) | |
363 | tp_assign(compress_type, ordered->compress_type) | |
364 | tp_assign(refs, atomic_read(&ordered->refs)) | |
365 | tp_assign(root_objectid, | |
366 | BTRFS_I(inode)->root->root_key.objectid) | |
367 | ), | |
368 | ||
369 | TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, " | |
370 | "start = %llu, len = %llu, disk_len = %llu, " | |
371 | "bytes_left = %llu, flags = %s, compress_type = %d, " | |
372 | "refs = %d", | |
373 | show_root_type(__entry->root_objectid), | |
374 | (unsigned long long)__entry->ino, | |
375 | (unsigned long long)__entry->file_offset, | |
376 | (unsigned long long)__entry->start, | |
377 | (unsigned long long)__entry->len, | |
378 | (unsigned long long)__entry->disk_len, | |
379 | (unsigned long long)__entry->bytes_left, | |
380 | show_ordered_flags(__entry->flags), | |
381 | __entry->compress_type, __entry->refs) | |
382 | ) | |
383 | ||
384 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add, | |
385 | ||
386 | TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), | |
387 | ||
388 | TP_ARGS(inode, ordered) | |
389 | ) | |
390 | ||
391 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove, | |
392 | ||
393 | TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), | |
394 | ||
395 | TP_ARGS(inode, ordered) | |
396 | ) | |
397 | ||
398 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start, | |
399 | ||
400 | TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), | |
401 | ||
402 | TP_ARGS(inode, ordered) | |
403 | ) | |
404 | ||
405 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put, | |
406 | ||
407 | TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), | |
408 | ||
409 | TP_ARGS(inode, ordered) | |
410 | ) | |
411 | ||
412 | DECLARE_EVENT_CLASS(btrfs__writepage, | |
413 | ||
414 | TP_PROTO(struct page *page, struct inode *inode, | |
415 | struct writeback_control *wbc), | |
416 | ||
417 | TP_ARGS(page, inode, wbc), | |
418 | ||
419 | TP_STRUCT__entry( | |
420 | __field( ino_t, ino ) | |
421 | __field( pgoff_t, index ) | |
422 | __field( long, nr_to_write ) | |
423 | __field( long, pages_skipped ) | |
424 | __field( loff_t, range_start ) | |
425 | __field( loff_t, range_end ) | |
426 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) | |
427 | __field( char, nonblocking ) | |
428 | #endif | |
429 | __field( char, for_kupdate ) | |
430 | __field( char, for_reclaim ) | |
431 | __field( char, range_cyclic ) | |
432 | __field( pgoff_t, writeback_index ) | |
433 | __field( u64, root_objectid ) | |
434 | ), | |
435 | ||
436 | TP_fast_assign( | |
437 | tp_assign(ino, inode->i_ino) | |
438 | tp_assign(index, page->index) | |
439 | tp_assign(nr_to_write, wbc->nr_to_write) | |
440 | tp_assign(pages_skipped, wbc->pages_skipped) | |
441 | tp_assign(range_start, wbc->range_start) | |
442 | tp_assign(range_end, wbc->range_end) | |
443 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) | |
444 | tp_assign(nonblocking, wbc->nonblocking) | |
445 | #endif | |
446 | tp_assign(for_kupdate, wbc->for_kupdate) | |
447 | tp_assign(for_reclaim, wbc->for_reclaim) | |
448 | tp_assign(range_cyclic, wbc->range_cyclic) | |
449 | tp_assign(writeback_index, inode->i_mapping->writeback_index) | |
450 | tp_assign(root_objectid, | |
451 | BTRFS_I(inode)->root->root_key.objectid) | |
452 | ), | |
453 | ||
454 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) | |
455 | TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, " | |
456 | "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, " | |
457 | "range_end = %llu, nonblocking = %d, for_kupdate = %d, " | |
458 | "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu", | |
459 | show_root_type(__entry->root_objectid), | |
460 | (unsigned long)__entry->ino, __entry->index, | |
461 | __entry->nr_to_write, __entry->pages_skipped, | |
462 | __entry->range_start, __entry->range_end, | |
463 | __entry->nonblocking, __entry->for_kupdate, | |
464 | __entry->for_reclaim, __entry->range_cyclic, | |
465 | (unsigned long)__entry->writeback_index) | |
466 | #else | |
467 | TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, " | |
468 | "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, " | |
469 | "range_end = %llu, for_kupdate = %d, " | |
470 | "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu", | |
471 | show_root_type(__entry->root_objectid), | |
472 | (unsigned long)__entry->ino, __entry->index, | |
473 | __entry->nr_to_write, __entry->pages_skipped, | |
474 | __entry->range_start, __entry->range_end, | |
475 | __entry->for_kupdate, | |
476 | __entry->for_reclaim, __entry->range_cyclic, | |
477 | (unsigned long)__entry->writeback_index) | |
478 | #endif | |
479 | ) | |
480 | ||
481 | DEFINE_EVENT(btrfs__writepage, __extent_writepage, | |
482 | ||
483 | TP_PROTO(struct page *page, struct inode *inode, | |
484 | struct writeback_control *wbc), | |
485 | ||
486 | TP_ARGS(page, inode, wbc) | |
487 | ) | |
488 | ||
489 | TRACE_EVENT(btrfs_writepage_end_io_hook, | |
490 | ||
491 | TP_PROTO(struct page *page, u64 start, u64 end, int uptodate), | |
492 | ||
493 | TP_ARGS(page, start, end, uptodate), | |
494 | ||
495 | TP_STRUCT__entry( | |
496 | __field( ino_t, ino ) | |
497 | __field( pgoff_t, index ) | |
498 | __field( u64, start ) | |
499 | __field( u64, end ) | |
500 | __field( int, uptodate ) | |
501 | __field( u64, root_objectid ) | |
502 | ), | |
503 | ||
504 | TP_fast_assign( | |
505 | tp_assign(ino, page->mapping->host->i_ino) | |
506 | tp_assign(index, page->index) | |
507 | tp_assign(start, start) | |
508 | tp_assign(end, end) | |
509 | tp_assign(uptodate, uptodate) | |
510 | tp_assign(root_objectid, | |
511 | BTRFS_I(page->mapping->host)->root->root_key.objectid) | |
512 | ), | |
513 | ||
514 | TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, " | |
515 | "end = %llu, uptodate = %d", | |
516 | show_root_type(__entry->root_objectid), | |
517 | (unsigned long)__entry->ino, (unsigned long)__entry->index, | |
518 | (unsigned long long)__entry->start, | |
519 | (unsigned long long)__entry->end, __entry->uptodate) | |
520 | ) | |
521 | ||
522 | TRACE_EVENT(btrfs_sync_file, | |
523 | ||
524 | TP_PROTO(struct file *file, int datasync), | |
525 | ||
526 | TP_ARGS(file, datasync), | |
527 | ||
528 | TP_STRUCT__entry( | |
529 | __field( ino_t, ino ) | |
530 | __field( ino_t, parent ) | |
531 | __field( int, datasync ) | |
532 | __field( u64, root_objectid ) | |
533 | ), | |
534 | ||
535 | TP_fast_assign( | |
536 | tp_assign(ino, file->f_path.dentry->d_inode->i_ino) | |
537 | tp_assign(parent, file->f_path.dentry->d_parent->d_inode->i_ino) | |
538 | tp_assign(datasync, datasync) | |
539 | tp_assign(root_objectid, | |
540 | BTRFS_I(file->f_path.dentry->d_inode)->root->root_key.objectid) | |
541 | ), | |
542 | ||
543 | TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d", | |
544 | show_root_type(__entry->root_objectid), | |
545 | (unsigned long)__entry->ino, (unsigned long)__entry->parent, | |
546 | __entry->datasync) | |
547 | ) | |
548 | ||
549 | TRACE_EVENT(btrfs_sync_fs, | |
550 | ||
551 | TP_PROTO(int wait), | |
552 | ||
553 | TP_ARGS(wait), | |
554 | ||
555 | TP_STRUCT__entry( | |
556 | __field( int, wait ) | |
557 | ), | |
558 | ||
559 | TP_fast_assign( | |
560 | tp_assign(wait, wait) | |
561 | ), | |
562 | ||
563 | TP_printk("wait = %d", __entry->wait) | |
564 | ) | |
565 | ||
566 | #define show_ref_action(action) \ | |
567 | __print_symbolic(action, \ | |
568 | { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \ | |
569 | { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \ | |
570 | { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \ | |
571 | { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" }) | |
572 | ||
573 | ||
574 | TRACE_EVENT(btrfs_delayed_tree_ref, | |
575 | ||
576 | TP_PROTO(struct btrfs_delayed_ref_node *ref, | |
577 | struct btrfs_delayed_tree_ref *full_ref, | |
578 | int action), | |
579 | ||
580 | TP_ARGS(ref, full_ref, action), | |
581 | ||
582 | TP_STRUCT__entry( | |
583 | __field( u64, bytenr ) | |
584 | __field( u64, num_bytes ) | |
585 | __field( int, action ) | |
586 | __field( u64, parent ) | |
587 | __field( u64, ref_root ) | |
588 | __field( int, level ) | |
589 | __field( int, type ) | |
590 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) | |
591 | __field( u64, seq ) | |
592 | #endif | |
593 | ), | |
594 | ||
595 | TP_fast_assign( | |
596 | tp_assign(bytenr, ref->bytenr) | |
597 | tp_assign(num_bytes, ref->num_bytes) | |
598 | tp_assign(action, action) | |
599 | tp_assign(parent, full_ref->parent) | |
600 | tp_assign(ref_root, full_ref->root) | |
601 | tp_assign(level, full_ref->level) | |
602 | tp_assign(type, ref->type) | |
603 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) | |
604 | tp_assign(seq, ref->seq) | |
605 | #endif | |
606 | ), | |
607 | ||
608 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) | |
609 | TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " | |
610 | "parent = %llu(%s), ref_root = %llu(%s), level = %d, " | |
611 | "type = %s, seq = %llu", | |
612 | #else | |
613 | TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " | |
614 | "parent = %llu(%s), ref_root = %llu(%s), level = %d, " | |
615 | "type = %s", | |
616 | #endif | |
617 | (unsigned long long)__entry->bytenr, | |
618 | (unsigned long long)__entry->num_bytes, | |
619 | show_ref_action(__entry->action), | |
620 | show_root_type(__entry->parent), | |
621 | show_root_type(__entry->ref_root), | |
622 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) | |
623 | __entry->level, show_ref_type(__entry->type), | |
624 | (unsigned long long)__entry->seq) | |
625 | #else | |
626 | __entry->level, show_ref_type(__entry->type)) | |
627 | #endif | |
628 | ) | |
629 | ||
630 | TRACE_EVENT(btrfs_delayed_data_ref, | |
631 | ||
632 | TP_PROTO(struct btrfs_delayed_ref_node *ref, | |
633 | struct btrfs_delayed_data_ref *full_ref, | |
634 | int action), | |
635 | ||
636 | TP_ARGS(ref, full_ref, action), | |
637 | ||
638 | TP_STRUCT__entry( | |
639 | __field( u64, bytenr ) | |
640 | __field( u64, num_bytes ) | |
641 | __field( int, action ) | |
642 | __field( u64, parent ) | |
643 | __field( u64, ref_root ) | |
644 | __field( u64, owner ) | |
645 | __field( u64, offset ) | |
646 | __field( int, type ) | |
647 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) | |
648 | __field( u64, seq ) | |
649 | #endif | |
650 | ), | |
651 | ||
652 | TP_fast_assign( | |
653 | tp_assign(bytenr, ref->bytenr) | |
654 | tp_assign(num_bytes, ref->num_bytes) | |
655 | tp_assign(action, action) | |
656 | tp_assign(parent, full_ref->parent) | |
657 | tp_assign(ref_root, full_ref->root) | |
658 | tp_assign(owner, full_ref->objectid) | |
659 | tp_assign(offset, full_ref->offset) | |
660 | tp_assign(type, ref->type) | |
661 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) | |
662 | tp_assign(seq, ref->seq) | |
663 | #endif | |
664 | ), | |
665 | ||
666 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) | |
667 | TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " | |
668 | "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, " | |
669 | "offset = %llu, type = %s, seq = %llu", | |
670 | #else | |
671 | TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " | |
672 | "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, " | |
673 | "offset = %llu, type = %s", | |
674 | #endif | |
675 | (unsigned long long)__entry->bytenr, | |
676 | (unsigned long long)__entry->num_bytes, | |
677 | show_ref_action(__entry->action), | |
678 | show_root_type(__entry->parent), | |
679 | show_root_type(__entry->ref_root), | |
680 | (unsigned long long)__entry->owner, | |
681 | (unsigned long long)__entry->offset, | |
682 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) | |
683 | show_ref_type(__entry->type), | |
684 | (unsigned long long)__entry->seq) | |
685 | #else | |
686 | show_ref_type(__entry->type)) | |
687 | #endif | |
688 | ) | |
689 | ||
690 | TRACE_EVENT(btrfs_delayed_ref_head, | |
691 | ||
692 | TP_PROTO(struct btrfs_delayed_ref_node *ref, | |
693 | struct btrfs_delayed_ref_head *head_ref, | |
694 | int action), | |
695 | ||
696 | TP_ARGS(ref, head_ref, action), | |
697 | ||
698 | TP_STRUCT__entry( | |
699 | __field( u64, bytenr ) | |
700 | __field( u64, num_bytes ) | |
701 | __field( int, action ) | |
702 | __field( int, is_data ) | |
703 | ), | |
704 | ||
705 | TP_fast_assign( | |
706 | tp_assign(bytenr, ref->bytenr) | |
707 | tp_assign(num_bytes, ref->num_bytes) | |
708 | tp_assign(action, action) | |
709 | tp_assign(is_data, head_ref->is_data) | |
710 | ), | |
711 | ||
712 | TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d", | |
713 | (unsigned long long)__entry->bytenr, | |
714 | (unsigned long long)__entry->num_bytes, | |
715 | show_ref_action(__entry->action), | |
716 | __entry->is_data) | |
717 | ) | |
718 | ||
c126f575 MD |
719 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) |
720 | ||
721 | #define show_chunk_type(type) \ | |
722 | __print_flags(type, "|", \ | |
723 | { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ | |
724 | { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ | |
725 | { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ | |
726 | { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ | |
727 | { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ | |
728 | { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ | |
729 | { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ | |
730 | { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \ | |
731 | { BTRFS_BLOCK_GROUP_RAID6, "RAID6" }) | |
732 | ||
733 | #else | |
734 | ||
b87700e3 AG |
735 | #define show_chunk_type(type) \ |
736 | __print_flags(type, "|", \ | |
737 | { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ | |
738 | { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ | |
739 | { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ | |
740 | { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ | |
741 | { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ | |
742 | { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ | |
743 | { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}) | |
744 | ||
c126f575 MD |
745 | #endif |
746 | ||
b87700e3 AG |
747 | DECLARE_EVENT_CLASS(btrfs__chunk, |
748 | ||
749 | TP_PROTO(struct btrfs_root *root, struct map_lookup *map, | |
750 | u64 offset, u64 size), | |
751 | ||
752 | TP_ARGS(root, map, offset, size), | |
753 | ||
754 | TP_STRUCT__entry( | |
755 | __field( int, num_stripes ) | |
756 | __field( u64, type ) | |
757 | __field( int, sub_stripes ) | |
758 | __field( u64, offset ) | |
759 | __field( u64, size ) | |
760 | __field( u64, root_objectid ) | |
761 | ), | |
762 | ||
763 | TP_fast_assign( | |
764 | tp_assign(num_stripes, map->num_stripes) | |
765 | tp_assign(type, map->type) | |
766 | tp_assign(sub_stripes, map->sub_stripes) | |
767 | tp_assign(offset, offset) | |
768 | tp_assign(size, size) | |
769 | tp_assign(root_objectid, root->root_key.objectid) | |
770 | ), | |
771 | ||
772 | TP_printk("root = %llu(%s), offset = %llu, size = %llu, " | |
773 | "num_stripes = %d, sub_stripes = %d, type = %s", | |
774 | show_root_type(__entry->root_objectid), | |
775 | (unsigned long long)__entry->offset, | |
776 | (unsigned long long)__entry->size, | |
777 | __entry->num_stripes, __entry->sub_stripes, | |
778 | show_chunk_type(__entry->type)) | |
779 | ) | |
780 | ||
781 | DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc, | |
782 | ||
783 | TP_PROTO(struct btrfs_root *root, struct map_lookup *map, | |
784 | u64 offset, u64 size), | |
785 | ||
786 | TP_ARGS(root, map, offset, size) | |
787 | ) | |
788 | ||
789 | DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free, | |
790 | ||
791 | TP_PROTO(struct btrfs_root *root, struct map_lookup *map, | |
792 | u64 offset, u64 size), | |
793 | ||
794 | TP_ARGS(root, map, offset, size) | |
795 | ) | |
796 | ||
797 | TRACE_EVENT(btrfs_cow_block, | |
798 | ||
799 | TP_PROTO(struct btrfs_root *root, struct extent_buffer *buf, | |
800 | struct extent_buffer *cow), | |
801 | ||
802 | TP_ARGS(root, buf, cow), | |
803 | ||
804 | TP_STRUCT__entry( | |
805 | __field( u64, root_objectid ) | |
806 | __field( u64, buf_start ) | |
807 | __field( int, refs ) | |
808 | __field( u64, cow_start ) | |
809 | __field( int, buf_level ) | |
810 | __field( int, cow_level ) | |
811 | ), | |
812 | ||
813 | TP_fast_assign( | |
814 | tp_assign(root_objectid, root->root_key.objectid) | |
815 | tp_assign(buf_start, buf->start) | |
816 | tp_assign(refs, atomic_read(&buf->refs)) | |
817 | tp_assign(cow_start, cow->start) | |
818 | tp_assign(buf_level, btrfs_header_level(buf)) | |
819 | tp_assign(cow_level, btrfs_header_level(cow)) | |
820 | ), | |
821 | ||
822 | TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu " | |
823 | "(orig_level = %d), cow_buf = %llu (cow_level = %d)", | |
824 | show_root_type(__entry->root_objectid), | |
825 | __entry->refs, | |
826 | (unsigned long long)__entry->buf_start, | |
827 | __entry->buf_level, | |
828 | (unsigned long long)__entry->cow_start, | |
829 | __entry->cow_level) | |
830 | ) | |
831 | ||
832 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) | |
833 | TRACE_EVENT(btrfs_space_reservation, | |
834 | ||
835 | TP_PROTO(struct btrfs_fs_info *fs_info, char *type, u64 val, | |
836 | u64 bytes, int reserve), | |
837 | ||
838 | TP_ARGS(fs_info, type, val, bytes, reserve), | |
839 | ||
840 | TP_STRUCT__entry( | |
841 | __array( u8, fsid, BTRFS_UUID_SIZE ) | |
842 | __string( type, type ) | |
843 | __field( u64, val ) | |
844 | __field( u64, bytes ) | |
845 | __field( int, reserve ) | |
846 | ), | |
847 | ||
848 | TP_fast_assign( | |
849 | tp_memcpy(fsid, fs_info->fsid, BTRFS_UUID_SIZE) | |
850 | tp_strcpy(type, type) | |
851 | tp_assign(val, val) | |
852 | tp_assign(bytes, bytes) | |
853 | tp_assign(reserve, reserve) | |
854 | ), | |
855 | ||
856 | TP_printk("%pU: %s: %Lu %s %Lu", __entry->fsid, __get_str(type), | |
857 | __entry->val, __entry->reserve ? "reserve" : "release", | |
858 | __entry->bytes) | |
859 | ) | |
860 | #endif | |
861 | ||
862 | DECLARE_EVENT_CLASS(btrfs__reserved_extent, | |
863 | ||
864 | TP_PROTO(struct btrfs_root *root, u64 start, u64 len), | |
865 | ||
866 | TP_ARGS(root, start, len), | |
867 | ||
868 | TP_STRUCT__entry( | |
869 | __field( u64, root_objectid ) | |
870 | __field( u64, start ) | |
871 | __field( u64, len ) | |
872 | ), | |
873 | ||
874 | TP_fast_assign( | |
875 | tp_assign(root_objectid, root->root_key.objectid) | |
876 | tp_assign(start, start) | |
877 | tp_assign(len, len) | |
878 | ), | |
879 | ||
880 | TP_printk("root = %llu(%s), start = %llu, len = %llu", | |
881 | show_root_type(__entry->root_objectid), | |
882 | (unsigned long long)__entry->start, | |
883 | (unsigned long long)__entry->len) | |
884 | ) | |
885 | ||
886 | DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc, | |
887 | ||
888 | TP_PROTO(struct btrfs_root *root, u64 start, u64 len), | |
889 | ||
890 | TP_ARGS(root, start, len) | |
891 | ) | |
892 | ||
893 | DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free, | |
894 | ||
895 | TP_PROTO(struct btrfs_root *root, u64 start, u64 len), | |
896 | ||
897 | TP_ARGS(root, start, len) | |
898 | ) | |
899 | ||
900 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) | |
9cf29d3e MD |
901 | TRACE_EVENT_MAP(find_free_extent, |
902 | ||
903 | btrfs_find_free_extent, | |
b87700e3 AG |
904 | |
905 | TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size, | |
906 | u64 data), | |
907 | ||
908 | TP_ARGS(root, num_bytes, empty_size, data), | |
909 | ||
910 | TP_STRUCT__entry( | |
911 | __field( u64, root_objectid ) | |
912 | __field( u64, num_bytes ) | |
913 | __field( u64, empty_size ) | |
914 | __field( u64, data ) | |
915 | ), | |
916 | ||
917 | TP_fast_assign( | |
918 | tp_assign(root_objectid, root->root_key.objectid) | |
919 | tp_assign(num_bytes, num_bytes) | |
920 | tp_assign(empty_size, empty_size) | |
921 | tp_assign(data, data) | |
922 | ), | |
923 | ||
924 | TP_printk("root = %Lu(%s), len = %Lu, empty_size = %Lu, " | |
925 | "flags = %Lu(%s)", show_root_type(__entry->root_objectid), | |
926 | __entry->num_bytes, __entry->empty_size, __entry->data, | |
927 | __print_flags((unsigned long)__entry->data, "|", | |
928 | BTRFS_GROUP_FLAGS)) | |
929 | ) | |
930 | ||
931 | DECLARE_EVENT_CLASS(btrfs__reserve_extent, | |
932 | ||
933 | TP_PROTO(struct btrfs_root *root, | |
934 | struct btrfs_block_group_cache *block_group, u64 start, | |
935 | u64 len), | |
936 | ||
937 | TP_ARGS(root, block_group, start, len), | |
938 | ||
939 | TP_STRUCT__entry( | |
940 | __field( u64, root_objectid ) | |
941 | __field( u64, bg_objectid ) | |
942 | __field( u64, flags ) | |
943 | __field( u64, start ) | |
944 | __field( u64, len ) | |
945 | ), | |
946 | ||
947 | TP_fast_assign( | |
948 | tp_assign(root_objectid, root->root_key.objectid) | |
949 | tp_assign(bg_objectid, block_group->key.objectid) | |
950 | tp_assign(flags, block_group->flags) | |
951 | tp_assign(start, start) | |
952 | tp_assign(len, len) | |
953 | ), | |
954 | ||
955 | TP_printk("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), " | |
956 | "start = %Lu, len = %Lu", | |
957 | show_root_type(__entry->root_objectid), __entry->bg_objectid, | |
958 | __entry->flags, __print_flags((unsigned long)__entry->flags, | |
959 | "|", BTRFS_GROUP_FLAGS), | |
960 | __entry->start, __entry->len) | |
961 | ) | |
962 | ||
963 | DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent, | |
964 | ||
965 | TP_PROTO(struct btrfs_root *root, | |
966 | struct btrfs_block_group_cache *block_group, u64 start, | |
967 | u64 len), | |
968 | ||
969 | TP_ARGS(root, block_group, start, len) | |
970 | ) | |
971 | ||
972 | DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster, | |
973 | ||
974 | TP_PROTO(struct btrfs_root *root, | |
975 | struct btrfs_block_group_cache *block_group, u64 start, | |
976 | u64 len), | |
977 | ||
978 | TP_ARGS(root, block_group, start, len) | |
979 | ) | |
980 | ||
981 | TRACE_EVENT(btrfs_find_cluster, | |
982 | ||
983 | TP_PROTO(struct btrfs_block_group_cache *block_group, u64 start, | |
984 | u64 bytes, u64 empty_size, u64 min_bytes), | |
985 | ||
986 | TP_ARGS(block_group, start, bytes, empty_size, min_bytes), | |
987 | ||
988 | TP_STRUCT__entry( | |
989 | __field( u64, bg_objectid ) | |
990 | __field( u64, flags ) | |
991 | __field( u64, start ) | |
992 | __field( u64, bytes ) | |
993 | __field( u64, empty_size ) | |
994 | __field( u64, min_bytes ) | |
995 | ), | |
996 | ||
997 | TP_fast_assign( | |
998 | tp_assign(bg_objectid, block_group->key.objectid) | |
999 | tp_assign(flags, block_group->flags) | |
1000 | tp_assign(start, start) | |
1001 | tp_assign(bytes, bytes) | |
1002 | tp_assign(empty_size, empty_size) | |
1003 | tp_assign(min_bytes, min_bytes) | |
1004 | ), | |
1005 | ||
1006 | TP_printk("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu," | |
1007 | " empty_size = %Lu, min_bytes = %Lu", __entry->bg_objectid, | |
1008 | __entry->flags, | |
1009 | __print_flags((unsigned long)__entry->flags, "|", | |
1010 | BTRFS_GROUP_FLAGS), __entry->start, | |
1011 | __entry->bytes, __entry->empty_size, __entry->min_bytes) | |
1012 | ) | |
1013 | ||
1014 | TRACE_EVENT(btrfs_failed_cluster_setup, | |
1015 | ||
1016 | TP_PROTO(struct btrfs_block_group_cache *block_group), | |
1017 | ||
1018 | TP_ARGS(block_group), | |
1019 | ||
1020 | TP_STRUCT__entry( | |
1021 | __field( u64, bg_objectid ) | |
1022 | ), | |
1023 | ||
1024 | TP_fast_assign( | |
1025 | tp_assign(bg_objectid, block_group->key.objectid) | |
1026 | ), | |
1027 | ||
1028 | TP_printk("block_group = %Lu", __entry->bg_objectid) | |
1029 | ) | |
1030 | ||
1031 | TRACE_EVENT(btrfs_setup_cluster, | |
1032 | ||
1033 | TP_PROTO(struct btrfs_block_group_cache *block_group, | |
1034 | struct btrfs_free_cluster *cluster, u64 size, int bitmap), | |
1035 | ||
1036 | TP_ARGS(block_group, cluster, size, bitmap), | |
1037 | ||
1038 | TP_STRUCT__entry( | |
1039 | __field( u64, bg_objectid ) | |
1040 | __field( u64, flags ) | |
1041 | __field( u64, start ) | |
1042 | __field( u64, max_size ) | |
1043 | __field( u64, size ) | |
1044 | __field( int, bitmap ) | |
1045 | ), | |
1046 | ||
1047 | TP_fast_assign( | |
1048 | tp_assign(bg_objectid, block_group->key.objectid) | |
1049 | tp_assign(flags, block_group->flags) | |
1050 | tp_assign(start, cluster->window_start) | |
1051 | tp_assign(max_size, cluster->max_size) | |
1052 | tp_assign(size, size) | |
1053 | tp_assign(bitmap, bitmap) | |
1054 | ), | |
1055 | ||
1056 | TP_printk("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, " | |
1057 | "size = %Lu, max_size = %Lu, bitmap = %d", | |
1058 | __entry->bg_objectid, | |
1059 | __entry->flags, | |
1060 | __print_flags((unsigned long)__entry->flags, "|", | |
1061 | BTRFS_GROUP_FLAGS), __entry->start, | |
1062 | __entry->size, __entry->max_size, __entry->bitmap) | |
1063 | ) | |
1064 | #endif | |
1065 | ||
1066 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) | |
9cf29d3e MD |
1067 | TRACE_EVENT_MAP(alloc_extent_state, |
1068 | ||
1069 | btrfs_alloc_extent_state, | |
b87700e3 AG |
1070 | |
1071 | TP_PROTO(struct extent_state *state, gfp_t mask, unsigned long IP), | |
1072 | ||
1073 | TP_ARGS(state, mask, IP), | |
1074 | ||
1075 | TP_STRUCT__entry( | |
1076 | __field(struct extent_state *, state) | |
1077 | __field(gfp_t, mask) | |
1078 | __field(unsigned long, ip) | |
1079 | ), | |
1080 | ||
1081 | TP_fast_assign( | |
1082 | tp_assign(state, state) | |
1083 | tp_assign(mask, mask) | |
1084 | tp_assign(ip, IP) | |
1085 | ), | |
1086 | ||
1087 | TP_printk("state=%p; mask = %s; caller = %pF", __entry->state, | |
1088 | show_gfp_flags(__entry->mask), (void *)__entry->ip) | |
1089 | ) | |
1090 | ||
9cf29d3e MD |
1091 | TRACE_EVENT_MAP(free_extent_state, |
1092 | ||
1093 | btrfs_free_extent_state, | |
b87700e3 AG |
1094 | |
1095 | TP_PROTO(struct extent_state *state, unsigned long IP), | |
1096 | ||
1097 | TP_ARGS(state, IP), | |
1098 | ||
1099 | TP_STRUCT__entry( | |
1100 | __field(struct extent_state *, state) | |
1101 | __field(unsigned long, ip) | |
1102 | ), | |
1103 | ||
1104 | TP_fast_assign( | |
1105 | tp_assign(state, state) | |
1106 | tp_assign(ip, IP) | |
1107 | ), | |
1108 | ||
1109 | TP_printk(" state=%p; caller = %pF", __entry->state, | |
1110 | (void *)__entry->ip) | |
1111 | ) | |
1112 | #endif | |
1113 | ||
1114 | #endif /* _TRACE_BTRFS_H */ | |
1115 | ||
1116 | /* This part must be outside protection */ | |
1117 | #include "../../../probes/define_trace.h" |