]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
1abe9b8a | 2 | #undef TRACE_SYSTEM |
3 | #define TRACE_SYSTEM btrfs | |
4 | ||
5 | #if !defined(_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ) | |
6 | #define _TRACE_BTRFS_H | |
7 | ||
8 | #include <linux/writeback.h> | |
9 | #include <linux/tracepoint.h> | |
420adbe9 | 10 | #include <trace/events/mmflags.h> |
1abe9b8a | 11 | |
12 | struct btrfs_root; | |
13 | struct btrfs_fs_info; | |
14 | struct btrfs_inode; | |
15 | struct extent_map; | |
09ed2f16 | 16 | struct btrfs_file_extent_item; |
1abe9b8a | 17 | struct btrfs_ordered_extent; |
18 | struct btrfs_delayed_ref_node; | |
19 | struct btrfs_delayed_tree_ref; | |
20 | struct btrfs_delayed_data_ref; | |
21 | struct btrfs_delayed_ref_head; | |
3f7de037 JB |
22 | struct btrfs_block_group_cache; |
23 | struct btrfs_free_cluster; | |
1abe9b8a | 24 | struct map_lookup; |
25 | struct extent_buffer; | |
52483bc2 | 26 | struct btrfs_work; |
c3a46891 | 27 | struct __btrfs_workqueue; |
0f5dcf8d | 28 | struct btrfs_qgroup_extent_record; |
3159fe7b | 29 | struct btrfs_qgroup; |
00142756 | 30 | struct prelim_ref; |
1abe9b8a | 31 | |
32 | #define show_ref_type(type) \ | |
33 | __print_symbolic(type, \ | |
34 | { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \ | |
35 | { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \ | |
36 | { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \ | |
37 | { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \ | |
38 | { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" }) | |
39 | ||
40 | #define __show_root_type(obj) \ | |
7f34b746 | 41 | __print_symbolic_u64(obj, \ |
1abe9b8a | 42 | { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ |
43 | { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ | |
44 | { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ | |
45 | { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \ | |
46 | { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \ | |
47 | { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \ | |
48 | { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \ | |
49 | { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ | |
e112e2b4 | 50 | { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \ |
1abe9b8a | 51 | { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ |
208acb8c OS |
52 | { BTRFS_UUID_TREE_OBJECTID, "UUID_TREE" }, \ |
53 | { BTRFS_FREE_SPACE_TREE_OBJECTID, "FREE_SPACE_TREE" }, \ | |
1abe9b8a | 54 | { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) |
55 | ||
56 | #define show_root_type(obj) \ | |
57 | obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ | |
fb57dc81 | 58 | (obj >= BTRFS_ROOT_TREE_OBJECTID && \ |
e112e2b4 | 59 | obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-" |
1abe9b8a | 60 | |
09ed2f16 LB |
61 | #define show_fi_type(type) \ |
62 | __print_symbolic(type, \ | |
63 | { BTRFS_FILE_EXTENT_INLINE, "INLINE" }, \ | |
64 | { BTRFS_FILE_EXTENT_REG, "REG" }, \ | |
65 | { BTRFS_FILE_EXTENT_PREALLOC, "PREALLOC"}) | |
66 | ||
3f7de037 | 67 | #define BTRFS_GROUP_FLAGS \ |
e112e2b4 LB |
68 | { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \ |
69 | { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ | |
70 | { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ | |
71 | { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \ | |
72 | { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \ | |
73 | { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \ | |
74 | { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ | |
75 | { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \ | |
76 | { BTRFS_BLOCK_GROUP_RAID6, "RAID6"} | |
3f7de037 | 77 | |
b94417ea AJ |
78 | #define BTRFS_FSID_SIZE 16 |
79 | #define TP_STRUCT__entry_fsid __array(u8, fsid, BTRFS_FSID_SIZE) | |
bc074524 JM |
80 | |
81 | #define TP_fast_assign_fsid(fs_info) \ | |
b94417ea | 82 | memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE) |
bc074524 JM |
83 | |
84 | #define TP_STRUCT__entry_btrfs(args...) \ | |
85 | TP_STRUCT__entry( \ | |
86 | TP_STRUCT__entry_fsid \ | |
87 | args) | |
88 | #define TP_fast_assign_btrfs(fs_info, args...) \ | |
89 | TP_fast_assign( \ | |
90 | TP_fast_assign_fsid(fs_info); \ | |
91 | args) | |
92 | #define TP_printk_btrfs(fmt, args...) \ | |
93 | TP_printk("%pU: " fmt, __entry->fsid, args) | |
8c2a3ca2 | 94 | |
1abe9b8a | 95 | TRACE_EVENT(btrfs_transaction_commit, |
96 | ||
9a35b637 | 97 | TP_PROTO(const struct btrfs_root *root), |
1abe9b8a | 98 | |
99 | TP_ARGS(root), | |
100 | ||
bc074524 | 101 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 102 | __field( u64, generation ) |
103 | __field( u64, root_objectid ) | |
104 | ), | |
105 | ||
bc074524 | 106 | TP_fast_assign_btrfs(root->fs_info, |
1abe9b8a | 107 | __entry->generation = root->fs_info->generation; |
108 | __entry->root_objectid = root->root_key.objectid; | |
109 | ), | |
110 | ||
bc074524 | 111 | TP_printk_btrfs("root = %llu(%s), gen = %llu", |
1abe9b8a | 112 | show_root_type(__entry->root_objectid), |
113 | (unsigned long long)__entry->generation) | |
114 | ); | |
115 | ||
116 | DECLARE_EVENT_CLASS(btrfs__inode, | |
117 | ||
9a35b637 | 118 | TP_PROTO(const struct inode *inode), |
1abe9b8a | 119 | |
120 | TP_ARGS(inode), | |
121 | ||
bc074524 | 122 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 123 | __field( ino_t, ino ) |
124 | __field( blkcnt_t, blocks ) | |
125 | __field( u64, disk_i_size ) | |
126 | __field( u64, generation ) | |
127 | __field( u64, last_trans ) | |
128 | __field( u64, logged_trans ) | |
129 | __field( u64, root_objectid ) | |
130 | ), | |
131 | ||
bc074524 | 132 | TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), |
1abe9b8a | 133 | __entry->ino = inode->i_ino; |
134 | __entry->blocks = inode->i_blocks; | |
135 | __entry->disk_i_size = BTRFS_I(inode)->disk_i_size; | |
136 | __entry->generation = BTRFS_I(inode)->generation; | |
137 | __entry->last_trans = BTRFS_I(inode)->last_trans; | |
138 | __entry->logged_trans = BTRFS_I(inode)->logged_trans; | |
139 | __entry->root_objectid = | |
140 | BTRFS_I(inode)->root->root_key.objectid; | |
141 | ), | |
142 | ||
562a7a07 DS |
143 | TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%lu blocks=%llu " |
144 | "disk_i_size=%llu last_trans=%llu logged_trans=%llu", | |
1abe9b8a | 145 | show_root_type(__entry->root_objectid), |
146 | (unsigned long long)__entry->generation, | |
147 | (unsigned long)__entry->ino, | |
148 | (unsigned long long)__entry->blocks, | |
149 | (unsigned long long)__entry->disk_i_size, | |
150 | (unsigned long long)__entry->last_trans, | |
151 | (unsigned long long)__entry->logged_trans) | |
152 | ); | |
153 | ||
154 | DEFINE_EVENT(btrfs__inode, btrfs_inode_new, | |
155 | ||
9a35b637 | 156 | TP_PROTO(const struct inode *inode), |
1abe9b8a | 157 | |
158 | TP_ARGS(inode) | |
159 | ); | |
160 | ||
161 | DEFINE_EVENT(btrfs__inode, btrfs_inode_request, | |
162 | ||
9a35b637 | 163 | TP_PROTO(const struct inode *inode), |
1abe9b8a | 164 | |
165 | TP_ARGS(inode) | |
166 | ); | |
167 | ||
168 | DEFINE_EVENT(btrfs__inode, btrfs_inode_evict, | |
169 | ||
9a35b637 | 170 | TP_PROTO(const struct inode *inode), |
1abe9b8a | 171 | |
172 | TP_ARGS(inode) | |
173 | ); | |
174 | ||
175 | #define __show_map_type(type) \ | |
7f34b746 | 176 | __print_symbolic_u64(type, \ |
1abe9b8a | 177 | { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \ |
178 | { EXTENT_MAP_HOLE, "HOLE" }, \ | |
179 | { EXTENT_MAP_INLINE, "INLINE" }, \ | |
180 | { EXTENT_MAP_DELALLOC, "DELALLOC" }) | |
181 | ||
182 | #define show_map_type(type) \ | |
183 | type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type) | |
184 | ||
185 | #define show_map_flags(flag) \ | |
186 | __print_flags(flag, "|", \ | |
254a2d14 LB |
187 | { (1 << EXTENT_FLAG_PINNED), "PINNED" },\ |
188 | { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\ | |
189 | { (1 << EXTENT_FLAG_VACANCY), "VACANCY" },\ | |
190 | { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\ | |
191 | { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\ | |
192 | { (1 << EXTENT_FLAG_FILLING), "FILLING" },\ | |
193 | { (1 << EXTENT_FLAG_FS_MAPPING), "FS_MAPPING" }) | |
1abe9b8a | 194 | |
4cd8587c | 195 | TRACE_EVENT_CONDITION(btrfs_get_extent, |
1abe9b8a | 196 | |
9a35b637 JM |
197 | TP_PROTO(const struct btrfs_root *root, const struct btrfs_inode *inode, |
198 | const struct extent_map *map), | |
1abe9b8a | 199 | |
92a1bf76 | 200 | TP_ARGS(root, inode, map), |
1abe9b8a | 201 | |
4cd8587c SR |
202 | TP_CONDITION(map), |
203 | ||
bc074524 | 204 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 205 | __field( u64, root_objectid ) |
92a1bf76 | 206 | __field( u64, ino ) |
1abe9b8a | 207 | __field( u64, start ) |
208 | __field( u64, len ) | |
209 | __field( u64, orig_start ) | |
210 | __field( u64, block_start ) | |
211 | __field( u64, block_len ) | |
212 | __field( unsigned long, flags ) | |
213 | __field( int, refs ) | |
214 | __field( unsigned int, compress_type ) | |
215 | ), | |
216 | ||
bc074524 | 217 | TP_fast_assign_btrfs(root->fs_info, |
1abe9b8a | 218 | __entry->root_objectid = root->root_key.objectid; |
92a1bf76 LB |
219 | __entry->ino = btrfs_ino(inode); |
220 | __entry->start = map->start; | |
1abe9b8a | 221 | __entry->len = map->len; |
222 | __entry->orig_start = map->orig_start; | |
223 | __entry->block_start = map->block_start; | |
224 | __entry->block_len = map->block_len; | |
225 | __entry->flags = map->flags; | |
490b54d6 | 226 | __entry->refs = refcount_read(&map->refs); |
1abe9b8a | 227 | __entry->compress_type = map->compress_type; |
228 | ), | |
229 | ||
562a7a07 DS |
230 | TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu " |
231 | "orig_start=%llu block_start=%llu(%s) " | |
232 | "block_len=%llu flags=%s refs=%u " | |
233 | "compress_type=%u", | |
1abe9b8a | 234 | show_root_type(__entry->root_objectid), |
92a1bf76 | 235 | (unsigned long long)__entry->ino, |
1abe9b8a | 236 | (unsigned long long)__entry->start, |
237 | (unsigned long long)__entry->len, | |
238 | (unsigned long long)__entry->orig_start, | |
239 | show_map_type(__entry->block_start), | |
240 | (unsigned long long)__entry->block_len, | |
241 | show_map_flags(__entry->flags), | |
242 | __entry->refs, __entry->compress_type) | |
243 | ); | |
244 | ||
09ed2f16 LB |
245 | /* file extent item */ |
246 | DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular, | |
247 | ||
248 | TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, | |
249 | struct btrfs_file_extent_item *fi, u64 start), | |
250 | ||
251 | TP_ARGS(bi, l, fi, start), | |
252 | ||
253 | TP_STRUCT__entry_btrfs( | |
254 | __field( u64, root_obj ) | |
255 | __field( u64, ino ) | |
256 | __field( loff_t, isize ) | |
257 | __field( u64, disk_isize ) | |
258 | __field( u64, num_bytes ) | |
259 | __field( u64, ram_bytes ) | |
260 | __field( u64, disk_bytenr ) | |
261 | __field( u64, disk_num_bytes ) | |
262 | __field( u64, extent_offset ) | |
263 | __field( u8, extent_type ) | |
264 | __field( u8, compression ) | |
265 | __field( u64, extent_start ) | |
266 | __field( u64, extent_end ) | |
267 | ), | |
268 | ||
269 | TP_fast_assign_btrfs(bi->root->fs_info, | |
270 | __entry->root_obj = bi->root->objectid; | |
271 | __entry->ino = btrfs_ino(bi); | |
272 | __entry->isize = bi->vfs_inode.i_size; | |
273 | __entry->disk_isize = bi->disk_i_size; | |
274 | __entry->num_bytes = btrfs_file_extent_num_bytes(l, fi); | |
275 | __entry->ram_bytes = btrfs_file_extent_ram_bytes(l, fi); | |
276 | __entry->disk_bytenr = btrfs_file_extent_disk_bytenr(l, fi); | |
277 | __entry->disk_num_bytes = btrfs_file_extent_disk_num_bytes(l, fi); | |
278 | __entry->extent_offset = btrfs_file_extent_offset(l, fi); | |
279 | __entry->extent_type = btrfs_file_extent_type(l, fi); | |
280 | __entry->compression = btrfs_file_extent_compression(l, fi); | |
281 | __entry->extent_start = start; | |
282 | __entry->extent_end = (start + __entry->num_bytes); | |
283 | ), | |
284 | ||
285 | TP_printk_btrfs( | |
286 | "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu " | |
287 | "file extent range=[%llu %llu] " | |
288 | "(num_bytes=%llu ram_bytes=%llu disk_bytenr=%llu " | |
289 | "disk_num_bytes=%llu extent_offset=%llu type=%s " | |
290 | "compression=%u", | |
291 | show_root_type(__entry->root_obj), __entry->ino, | |
292 | __entry->isize, | |
293 | __entry->disk_isize, __entry->extent_start, | |
294 | __entry->extent_end, __entry->num_bytes, __entry->ram_bytes, | |
295 | __entry->disk_bytenr, __entry->disk_num_bytes, | |
296 | __entry->extent_offset, show_fi_type(__entry->extent_type), | |
297 | __entry->compression) | |
298 | ); | |
299 | ||
300 | DECLARE_EVENT_CLASS( | |
301 | btrfs__file_extent_item_inline, | |
302 | ||
303 | TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, | |
304 | struct btrfs_file_extent_item *fi, int slot, u64 start), | |
305 | ||
306 | TP_ARGS(bi, l, fi, slot, start), | |
307 | ||
308 | TP_STRUCT__entry_btrfs( | |
309 | __field( u64, root_obj ) | |
310 | __field( u64, ino ) | |
311 | __field( loff_t, isize ) | |
312 | __field( u64, disk_isize ) | |
313 | __field( u8, extent_type ) | |
314 | __field( u8, compression ) | |
315 | __field( u64, extent_start ) | |
316 | __field( u64, extent_end ) | |
317 | ), | |
318 | ||
319 | TP_fast_assign_btrfs( | |
320 | bi->root->fs_info, | |
321 | __entry->root_obj = bi->root->objectid; | |
322 | __entry->ino = btrfs_ino(bi); | |
323 | __entry->isize = bi->vfs_inode.i_size; | |
324 | __entry->disk_isize = bi->disk_i_size; | |
325 | __entry->extent_type = btrfs_file_extent_type(l, fi); | |
326 | __entry->compression = btrfs_file_extent_compression(l, fi); | |
327 | __entry->extent_start = start; | |
328 | __entry->extent_end = (start + btrfs_file_extent_inline_len(l, slot, fi)); | |
329 | ), | |
330 | ||
331 | TP_printk_btrfs( | |
332 | "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu " | |
333 | "file extent range=[%llu %llu] " | |
334 | "extent_type=%s compression=%u", | |
335 | show_root_type(__entry->root_obj), __entry->ino, __entry->isize, | |
336 | __entry->disk_isize, __entry->extent_start, | |
337 | __entry->extent_end, show_fi_type(__entry->extent_type), | |
338 | __entry->compression) | |
339 | ); | |
340 | ||
341 | DEFINE_EVENT( | |
342 | btrfs__file_extent_item_regular, btrfs_get_extent_show_fi_regular, | |
343 | ||
344 | TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, | |
345 | struct btrfs_file_extent_item *fi, u64 start), | |
346 | ||
347 | TP_ARGS(bi, l, fi, start) | |
348 | ); | |
349 | ||
350 | DEFINE_EVENT( | |
351 | btrfs__file_extent_item_regular, btrfs_truncate_show_fi_regular, | |
352 | ||
353 | TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, | |
354 | struct btrfs_file_extent_item *fi, u64 start), | |
355 | ||
356 | TP_ARGS(bi, l, fi, start) | |
357 | ); | |
358 | ||
359 | DEFINE_EVENT( | |
360 | btrfs__file_extent_item_inline, btrfs_get_extent_show_fi_inline, | |
361 | ||
362 | TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, | |
363 | struct btrfs_file_extent_item *fi, int slot, u64 start), | |
364 | ||
365 | TP_ARGS(bi, l, fi, slot, start) | |
366 | ); | |
367 | ||
368 | DEFINE_EVENT( | |
369 | btrfs__file_extent_item_inline, btrfs_truncate_show_fi_inline, | |
370 | ||
371 | TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, | |
372 | struct btrfs_file_extent_item *fi, int slot, u64 start), | |
373 | ||
374 | TP_ARGS(bi, l, fi, slot, start) | |
375 | ); | |
376 | ||
9d04a8ce LB |
377 | #define show_ordered_flags(flags) \ |
378 | __print_flags(flags, "|", \ | |
379 | { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \ | |
380 | { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \ | |
381 | { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \ | |
382 | { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \ | |
383 | { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \ | |
384 | { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \ | |
385 | { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \ | |
386 | { (1 << BTRFS_ORDERED_UPDATED_ISIZE), "UPDATED_ISIZE" }, \ | |
792ddef0 LB |
387 | { (1 << BTRFS_ORDERED_LOGGED_CSUM), "LOGGED_CSUM" }, \ |
388 | { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" }) | |
e112e2b4 | 389 | |
1abe9b8a | 390 | |
391 | DECLARE_EVENT_CLASS(btrfs__ordered_extent, | |
392 | ||
9a35b637 JM |
393 | TP_PROTO(const struct inode *inode, |
394 | const struct btrfs_ordered_extent *ordered), | |
1abe9b8a | 395 | |
396 | TP_ARGS(inode, ordered), | |
397 | ||
bc074524 | 398 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 399 | __field( ino_t, ino ) |
400 | __field( u64, file_offset ) | |
401 | __field( u64, start ) | |
402 | __field( u64, len ) | |
403 | __field( u64, disk_len ) | |
404 | __field( u64, bytes_left ) | |
405 | __field( unsigned long, flags ) | |
406 | __field( int, compress_type ) | |
407 | __field( int, refs ) | |
408 | __field( u64, root_objectid ) | |
78566548 | 409 | __field( u64, truncated_len ) |
1abe9b8a | 410 | ), |
411 | ||
bc074524 | 412 | TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), |
1abe9b8a | 413 | __entry->ino = inode->i_ino; |
414 | __entry->file_offset = ordered->file_offset; | |
415 | __entry->start = ordered->start; | |
416 | __entry->len = ordered->len; | |
417 | __entry->disk_len = ordered->disk_len; | |
418 | __entry->bytes_left = ordered->bytes_left; | |
419 | __entry->flags = ordered->flags; | |
420 | __entry->compress_type = ordered->compress_type; | |
e76edab7 | 421 | __entry->refs = refcount_read(&ordered->refs); |
1abe9b8a | 422 | __entry->root_objectid = |
423 | BTRFS_I(inode)->root->root_key.objectid; | |
78566548 | 424 | __entry->truncated_len = ordered->truncated_len; |
1abe9b8a | 425 | ), |
426 | ||
562a7a07 DS |
427 | TP_printk_btrfs("root=%llu(%s) ino=%llu file_offset=%llu " |
428 | "start=%llu len=%llu disk_len=%llu " | |
429 | "truncated_len=%llu " | |
430 | "bytes_left=%llu flags=%s compress_type=%d " | |
431 | "refs=%d", | |
1abe9b8a | 432 | show_root_type(__entry->root_objectid), |
433 | (unsigned long long)__entry->ino, | |
434 | (unsigned long long)__entry->file_offset, | |
435 | (unsigned long long)__entry->start, | |
436 | (unsigned long long)__entry->len, | |
437 | (unsigned long long)__entry->disk_len, | |
78566548 | 438 | (unsigned long long)__entry->truncated_len, |
1abe9b8a | 439 | (unsigned long long)__entry->bytes_left, |
440 | show_ordered_flags(__entry->flags), | |
441 | __entry->compress_type, __entry->refs) | |
442 | ); | |
443 | ||
444 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add, | |
445 | ||
9a35b637 JM |
446 | TP_PROTO(const struct inode *inode, |
447 | const struct btrfs_ordered_extent *ordered), | |
1abe9b8a | 448 | |
449 | TP_ARGS(inode, ordered) | |
450 | ); | |
451 | ||
452 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove, | |
453 | ||
9a35b637 JM |
454 | TP_PROTO(const struct inode *inode, |
455 | const struct btrfs_ordered_extent *ordered), | |
1abe9b8a | 456 | |
457 | TP_ARGS(inode, ordered) | |
458 | ); | |
459 | ||
460 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start, | |
461 | ||
9a35b637 JM |
462 | TP_PROTO(const struct inode *inode, |
463 | const struct btrfs_ordered_extent *ordered), | |
1abe9b8a | 464 | |
465 | TP_ARGS(inode, ordered) | |
466 | ); | |
467 | ||
468 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put, | |
469 | ||
9a35b637 JM |
470 | TP_PROTO(const struct inode *inode, |
471 | const struct btrfs_ordered_extent *ordered), | |
1abe9b8a | 472 | |
473 | TP_ARGS(inode, ordered) | |
474 | ); | |
475 | ||
476 | DECLARE_EVENT_CLASS(btrfs__writepage, | |
477 | ||
9a35b637 JM |
478 | TP_PROTO(const struct page *page, const struct inode *inode, |
479 | const struct writeback_control *wbc), | |
1abe9b8a | 480 | |
481 | TP_ARGS(page, inode, wbc), | |
482 | ||
bc074524 | 483 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 484 | __field( ino_t, ino ) |
485 | __field( pgoff_t, index ) | |
486 | __field( long, nr_to_write ) | |
487 | __field( long, pages_skipped ) | |
488 | __field( loff_t, range_start ) | |
489 | __field( loff_t, range_end ) | |
1abe9b8a | 490 | __field( char, for_kupdate ) |
491 | __field( char, for_reclaim ) | |
492 | __field( char, range_cyclic ) | |
493 | __field( pgoff_t, writeback_index ) | |
494 | __field( u64, root_objectid ) | |
495 | ), | |
496 | ||
bc074524 | 497 | TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), |
1abe9b8a | 498 | __entry->ino = inode->i_ino; |
499 | __entry->index = page->index; | |
500 | __entry->nr_to_write = wbc->nr_to_write; | |
501 | __entry->pages_skipped = wbc->pages_skipped; | |
502 | __entry->range_start = wbc->range_start; | |
503 | __entry->range_end = wbc->range_end; | |
1abe9b8a | 504 | __entry->for_kupdate = wbc->for_kupdate; |
505 | __entry->for_reclaim = wbc->for_reclaim; | |
506 | __entry->range_cyclic = wbc->range_cyclic; | |
507 | __entry->writeback_index = inode->i_mapping->writeback_index; | |
508 | __entry->root_objectid = | |
509 | BTRFS_I(inode)->root->root_key.objectid; | |
510 | ), | |
511 | ||
562a7a07 DS |
512 | TP_printk_btrfs("root=%llu(%s) ino=%lu page_index=%lu " |
513 | "nr_to_write=%ld pages_skipped=%ld range_start=%llu " | |
514 | "range_end=%llu for_kupdate=%d " | |
515 | "for_reclaim=%d range_cyclic=%d writeback_index=%lu", | |
1abe9b8a | 516 | show_root_type(__entry->root_objectid), |
517 | (unsigned long)__entry->ino, __entry->index, | |
518 | __entry->nr_to_write, __entry->pages_skipped, | |
519 | __entry->range_start, __entry->range_end, | |
846d5a09 | 520 | __entry->for_kupdate, |
1abe9b8a | 521 | __entry->for_reclaim, __entry->range_cyclic, |
522 | (unsigned long)__entry->writeback_index) | |
523 | ); | |
524 | ||
525 | DEFINE_EVENT(btrfs__writepage, __extent_writepage, | |
526 | ||
9a35b637 JM |
527 | TP_PROTO(const struct page *page, const struct inode *inode, |
528 | const struct writeback_control *wbc), | |
1abe9b8a | 529 | |
530 | TP_ARGS(page, inode, wbc) | |
531 | ); | |
532 | ||
533 | TRACE_EVENT(btrfs_writepage_end_io_hook, | |
534 | ||
9a35b637 | 535 | TP_PROTO(const struct page *page, u64 start, u64 end, int uptodate), |
1abe9b8a | 536 | |
537 | TP_ARGS(page, start, end, uptodate), | |
538 | ||
bc074524 | 539 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 540 | __field( ino_t, ino ) |
541 | __field( pgoff_t, index ) | |
542 | __field( u64, start ) | |
543 | __field( u64, end ) | |
544 | __field( int, uptodate ) | |
545 | __field( u64, root_objectid ) | |
546 | ), | |
547 | ||
bc074524 | 548 | TP_fast_assign_btrfs(btrfs_sb(page->mapping->host->i_sb), |
1abe9b8a | 549 | __entry->ino = page->mapping->host->i_ino; |
550 | __entry->index = page->index; | |
551 | __entry->start = start; | |
552 | __entry->end = end; | |
553 | __entry->uptodate = uptodate; | |
554 | __entry->root_objectid = | |
555 | BTRFS_I(page->mapping->host)->root->root_key.objectid; | |
556 | ), | |
557 | ||
562a7a07 DS |
558 | TP_printk_btrfs("root=%llu(%s) ino=%lu page_index=%lu start=%llu " |
559 | "end=%llu uptodate=%d", | |
1abe9b8a | 560 | show_root_type(__entry->root_objectid), |
561 | (unsigned long)__entry->ino, (unsigned long)__entry->index, | |
562 | (unsigned long long)__entry->start, | |
563 | (unsigned long long)__entry->end, __entry->uptodate) | |
564 | ); | |
565 | ||
566 | TRACE_EVENT(btrfs_sync_file, | |
567 | ||
9a35b637 | 568 | TP_PROTO(const struct file *file, int datasync), |
1abe9b8a | 569 | |
570 | TP_ARGS(file, datasync), | |
571 | ||
bc074524 | 572 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 573 | __field( ino_t, ino ) |
574 | __field( ino_t, parent ) | |
575 | __field( int, datasync ) | |
576 | __field( u64, root_objectid ) | |
577 | ), | |
578 | ||
579 | TP_fast_assign( | |
9a35b637 JM |
580 | const struct dentry *dentry = file->f_path.dentry; |
581 | const struct inode *inode = d_inode(dentry); | |
1abe9b8a | 582 | |
bc074524 | 583 | TP_fast_assign_fsid(btrfs_sb(file->f_path.dentry->d_sb)); |
1abe9b8a | 584 | __entry->ino = inode->i_ino; |
2b0143b5 | 585 | __entry->parent = d_inode(dentry->d_parent)->i_ino; |
1abe9b8a | 586 | __entry->datasync = datasync; |
587 | __entry->root_objectid = | |
588 | BTRFS_I(inode)->root->root_key.objectid; | |
589 | ), | |
590 | ||
562a7a07 | 591 | TP_printk_btrfs("root=%llu(%s) ino=%ld parent=%ld datasync=%d", |
1abe9b8a | 592 | show_root_type(__entry->root_objectid), |
593 | (unsigned long)__entry->ino, (unsigned long)__entry->parent, | |
594 | __entry->datasync) | |
595 | ); | |
596 | ||
597 | TRACE_EVENT(btrfs_sync_fs, | |
598 | ||
9a35b637 | 599 | TP_PROTO(const struct btrfs_fs_info *fs_info, int wait), |
1abe9b8a | 600 | |
bc074524 | 601 | TP_ARGS(fs_info, wait), |
1abe9b8a | 602 | |
bc074524 | 603 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 604 | __field( int, wait ) |
605 | ), | |
606 | ||
bc074524 | 607 | TP_fast_assign_btrfs(fs_info, |
1abe9b8a | 608 | __entry->wait = wait; |
609 | ), | |
610 | ||
bc074524 | 611 | TP_printk_btrfs("wait = %d", __entry->wait) |
1abe9b8a | 612 | ); |
613 | ||
c83f8eff JB |
614 | TRACE_EVENT(btrfs_add_block_group, |
615 | ||
9a35b637 JM |
616 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
617 | const struct btrfs_block_group_cache *block_group, int create), | |
c83f8eff JB |
618 | |
619 | TP_ARGS(fs_info, block_group, create), | |
620 | ||
621 | TP_STRUCT__entry( | |
b94417ea | 622 | __array( u8, fsid, BTRFS_FSID_SIZE ) |
c83f8eff JB |
623 | __field( u64, offset ) |
624 | __field( u64, size ) | |
625 | __field( u64, flags ) | |
626 | __field( u64, bytes_used ) | |
627 | __field( u64, bytes_super ) | |
628 | __field( int, create ) | |
629 | ), | |
630 | ||
631 | TP_fast_assign( | |
b94417ea | 632 | memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE); |
c83f8eff JB |
633 | __entry->offset = block_group->key.objectid; |
634 | __entry->size = block_group->key.offset; | |
635 | __entry->flags = block_group->flags; | |
636 | __entry->bytes_used = | |
637 | btrfs_block_group_used(&block_group->item); | |
638 | __entry->bytes_super = block_group->bytes_super; | |
639 | __entry->create = create; | |
640 | ), | |
641 | ||
562a7a07 DS |
642 | TP_printk("%pU: block_group offset=%llu size=%llu " |
643 | "flags=%llu(%s) bytes_used=%llu bytes_super=%llu " | |
644 | "create=%d", __entry->fsid, | |
c83f8eff JB |
645 | (unsigned long long)__entry->offset, |
646 | (unsigned long long)__entry->size, | |
647 | (unsigned long long)__entry->flags, | |
648 | __print_flags((unsigned long)__entry->flags, "|", | |
649 | BTRFS_GROUP_FLAGS), | |
650 | (unsigned long long)__entry->bytes_used, | |
651 | (unsigned long long)__entry->bytes_super, __entry->create) | |
652 | ); | |
653 | ||
1abe9b8a | 654 | #define show_ref_action(action) \ |
655 | __print_symbolic(action, \ | |
656 | { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \ | |
657 | { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \ | |
658 | { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \ | |
659 | { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" }) | |
660 | ||
661 | ||
599c75ec | 662 | DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref, |
1abe9b8a | 663 | |
9a35b637 JM |
664 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
665 | const struct btrfs_delayed_ref_node *ref, | |
666 | const struct btrfs_delayed_tree_ref *full_ref, | |
1abe9b8a | 667 | int action), |
668 | ||
bc074524 | 669 | TP_ARGS(fs_info, ref, full_ref, action), |
1abe9b8a | 670 | |
bc074524 | 671 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 672 | __field( u64, bytenr ) |
673 | __field( u64, num_bytes ) | |
674 | __field( int, action ) | |
675 | __field( u64, parent ) | |
676 | __field( u64, ref_root ) | |
677 | __field( int, level ) | |
678 | __field( int, type ) | |
dea7d76e | 679 | __field( u64, seq ) |
1abe9b8a | 680 | ), |
681 | ||
bc074524 | 682 | TP_fast_assign_btrfs(fs_info, |
1abe9b8a | 683 | __entry->bytenr = ref->bytenr; |
684 | __entry->num_bytes = ref->num_bytes; | |
685 | __entry->action = action; | |
686 | __entry->parent = full_ref->parent; | |
687 | __entry->ref_root = full_ref->root; | |
688 | __entry->level = full_ref->level; | |
689 | __entry->type = ref->type; | |
dea7d76e | 690 | __entry->seq = ref->seq; |
1abe9b8a | 691 | ), |
692 | ||
562a7a07 DS |
693 | TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " |
694 | "parent=%llu(%s) ref_root=%llu(%s) level=%d " | |
695 | "type=%s seq=%llu", | |
1abe9b8a | 696 | (unsigned long long)__entry->bytenr, |
697 | (unsigned long long)__entry->num_bytes, | |
698 | show_ref_action(__entry->action), | |
699 | show_root_type(__entry->parent), | |
700 | show_root_type(__entry->ref_root), | |
dea7d76e LB |
701 | __entry->level, show_ref_type(__entry->type), |
702 | (unsigned long long)__entry->seq) | |
1abe9b8a | 703 | ); |
704 | ||
599c75ec LB |
705 | DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref, |
706 | ||
9a35b637 JM |
707 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
708 | const struct btrfs_delayed_ref_node *ref, | |
709 | const struct btrfs_delayed_tree_ref *full_ref, | |
599c75ec LB |
710 | int action), |
711 | ||
bc074524 | 712 | TP_ARGS(fs_info, ref, full_ref, action) |
599c75ec LB |
713 | ); |
714 | ||
715 | DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref, | |
716 | ||
9a35b637 JM |
717 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
718 | const struct btrfs_delayed_ref_node *ref, | |
719 | const struct btrfs_delayed_tree_ref *full_ref, | |
599c75ec LB |
720 | int action), |
721 | ||
bc074524 | 722 | TP_ARGS(fs_info, ref, full_ref, action) |
599c75ec LB |
723 | ); |
724 | ||
725 | DECLARE_EVENT_CLASS(btrfs_delayed_data_ref, | |
1abe9b8a | 726 | |
9a35b637 JM |
727 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
728 | const struct btrfs_delayed_ref_node *ref, | |
729 | const struct btrfs_delayed_data_ref *full_ref, | |
1abe9b8a | 730 | int action), |
731 | ||
bc074524 | 732 | TP_ARGS(fs_info, ref, full_ref, action), |
1abe9b8a | 733 | |
bc074524 | 734 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 735 | __field( u64, bytenr ) |
736 | __field( u64, num_bytes ) | |
737 | __field( int, action ) | |
738 | __field( u64, parent ) | |
739 | __field( u64, ref_root ) | |
740 | __field( u64, owner ) | |
741 | __field( u64, offset ) | |
742 | __field( int, type ) | |
dea7d76e | 743 | __field( u64, seq ) |
1abe9b8a | 744 | ), |
745 | ||
bc074524 | 746 | TP_fast_assign_btrfs(fs_info, |
1abe9b8a | 747 | __entry->bytenr = ref->bytenr; |
748 | __entry->num_bytes = ref->num_bytes; | |
749 | __entry->action = action; | |
750 | __entry->parent = full_ref->parent; | |
751 | __entry->ref_root = full_ref->root; | |
752 | __entry->owner = full_ref->objectid; | |
753 | __entry->offset = full_ref->offset; | |
754 | __entry->type = ref->type; | |
dea7d76e | 755 | __entry->seq = ref->seq; |
1abe9b8a | 756 | ), |
757 | ||
562a7a07 DS |
758 | TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " |
759 | "parent=%llu(%s) ref_root=%llu(%s) owner=%llu " | |
760 | "offset=%llu type=%s seq=%llu", | |
1abe9b8a | 761 | (unsigned long long)__entry->bytenr, |
762 | (unsigned long long)__entry->num_bytes, | |
763 | show_ref_action(__entry->action), | |
764 | show_root_type(__entry->parent), | |
765 | show_root_type(__entry->ref_root), | |
766 | (unsigned long long)__entry->owner, | |
767 | (unsigned long long)__entry->offset, | |
dea7d76e LB |
768 | show_ref_type(__entry->type), |
769 | (unsigned long long)__entry->seq) | |
1abe9b8a | 770 | ); |
771 | ||
599c75ec LB |
772 | DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref, |
773 | ||
9a35b637 JM |
774 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
775 | const struct btrfs_delayed_ref_node *ref, | |
776 | const struct btrfs_delayed_data_ref *full_ref, | |
599c75ec LB |
777 | int action), |
778 | ||
bc074524 | 779 | TP_ARGS(fs_info, ref, full_ref, action) |
599c75ec LB |
780 | ); |
781 | ||
782 | DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref, | |
783 | ||
9a35b637 JM |
784 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
785 | const struct btrfs_delayed_ref_node *ref, | |
786 | const struct btrfs_delayed_data_ref *full_ref, | |
599c75ec LB |
787 | int action), |
788 | ||
bc074524 | 789 | TP_ARGS(fs_info, ref, full_ref, action) |
599c75ec LB |
790 | ); |
791 | ||
792 | DECLARE_EVENT_CLASS(btrfs_delayed_ref_head, | |
1abe9b8a | 793 | |
9a35b637 JM |
794 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
795 | const struct btrfs_delayed_ref_node *ref, | |
796 | const struct btrfs_delayed_ref_head *head_ref, | |
1abe9b8a | 797 | int action), |
798 | ||
bc074524 | 799 | TP_ARGS(fs_info, ref, head_ref, action), |
1abe9b8a | 800 | |
bc074524 | 801 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 802 | __field( u64, bytenr ) |
803 | __field( u64, num_bytes ) | |
804 | __field( int, action ) | |
805 | __field( int, is_data ) | |
806 | ), | |
807 | ||
bc074524 | 808 | TP_fast_assign_btrfs(fs_info, |
1abe9b8a | 809 | __entry->bytenr = ref->bytenr; |
810 | __entry->num_bytes = ref->num_bytes; | |
811 | __entry->action = action; | |
812 | __entry->is_data = head_ref->is_data; | |
813 | ), | |
814 | ||
562a7a07 | 815 | TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d", |
1abe9b8a | 816 | (unsigned long long)__entry->bytenr, |
817 | (unsigned long long)__entry->num_bytes, | |
818 | show_ref_action(__entry->action), | |
819 | __entry->is_data) | |
820 | ); | |
821 | ||
599c75ec LB |
822 | DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head, |
823 | ||
9a35b637 JM |
824 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
825 | const struct btrfs_delayed_ref_node *ref, | |
826 | const struct btrfs_delayed_ref_head *head_ref, | |
599c75ec LB |
827 | int action), |
828 | ||
bc074524 | 829 | TP_ARGS(fs_info, ref, head_ref, action) |
599c75ec LB |
830 | ); |
831 | ||
832 | DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head, | |
833 | ||
9a35b637 JM |
834 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
835 | const struct btrfs_delayed_ref_node *ref, | |
836 | const struct btrfs_delayed_ref_head *head_ref, | |
599c75ec LB |
837 | int action), |
838 | ||
bc074524 | 839 | TP_ARGS(fs_info, ref, head_ref, action) |
599c75ec LB |
840 | ); |
841 | ||
1abe9b8a | 842 | #define show_chunk_type(type) \ |
843 | __print_flags(type, "|", \ | |
844 | { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ | |
845 | { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ | |
846 | { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ | |
847 | { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ | |
848 | { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ | |
849 | { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ | |
e112e2b4 LB |
850 | { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ |
851 | { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \ | |
852 | { BTRFS_BLOCK_GROUP_RAID6, "RAID6" }) | |
1abe9b8a | 853 | |
854 | DECLARE_EVENT_CLASS(btrfs__chunk, | |
855 | ||
9a35b637 JM |
856 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
857 | const struct map_lookup *map, u64 offset, u64 size), | |
1abe9b8a | 858 | |
6bccf3ab | 859 | TP_ARGS(fs_info, map, offset, size), |
1abe9b8a | 860 | |
bc074524 | 861 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 862 | __field( int, num_stripes ) |
863 | __field( u64, type ) | |
864 | __field( int, sub_stripes ) | |
865 | __field( u64, offset ) | |
866 | __field( u64, size ) | |
867 | __field( u64, root_objectid ) | |
868 | ), | |
869 | ||
6bccf3ab | 870 | TP_fast_assign_btrfs(fs_info, |
1abe9b8a | 871 | __entry->num_stripes = map->num_stripes; |
872 | __entry->type = map->type; | |
873 | __entry->sub_stripes = map->sub_stripes; | |
874 | __entry->offset = offset; | |
875 | __entry->size = size; | |
6bccf3ab | 876 | __entry->root_objectid = fs_info->chunk_root->root_key.objectid; |
1abe9b8a | 877 | ), |
878 | ||
562a7a07 DS |
879 | TP_printk_btrfs("root=%llu(%s) offset=%llu size=%llu " |
880 | "num_stripes=%d sub_stripes=%d type=%s", | |
1abe9b8a | 881 | show_root_type(__entry->root_objectid), |
882 | (unsigned long long)__entry->offset, | |
883 | (unsigned long long)__entry->size, | |
884 | __entry->num_stripes, __entry->sub_stripes, | |
885 | show_chunk_type(__entry->type)) | |
886 | ); | |
887 | ||
888 | DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc, | |
889 | ||
9a35b637 JM |
890 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
891 | const struct map_lookup *map, u64 offset, u64 size), | |
1abe9b8a | 892 | |
6bccf3ab | 893 | TP_ARGS(fs_info, map, offset, size) |
1abe9b8a | 894 | ); |
895 | ||
896 | DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free, | |
897 | ||
9a35b637 JM |
898 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
899 | const struct map_lookup *map, u64 offset, u64 size), | |
1abe9b8a | 900 | |
6bccf3ab | 901 | TP_ARGS(fs_info, map, offset, size) |
1abe9b8a | 902 | ); |
903 | ||
904 | TRACE_EVENT(btrfs_cow_block, | |
905 | ||
9a35b637 JM |
906 | TP_PROTO(const struct btrfs_root *root, const struct extent_buffer *buf, |
907 | const struct extent_buffer *cow), | |
1abe9b8a | 908 | |
909 | TP_ARGS(root, buf, cow), | |
910 | ||
bc074524 | 911 | TP_STRUCT__entry_btrfs( |
1abe9b8a | 912 | __field( u64, root_objectid ) |
913 | __field( u64, buf_start ) | |
914 | __field( int, refs ) | |
915 | __field( u64, cow_start ) | |
916 | __field( int, buf_level ) | |
917 | __field( int, cow_level ) | |
918 | ), | |
919 | ||
bc074524 | 920 | TP_fast_assign_btrfs(root->fs_info, |
1abe9b8a | 921 | __entry->root_objectid = root->root_key.objectid; |
922 | __entry->buf_start = buf->start; | |
923 | __entry->refs = atomic_read(&buf->refs); | |
924 | __entry->cow_start = cow->start; | |
925 | __entry->buf_level = btrfs_header_level(buf); | |
926 | __entry->cow_level = btrfs_header_level(cow); | |
927 | ), | |
928 | ||
562a7a07 DS |
929 | TP_printk_btrfs("root=%llu(%s) refs=%d orig_buf=%llu " |
930 | "(orig_level=%d) cow_buf=%llu (cow_level=%d)", | |
1abe9b8a | 931 | show_root_type(__entry->root_objectid), |
932 | __entry->refs, | |
933 | (unsigned long long)__entry->buf_start, | |
934 | __entry->buf_level, | |
935 | (unsigned long long)__entry->cow_start, | |
936 | __entry->cow_level) | |
937 | ); | |
938 | ||
8c2a3ca2 JB |
939 | TRACE_EVENT(btrfs_space_reservation, |
940 | ||
9a35b637 | 941 | TP_PROTO(const struct btrfs_fs_info *fs_info, char *type, u64 val, |
8c2a3ca2 JB |
942 | u64 bytes, int reserve), |
943 | ||
944 | TP_ARGS(fs_info, type, val, bytes, reserve), | |
945 | ||
bc074524 | 946 | TP_STRUCT__entry_btrfs( |
8c2a3ca2 JB |
947 | __string( type, type ) |
948 | __field( u64, val ) | |
949 | __field( u64, bytes ) | |
950 | __field( int, reserve ) | |
951 | ), | |
952 | ||
bc074524 | 953 | TP_fast_assign_btrfs(fs_info, |
8c2a3ca2 JB |
954 | __assign_str(type, type); |
955 | __entry->val = val; | |
956 | __entry->bytes = bytes; | |
957 | __entry->reserve = reserve; | |
958 | ), | |
959 | ||
bc074524 JM |
960 | TP_printk_btrfs("%s: %Lu %s %Lu", __get_str(type), __entry->val, |
961 | __entry->reserve ? "reserve" : "release", | |
962 | __entry->bytes) | |
8c2a3ca2 JB |
963 | ); |
964 | ||
f376df2b JB |
965 | #define show_flush_action(action) \ |
966 | __print_symbolic(action, \ | |
967 | { BTRFS_RESERVE_NO_FLUSH, "BTRFS_RESERVE_NO_FLUSH"}, \ | |
968 | { BTRFS_RESERVE_FLUSH_LIMIT, "BTRFS_RESERVE_FLUSH_LIMIT"}, \ | |
969 | { BTRFS_RESERVE_FLUSH_ALL, "BTRFS_RESERVE_FLUSH_ALL"}) | |
970 | ||
971 | TRACE_EVENT(btrfs_trigger_flush, | |
972 | ||
9a35b637 | 973 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes, |
f376df2b JB |
974 | int flush, char *reason), |
975 | ||
976 | TP_ARGS(fs_info, flags, bytes, flush, reason), | |
977 | ||
978 | TP_STRUCT__entry( | |
b94417ea | 979 | __array( u8, fsid, BTRFS_FSID_SIZE ) |
f376df2b JB |
980 | __field( u64, flags ) |
981 | __field( u64, bytes ) | |
982 | __field( int, flush ) | |
983 | __string( reason, reason ) | |
984 | ), | |
985 | ||
986 | TP_fast_assign( | |
b94417ea | 987 | memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE); |
f376df2b JB |
988 | __entry->flags = flags; |
989 | __entry->bytes = bytes; | |
990 | __entry->flush = flush; | |
991 | __assign_str(reason, reason) | |
992 | ), | |
993 | ||
562a7a07 | 994 | TP_printk("%pU: %s: flush=%d(%s) flags=%llu(%s) bytes=%llu", |
f376df2b JB |
995 | __entry->fsid, __get_str(reason), __entry->flush, |
996 | show_flush_action(__entry->flush), | |
997 | (unsigned long long)__entry->flags, | |
998 | __print_flags((unsigned long)__entry->flags, "|", | |
999 | BTRFS_GROUP_FLAGS), | |
1000 | (unsigned long long)__entry->bytes) | |
1001 | ); | |
1002 | ||
1003 | #define show_flush_state(state) \ | |
1004 | __print_symbolic(state, \ | |
1005 | { FLUSH_DELAYED_ITEMS_NR, "FLUSH_DELAYED_ITEMS_NR"}, \ | |
1006 | { FLUSH_DELAYED_ITEMS, "FLUSH_DELAYED_ITEMS"}, \ | |
1007 | { FLUSH_DELALLOC, "FLUSH_DELALLOC"}, \ | |
1008 | { FLUSH_DELALLOC_WAIT, "FLUSH_DELALLOC_WAIT"}, \ | |
1009 | { ALLOC_CHUNK, "ALLOC_CHUNK"}, \ | |
1010 | { COMMIT_TRANS, "COMMIT_TRANS"}) | |
1011 | ||
1012 | TRACE_EVENT(btrfs_flush_space, | |
1013 | ||
9a35b637 | 1014 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 num_bytes, |
7bdd6277 | 1015 | int state, int ret), |
f376df2b | 1016 | |
7bdd6277 | 1017 | TP_ARGS(fs_info, flags, num_bytes, state, ret), |
f376df2b JB |
1018 | |
1019 | TP_STRUCT__entry( | |
b94417ea | 1020 | __array( u8, fsid, BTRFS_FSID_SIZE ) |
f376df2b JB |
1021 | __field( u64, flags ) |
1022 | __field( u64, num_bytes ) | |
f376df2b JB |
1023 | __field( int, state ) |
1024 | __field( int, ret ) | |
1025 | ), | |
1026 | ||
1027 | TP_fast_assign( | |
b94417ea | 1028 | memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE); |
f376df2b JB |
1029 | __entry->flags = flags; |
1030 | __entry->num_bytes = num_bytes; | |
f376df2b JB |
1031 | __entry->state = state; |
1032 | __entry->ret = ret; | |
1033 | ), | |
1034 | ||
7bdd6277 NB |
1035 | TP_printk("%pU: state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d", |
1036 | __entry->fsid, __entry->state, | |
f376df2b JB |
1037 | show_flush_state(__entry->state), |
1038 | (unsigned long long)__entry->flags, | |
1039 | __print_flags((unsigned long)__entry->flags, "|", | |
1040 | BTRFS_GROUP_FLAGS), | |
7bdd6277 | 1041 | (unsigned long long)__entry->num_bytes, __entry->ret) |
f376df2b JB |
1042 | ); |
1043 | ||
1abe9b8a | 1044 | DECLARE_EVENT_CLASS(btrfs__reserved_extent, |
1045 | ||
9a35b637 | 1046 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), |
1abe9b8a | 1047 | |
71ff6437 | 1048 | TP_ARGS(fs_info, start, len), |
1abe9b8a | 1049 | |
bc074524 | 1050 | TP_STRUCT__entry_btrfs( |
bc074524 JM |
1051 | __field( u64, start ) |
1052 | __field( u64, len ) | |
1abe9b8a | 1053 | ), |
1054 | ||
71ff6437 | 1055 | TP_fast_assign_btrfs(fs_info, |
1abe9b8a | 1056 | __entry->start = start; |
1057 | __entry->len = len; | |
1058 | ), | |
1059 | ||
562a7a07 | 1060 | TP_printk_btrfs("root=%llu(%s) start=%llu len=%llu", |
71ff6437 | 1061 | show_root_type(BTRFS_EXTENT_TREE_OBJECTID), |
1abe9b8a | 1062 | (unsigned long long)__entry->start, |
1063 | (unsigned long long)__entry->len) | |
1064 | ); | |
1065 | ||
1066 | DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc, | |
1067 | ||
9a35b637 | 1068 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), |
1abe9b8a | 1069 | |
71ff6437 | 1070 | TP_ARGS(fs_info, start, len) |
1abe9b8a | 1071 | ); |
1072 | ||
1073 | DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free, | |
1074 | ||
9a35b637 | 1075 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), |
1abe9b8a | 1076 | |
71ff6437 | 1077 | TP_ARGS(fs_info, start, len) |
1abe9b8a | 1078 | ); |
1079 | ||
3f7de037 JB |
1080 | TRACE_EVENT(find_free_extent, |
1081 | ||
9a35b637 JM |
1082 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, |
1083 | u64 empty_size, u64 data), | |
3f7de037 | 1084 | |
71ff6437 | 1085 | TP_ARGS(fs_info, num_bytes, empty_size, data), |
3f7de037 | 1086 | |
bc074524 | 1087 | TP_STRUCT__entry_btrfs( |
3f7de037 JB |
1088 | __field( u64, num_bytes ) |
1089 | __field( u64, empty_size ) | |
1090 | __field( u64, data ) | |
1091 | ), | |
1092 | ||
71ff6437 | 1093 | TP_fast_assign_btrfs(fs_info, |
3f7de037 JB |
1094 | __entry->num_bytes = num_bytes; |
1095 | __entry->empty_size = empty_size; | |
1096 | __entry->data = data; | |
1097 | ), | |
1098 | ||
562a7a07 | 1099 | TP_printk_btrfs("root=%Lu(%s) len=%Lu empty_size=%Lu flags=%Lu(%s)", |
71ff6437 | 1100 | show_root_type(BTRFS_EXTENT_TREE_OBJECTID), |
3f7de037 JB |
1101 | __entry->num_bytes, __entry->empty_size, __entry->data, |
1102 | __print_flags((unsigned long)__entry->data, "|", | |
1103 | BTRFS_GROUP_FLAGS)) | |
1104 | ); | |
1105 | ||
1106 | DECLARE_EVENT_CLASS(btrfs__reserve_extent, | |
1107 | ||
9a35b637 JM |
1108 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
1109 | const struct btrfs_block_group_cache *block_group, u64 start, | |
3f7de037 JB |
1110 | u64 len), |
1111 | ||
71ff6437 | 1112 | TP_ARGS(fs_info, block_group, start, len), |
3f7de037 | 1113 | |
bc074524 | 1114 | TP_STRUCT__entry_btrfs( |
3f7de037 JB |
1115 | __field( u64, bg_objectid ) |
1116 | __field( u64, flags ) | |
1117 | __field( u64, start ) | |
1118 | __field( u64, len ) | |
1119 | ), | |
1120 | ||
71ff6437 | 1121 | TP_fast_assign_btrfs(fs_info, |
3f7de037 JB |
1122 | __entry->bg_objectid = block_group->key.objectid; |
1123 | __entry->flags = block_group->flags; | |
1124 | __entry->start = start; | |
1125 | __entry->len = len; | |
1126 | ), | |
1127 | ||
562a7a07 DS |
1128 | TP_printk_btrfs("root=%Lu(%s) block_group=%Lu flags=%Lu(%s) " |
1129 | "start=%Lu len=%Lu", | |
71ff6437 JM |
1130 | show_root_type(BTRFS_EXTENT_TREE_OBJECTID), |
1131 | __entry->bg_objectid, | |
3f7de037 JB |
1132 | __entry->flags, __print_flags((unsigned long)__entry->flags, |
1133 | "|", BTRFS_GROUP_FLAGS), | |
1134 | __entry->start, __entry->len) | |
1135 | ); | |
1136 | ||
1137 | DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent, | |
1138 | ||
9a35b637 JM |
1139 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
1140 | const struct btrfs_block_group_cache *block_group, u64 start, | |
3f7de037 JB |
1141 | u64 len), |
1142 | ||
71ff6437 | 1143 | TP_ARGS(fs_info, block_group, start, len) |
3f7de037 JB |
1144 | ); |
1145 | ||
1146 | DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster, | |
1147 | ||
9a35b637 JM |
1148 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
1149 | const struct btrfs_block_group_cache *block_group, u64 start, | |
3f7de037 JB |
1150 | u64 len), |
1151 | ||
71ff6437 | 1152 | TP_ARGS(fs_info, block_group, start, len) |
3f7de037 JB |
1153 | ); |
1154 | ||
1155 | TRACE_EVENT(btrfs_find_cluster, | |
1156 | ||
9a35b637 | 1157 | TP_PROTO(const struct btrfs_block_group_cache *block_group, u64 start, |
3f7de037 JB |
1158 | u64 bytes, u64 empty_size, u64 min_bytes), |
1159 | ||
1160 | TP_ARGS(block_group, start, bytes, empty_size, min_bytes), | |
1161 | ||
bc074524 | 1162 | TP_STRUCT__entry_btrfs( |
3f7de037 JB |
1163 | __field( u64, bg_objectid ) |
1164 | __field( u64, flags ) | |
1165 | __field( u64, start ) | |
1166 | __field( u64, bytes ) | |
1167 | __field( u64, empty_size ) | |
1168 | __field( u64, min_bytes ) | |
1169 | ), | |
1170 | ||
bc074524 | 1171 | TP_fast_assign_btrfs(block_group->fs_info, |
3f7de037 JB |
1172 | __entry->bg_objectid = block_group->key.objectid; |
1173 | __entry->flags = block_group->flags; | |
1174 | __entry->start = start; | |
1175 | __entry->bytes = bytes; | |
1176 | __entry->empty_size = empty_size; | |
1177 | __entry->min_bytes = min_bytes; | |
1178 | ), | |
1179 | ||
562a7a07 DS |
1180 | TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) start=%Lu len=%Lu " |
1181 | "empty_size=%Lu min_bytes=%Lu", __entry->bg_objectid, | |
3f7de037 JB |
1182 | __entry->flags, |
1183 | __print_flags((unsigned long)__entry->flags, "|", | |
1184 | BTRFS_GROUP_FLAGS), __entry->start, | |
1185 | __entry->bytes, __entry->empty_size, __entry->min_bytes) | |
1186 | ); | |
1187 | ||
1188 | TRACE_EVENT(btrfs_failed_cluster_setup, | |
1189 | ||
9a35b637 | 1190 | TP_PROTO(const struct btrfs_block_group_cache *block_group), |
3f7de037 JB |
1191 | |
1192 | TP_ARGS(block_group), | |
1193 | ||
bc074524 | 1194 | TP_STRUCT__entry_btrfs( |
3f7de037 JB |
1195 | __field( u64, bg_objectid ) |
1196 | ), | |
1197 | ||
bc074524 | 1198 | TP_fast_assign_btrfs(block_group->fs_info, |
3f7de037 JB |
1199 | __entry->bg_objectid = block_group->key.objectid; |
1200 | ), | |
1201 | ||
562a7a07 | 1202 | TP_printk_btrfs("block_group=%Lu", __entry->bg_objectid) |
3f7de037 JB |
1203 | ); |
1204 | ||
1205 | TRACE_EVENT(btrfs_setup_cluster, | |
1206 | ||
9a35b637 JM |
1207 | TP_PROTO(const struct btrfs_block_group_cache *block_group, |
1208 | const struct btrfs_free_cluster *cluster, | |
1209 | u64 size, int bitmap), | |
3f7de037 JB |
1210 | |
1211 | TP_ARGS(block_group, cluster, size, bitmap), | |
1212 | ||
bc074524 | 1213 | TP_STRUCT__entry_btrfs( |
3f7de037 JB |
1214 | __field( u64, bg_objectid ) |
1215 | __field( u64, flags ) | |
1216 | __field( u64, start ) | |
1217 | __field( u64, max_size ) | |
1218 | __field( u64, size ) | |
1219 | __field( int, bitmap ) | |
1220 | ), | |
1221 | ||
bc074524 | 1222 | TP_fast_assign_btrfs(block_group->fs_info, |
3f7de037 JB |
1223 | __entry->bg_objectid = block_group->key.objectid; |
1224 | __entry->flags = block_group->flags; | |
1225 | __entry->start = cluster->window_start; | |
1226 | __entry->max_size = cluster->max_size; | |
1227 | __entry->size = size; | |
1228 | __entry->bitmap = bitmap; | |
1229 | ), | |
1230 | ||
562a7a07 DS |
1231 | TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) window_start=%Lu " |
1232 | "size=%Lu max_size=%Lu bitmap=%d", | |
3f7de037 JB |
1233 | __entry->bg_objectid, |
1234 | __entry->flags, | |
1235 | __print_flags((unsigned long)__entry->flags, "|", | |
1236 | BTRFS_GROUP_FLAGS), __entry->start, | |
1237 | __entry->size, __entry->max_size, __entry->bitmap) | |
1238 | ); | |
1239 | ||
143bede5 JM |
1240 | struct extent_state; |
1241 | TRACE_EVENT(alloc_extent_state, | |
1242 | ||
9a35b637 JM |
1243 | TP_PROTO(const struct extent_state *state, |
1244 | gfp_t mask, unsigned long IP), | |
143bede5 JM |
1245 | |
1246 | TP_ARGS(state, mask, IP), | |
1247 | ||
1248 | TP_STRUCT__entry( | |
9a35b637 | 1249 | __field(const struct extent_state *, state) |
143bede5 JM |
1250 | __field(gfp_t, mask) |
1251 | __field(unsigned long, ip) | |
1252 | ), | |
1253 | ||
1254 | TP_fast_assign( | |
1255 | __entry->state = state, | |
1256 | __entry->mask = mask, | |
1257 | __entry->ip = IP | |
1258 | ), | |
1259 | ||
562a7a07 | 1260 | TP_printk("state=%p mask=%s caller=%pS", __entry->state, |
9a35b637 | 1261 | show_gfp_flags(__entry->mask), (const void *)__entry->ip) |
143bede5 JM |
1262 | ); |
1263 | ||
1264 | TRACE_EVENT(free_extent_state, | |
1265 | ||
9a35b637 | 1266 | TP_PROTO(const struct extent_state *state, unsigned long IP), |
143bede5 JM |
1267 | |
1268 | TP_ARGS(state, IP), | |
1269 | ||
1270 | TP_STRUCT__entry( | |
9a35b637 | 1271 | __field(const struct extent_state *, state) |
143bede5 JM |
1272 | __field(unsigned long, ip) |
1273 | ), | |
1274 | ||
1275 | TP_fast_assign( | |
1276 | __entry->state = state, | |
1277 | __entry->ip = IP | |
1278 | ), | |
1279 | ||
562a7a07 | 1280 | TP_printk("state=%p caller=%pS", __entry->state, |
9a35b637 | 1281 | (const void *)__entry->ip) |
143bede5 JM |
1282 | ); |
1283 | ||
52483bc2 QW |
1284 | DECLARE_EVENT_CLASS(btrfs__work, |
1285 | ||
9a35b637 | 1286 | TP_PROTO(const struct btrfs_work *work), |
52483bc2 QW |
1287 | |
1288 | TP_ARGS(work), | |
1289 | ||
bc074524 | 1290 | TP_STRUCT__entry_btrfs( |
9a35b637 JM |
1291 | __field( const void *, work ) |
1292 | __field( const void *, wq ) | |
1293 | __field( const void *, func ) | |
1294 | __field( const void *, ordered_func ) | |
1295 | __field( const void *, ordered_free ) | |
1296 | __field( const void *, normal_work ) | |
52483bc2 QW |
1297 | ), |
1298 | ||
bc074524 | 1299 | TP_fast_assign_btrfs(btrfs_work_owner(work), |
52483bc2 QW |
1300 | __entry->work = work; |
1301 | __entry->wq = work->wq; | |
1302 | __entry->func = work->func; | |
1303 | __entry->ordered_func = work->ordered_func; | |
1304 | __entry->ordered_free = work->ordered_free; | |
b38a6258 | 1305 | __entry->normal_work = &work->normal_work; |
52483bc2 QW |
1306 | ), |
1307 | ||
562a7a07 DS |
1308 | TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%pf ordered_func=%p " |
1309 | "ordered_free=%p", | |
b38a6258 LB |
1310 | __entry->work, __entry->normal_work, __entry->wq, |
1311 | __entry->func, __entry->ordered_func, __entry->ordered_free) | |
52483bc2 QW |
1312 | ); |
1313 | ||
ac0c7cf8 DS |
1314 | /* |
1315 | * For situiations when the work is freed, we pass fs_info and a tag that that | |
1316 | * matches address of the work structure so it can be paired with the | |
1317 | * scheduling event. | |
1318 | */ | |
52483bc2 QW |
1319 | DECLARE_EVENT_CLASS(btrfs__work__done, |
1320 | ||
9a35b637 | 1321 | TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag), |
52483bc2 | 1322 | |
ac0c7cf8 | 1323 | TP_ARGS(fs_info, wtag), |
52483bc2 | 1324 | |
bc074524 | 1325 | TP_STRUCT__entry_btrfs( |
9a35b637 | 1326 | __field( const void *, wtag ) |
52483bc2 QW |
1327 | ), |
1328 | ||
ac0c7cf8 DS |
1329 | TP_fast_assign_btrfs(fs_info, |
1330 | __entry->wtag = wtag; | |
52483bc2 QW |
1331 | ), |
1332 | ||
ac0c7cf8 | 1333 | TP_printk_btrfs("work->%p", __entry->wtag) |
52483bc2 QW |
1334 | ); |
1335 | ||
1336 | DEFINE_EVENT(btrfs__work, btrfs_work_queued, | |
1337 | ||
9a35b637 | 1338 | TP_PROTO(const struct btrfs_work *work), |
52483bc2 QW |
1339 | |
1340 | TP_ARGS(work) | |
1341 | ); | |
1342 | ||
1343 | DEFINE_EVENT(btrfs__work, btrfs_work_sched, | |
1344 | ||
9a35b637 | 1345 | TP_PROTO(const struct btrfs_work *work), |
52483bc2 QW |
1346 | |
1347 | TP_ARGS(work) | |
1348 | ); | |
1349 | ||
52483bc2 QW |
1350 | DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done, |
1351 | ||
9a35b637 | 1352 | TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag), |
52483bc2 | 1353 | |
ac0c7cf8 | 1354 | TP_ARGS(fs_info, wtag) |
52483bc2 QW |
1355 | ); |
1356 | ||
1357 | DEFINE_EVENT(btrfs__work, btrfs_ordered_sched, | |
1358 | ||
9a35b637 | 1359 | TP_PROTO(const struct btrfs_work *work), |
52483bc2 QW |
1360 | |
1361 | TP_ARGS(work) | |
1362 | ); | |
1363 | ||
c3a46891 QW |
1364 | DECLARE_EVENT_CLASS(btrfs__workqueue, |
1365 | ||
9a35b637 JM |
1366 | TP_PROTO(const struct __btrfs_workqueue *wq, |
1367 | const char *name, int high), | |
c3a46891 QW |
1368 | |
1369 | TP_ARGS(wq, name, high), | |
1370 | ||
bc074524 | 1371 | TP_STRUCT__entry_btrfs( |
9a35b637 | 1372 | __field( const void *, wq ) |
c3a46891 QW |
1373 | __string( name, name ) |
1374 | __field( int , high ) | |
1375 | ), | |
1376 | ||
bc074524 | 1377 | TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), |
c3a46891 QW |
1378 | __entry->wq = wq; |
1379 | __assign_str(name, name); | |
1380 | __entry->high = high; | |
1381 | ), | |
1382 | ||
562a7a07 | 1383 | TP_printk_btrfs("name=%s%s wq=%p", __get_str(name), |
c3a46891 QW |
1384 | __print_flags(__entry->high, "", |
1385 | {(WQ_HIGHPRI), "-high"}), | |
1386 | __entry->wq) | |
1387 | ); | |
1388 | ||
1389 | DEFINE_EVENT(btrfs__workqueue, btrfs_workqueue_alloc, | |
1390 | ||
9a35b637 JM |
1391 | TP_PROTO(const struct __btrfs_workqueue *wq, |
1392 | const char *name, int high), | |
c3a46891 QW |
1393 | |
1394 | TP_ARGS(wq, name, high) | |
1395 | ); | |
1396 | ||
1397 | DECLARE_EVENT_CLASS(btrfs__workqueue_done, | |
1398 | ||
9a35b637 | 1399 | TP_PROTO(const struct __btrfs_workqueue *wq), |
c3a46891 QW |
1400 | |
1401 | TP_ARGS(wq), | |
1402 | ||
bc074524 | 1403 | TP_STRUCT__entry_btrfs( |
9a35b637 | 1404 | __field( const void *, wq ) |
c3a46891 QW |
1405 | ), |
1406 | ||
bc074524 | 1407 | TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), |
c3a46891 QW |
1408 | __entry->wq = wq; |
1409 | ), | |
1410 | ||
bc074524 | 1411 | TP_printk_btrfs("wq=%p", __entry->wq) |
c3a46891 QW |
1412 | ); |
1413 | ||
1414 | DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy, | |
1415 | ||
9a35b637 | 1416 | TP_PROTO(const struct __btrfs_workqueue *wq), |
c3a46891 QW |
1417 | |
1418 | TP_ARGS(wq) | |
1419 | ); | |
52483bc2 | 1420 | |
81fb6f77 QW |
1421 | #define BTRFS_QGROUP_OPERATIONS \ |
1422 | { QGROUP_RESERVE, "reserve" }, \ | |
1423 | { QGROUP_RELEASE, "release" }, \ | |
1424 | { QGROUP_FREE, "free" } | |
1425 | ||
1426 | DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data, | |
1427 | ||
9a35b637 JM |
1428 | TP_PROTO(const struct inode *inode, u64 start, u64 len, |
1429 | u64 reserved, int op), | |
81fb6f77 QW |
1430 | |
1431 | TP_ARGS(inode, start, len, reserved, op), | |
1432 | ||
bc074524 | 1433 | TP_STRUCT__entry_btrfs( |
81fb6f77 QW |
1434 | __field( u64, rootid ) |
1435 | __field( unsigned long, ino ) | |
1436 | __field( u64, start ) | |
1437 | __field( u64, len ) | |
1438 | __field( u64, reserved ) | |
1439 | __field( int, op ) | |
1440 | ), | |
1441 | ||
bc074524 | 1442 | TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), |
81fb6f77 QW |
1443 | __entry->rootid = BTRFS_I(inode)->root->objectid; |
1444 | __entry->ino = inode->i_ino; | |
1445 | __entry->start = start; | |
1446 | __entry->len = len; | |
1447 | __entry->reserved = reserved; | |
1448 | __entry->op = op; | |
1449 | ), | |
1450 | ||
562a7a07 | 1451 | TP_printk_btrfs("root=%llu ino=%lu start=%llu len=%llu reserved=%llu op=%s", |
81fb6f77 QW |
1452 | __entry->rootid, __entry->ino, __entry->start, __entry->len, |
1453 | __entry->reserved, | |
1454 | __print_flags((unsigned long)__entry->op, "", | |
1455 | BTRFS_QGROUP_OPERATIONS) | |
1456 | ) | |
1457 | ); | |
1458 | ||
1459 | DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_reserve_data, | |
1460 | ||
9a35b637 JM |
1461 | TP_PROTO(const struct inode *inode, u64 start, u64 len, |
1462 | u64 reserved, int op), | |
81fb6f77 QW |
1463 | |
1464 | TP_ARGS(inode, start, len, reserved, op) | |
1465 | ); | |
1466 | ||
1467 | DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_release_data, | |
1468 | ||
9a35b637 JM |
1469 | TP_PROTO(const struct inode *inode, u64 start, u64 len, |
1470 | u64 reserved, int op), | |
81fb6f77 QW |
1471 | |
1472 | TP_ARGS(inode, start, len, reserved, op) | |
1473 | ); | |
1474 | ||
1475 | DECLARE_EVENT_CLASS(btrfs__qgroup_delayed_ref, | |
1476 | ||
9a35b637 JM |
1477 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
1478 | u64 ref_root, u64 reserved), | |
81fb6f77 | 1479 | |
bc074524 | 1480 | TP_ARGS(fs_info, ref_root, reserved), |
81fb6f77 | 1481 | |
bc074524 | 1482 | TP_STRUCT__entry_btrfs( |
81fb6f77 QW |
1483 | __field( u64, ref_root ) |
1484 | __field( u64, reserved ) | |
1485 | ), | |
1486 | ||
bc074524 | 1487 | TP_fast_assign_btrfs(fs_info, |
81fb6f77 QW |
1488 | __entry->ref_root = ref_root; |
1489 | __entry->reserved = reserved; | |
1490 | ), | |
1491 | ||
562a7a07 | 1492 | TP_printk_btrfs("root=%llu reserved=%llu op=free", |
81fb6f77 QW |
1493 | __entry->ref_root, __entry->reserved) |
1494 | ); | |
1495 | ||
1496 | DEFINE_EVENT(btrfs__qgroup_delayed_ref, btrfs_qgroup_free_delayed_ref, | |
1497 | ||
9a35b637 JM |
1498 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
1499 | u64 ref_root, u64 reserved), | |
81fb6f77 | 1500 | |
bc074524 | 1501 | TP_ARGS(fs_info, ref_root, reserved) |
81fb6f77 | 1502 | ); |
0f5dcf8d MF |
1503 | |
1504 | DECLARE_EVENT_CLASS(btrfs_qgroup_extent, | |
9a35b637 JM |
1505 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
1506 | const struct btrfs_qgroup_extent_record *rec), | |
0f5dcf8d | 1507 | |
bc074524 | 1508 | TP_ARGS(fs_info, rec), |
0f5dcf8d | 1509 | |
bc074524 | 1510 | TP_STRUCT__entry_btrfs( |
0f5dcf8d MF |
1511 | __field( u64, bytenr ) |
1512 | __field( u64, num_bytes ) | |
1513 | ), | |
1514 | ||
bc074524 | 1515 | TP_fast_assign_btrfs(fs_info, |
0f5dcf8d MF |
1516 | __entry->bytenr = rec->bytenr, |
1517 | __entry->num_bytes = rec->num_bytes; | |
1518 | ), | |
1519 | ||
562a7a07 | 1520 | TP_printk_btrfs("bytenr=%llu num_bytes=%llu", |
0f5dcf8d MF |
1521 | (unsigned long long)__entry->bytenr, |
1522 | (unsigned long long)__entry->num_bytes) | |
1523 | ); | |
1524 | ||
1525 | DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents, | |
1526 | ||
9a35b637 JM |
1527 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
1528 | const struct btrfs_qgroup_extent_record *rec), | |
0f5dcf8d | 1529 | |
bc074524 | 1530 | TP_ARGS(fs_info, rec) |
0f5dcf8d MF |
1531 | ); |
1532 | ||
50b3e040 | 1533 | DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_trace_extent, |
0f5dcf8d | 1534 | |
9a35b637 JM |
1535 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
1536 | const struct btrfs_qgroup_extent_record *rec), | |
0f5dcf8d | 1537 | |
bc074524 | 1538 | TP_ARGS(fs_info, rec) |
0f5dcf8d MF |
1539 | ); |
1540 | ||
1541 | TRACE_EVENT(btrfs_qgroup_account_extent, | |
1542 | ||
9a35b637 | 1543 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 bytenr, |
bc074524 | 1544 | u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots), |
0f5dcf8d | 1545 | |
bc074524 | 1546 | TP_ARGS(fs_info, bytenr, num_bytes, nr_old_roots, nr_new_roots), |
0f5dcf8d | 1547 | |
bc074524 | 1548 | TP_STRUCT__entry_btrfs( |
0f5dcf8d MF |
1549 | __field( u64, bytenr ) |
1550 | __field( u64, num_bytes ) | |
1551 | __field( u64, nr_old_roots ) | |
1552 | __field( u64, nr_new_roots ) | |
1553 | ), | |
1554 | ||
bc074524 | 1555 | TP_fast_assign_btrfs(fs_info, |
0f5dcf8d MF |
1556 | __entry->bytenr = bytenr; |
1557 | __entry->num_bytes = num_bytes; | |
1558 | __entry->nr_old_roots = nr_old_roots; | |
1559 | __entry->nr_new_roots = nr_new_roots; | |
1560 | ), | |
1561 | ||
562a7a07 DS |
1562 | TP_printk_btrfs("bytenr=%llu num_bytes=%llu nr_old_roots=%llu " |
1563 | "nr_new_roots=%llu", | |
0f5dcf8d MF |
1564 | __entry->bytenr, |
1565 | __entry->num_bytes, | |
1566 | __entry->nr_old_roots, | |
1567 | __entry->nr_new_roots) | |
1568 | ); | |
1569 | ||
1570 | TRACE_EVENT(qgroup_update_counters, | |
1571 | ||
9a35b637 | 1572 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 qgid, |
bc074524 | 1573 | u64 cur_old_count, u64 cur_new_count), |
0f5dcf8d | 1574 | |
bc074524 | 1575 | TP_ARGS(fs_info, qgid, cur_old_count, cur_new_count), |
0f5dcf8d | 1576 | |
bc074524 | 1577 | TP_STRUCT__entry_btrfs( |
0f5dcf8d MF |
1578 | __field( u64, qgid ) |
1579 | __field( u64, cur_old_count ) | |
1580 | __field( u64, cur_new_count ) | |
1581 | ), | |
1582 | ||
bc074524 | 1583 | TP_fast_assign_btrfs(fs_info, |
0f5dcf8d MF |
1584 | __entry->qgid = qgid; |
1585 | __entry->cur_old_count = cur_old_count; | |
1586 | __entry->cur_new_count = cur_new_count; | |
1587 | ), | |
1588 | ||
562a7a07 | 1589 | TP_printk_btrfs("qgid=%llu cur_old_count=%llu cur_new_count=%llu", |
0f5dcf8d MF |
1590 | __entry->qgid, |
1591 | __entry->cur_old_count, | |
1592 | __entry->cur_new_count) | |
1593 | ); | |
1594 | ||
3159fe7b QW |
1595 | TRACE_EVENT(qgroup_update_reserve, |
1596 | ||
1597 | TP_PROTO(struct btrfs_fs_info *fs_info, struct btrfs_qgroup *qgroup, | |
1598 | s64 diff), | |
1599 | ||
1600 | TP_ARGS(fs_info, qgroup, diff), | |
1601 | ||
1602 | TP_STRUCT__entry_btrfs( | |
1603 | __field( u64, qgid ) | |
1604 | __field( u64, cur_reserved ) | |
1605 | __field( s64, diff ) | |
1606 | ), | |
1607 | ||
1608 | TP_fast_assign_btrfs(fs_info, | |
1609 | __entry->qgid = qgroup->qgroupid; | |
1610 | __entry->cur_reserved = qgroup->reserved; | |
1611 | __entry->diff = diff; | |
1612 | ), | |
1613 | ||
1614 | TP_printk_btrfs("qgid=%llu cur_reserved=%llu diff=%lld", | |
1615 | __entry->qgid, __entry->cur_reserved, __entry->diff) | |
1616 | ); | |
1617 | ||
1618 | TRACE_EVENT(qgroup_meta_reserve, | |
1619 | ||
1620 | TP_PROTO(struct btrfs_root *root, s64 diff), | |
1621 | ||
1622 | TP_ARGS(root, diff), | |
1623 | ||
1624 | TP_STRUCT__entry_btrfs( | |
1625 | __field( u64, refroot ) | |
1626 | __field( s64, diff ) | |
1627 | ), | |
1628 | ||
1629 | TP_fast_assign_btrfs(root->fs_info, | |
1630 | __entry->refroot = root->objectid; | |
1631 | __entry->diff = diff; | |
1632 | ), | |
1633 | ||
1634 | TP_printk_btrfs("refroot=%llu(%s) diff=%lld", | |
1635 | show_root_type(__entry->refroot), __entry->diff) | |
1636 | ); | |
1637 | ||
00142756 JM |
1638 | DECLARE_EVENT_CLASS(btrfs__prelim_ref, |
1639 | TP_PROTO(const struct btrfs_fs_info *fs_info, | |
1640 | const struct prelim_ref *oldref, | |
1641 | const struct prelim_ref *newref, u64 tree_size), | |
1642 | TP_ARGS(fs_info, newref, oldref, tree_size), | |
1643 | ||
1644 | TP_STRUCT__entry_btrfs( | |
1645 | __field( u64, root_id ) | |
1646 | __field( u64, objectid ) | |
1647 | __field( u8, type ) | |
1648 | __field( u64, offset ) | |
1649 | __field( int, level ) | |
1650 | __field( int, old_count ) | |
1651 | __field( u64, parent ) | |
1652 | __field( u64, bytenr ) | |
1653 | __field( int, mod_count ) | |
1654 | __field( u64, tree_size ) | |
1655 | ), | |
1656 | ||
1657 | TP_fast_assign_btrfs(fs_info, | |
1658 | __entry->root_id = oldref->root_id; | |
1659 | __entry->objectid = oldref->key_for_search.objectid; | |
1660 | __entry->type = oldref->key_for_search.type; | |
1661 | __entry->offset = oldref->key_for_search.offset; | |
1662 | __entry->level = oldref->level; | |
1663 | __entry->old_count = oldref->count; | |
1664 | __entry->parent = oldref->parent; | |
1665 | __entry->bytenr = oldref->wanted_disk_byte; | |
1666 | __entry->mod_count = newref ? newref->count : 0; | |
1667 | __entry->tree_size = tree_size; | |
1668 | ), | |
1669 | ||
1670 | TP_printk_btrfs("root_id=%llu key=[%llu,%u,%llu] level=%d count=[%d+%d=%d] parent=%llu wanted_disk_byte=%llu nodes=%llu", | |
1671 | (unsigned long long)__entry->root_id, | |
1672 | (unsigned long long)__entry->objectid, __entry->type, | |
1673 | (unsigned long long)__entry->offset, __entry->level, | |
1674 | __entry->old_count, __entry->mod_count, | |
1675 | __entry->old_count + __entry->mod_count, | |
1676 | (unsigned long long)__entry->parent, | |
1677 | (unsigned long long)__entry->bytenr, | |
1678 | (unsigned long long)__entry->tree_size) | |
1679 | ); | |
1680 | ||
1681 | DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_merge, | |
1682 | TP_PROTO(const struct btrfs_fs_info *fs_info, | |
1683 | const struct prelim_ref *oldref, | |
1684 | const struct prelim_ref *newref, u64 tree_size), | |
1685 | TP_ARGS(fs_info, oldref, newref, tree_size) | |
1686 | ); | |
1687 | ||
1688 | DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_insert, | |
1689 | TP_PROTO(const struct btrfs_fs_info *fs_info, | |
1690 | const struct prelim_ref *oldref, | |
1691 | const struct prelim_ref *newref, u64 tree_size), | |
1692 | TP_ARGS(fs_info, oldref, newref, tree_size) | |
1693 | ); | |
1694 | ||
1abe9b8a | 1695 | #endif /* _TRACE_BTRFS_H */ |
1696 | ||
1697 | /* This part must be outside protection */ | |
1698 | #include <trace/define_trace.h> |