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