blob: 1e4908dcd065e37e85d3df3cabd2257c3470aa4d [file] [log] [blame]
liubo1abe9b82011-03-24 11:18:59 +00001#undef TRACE_SYSTEM
2#define TRACE_SYSTEM btrfs
3
4#if !defined(_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_BTRFS_H
6
7#include <linux/writeback.h>
8#include <linux/tracepoint.h>
Vlastimil Babka420adbe92016-03-15 14:55:52 -07009#include <trace/events/mmflags.h>
liubo1abe9b82011-03-24 11:18:59 +000010
11struct btrfs_root;
12struct btrfs_fs_info;
13struct btrfs_inode;
14struct extent_map;
Liu Bo09ed2f12017-03-10 11:09:48 -080015struct btrfs_file_extent_item;
liubo1abe9b82011-03-24 11:18:59 +000016struct btrfs_ordered_extent;
17struct btrfs_delayed_ref_node;
18struct btrfs_delayed_tree_ref;
19struct btrfs_delayed_data_ref;
20struct btrfs_delayed_ref_head;
Josef Bacik3f7de032011-11-10 08:29:20 -050021struct btrfs_block_group_cache;
22struct btrfs_free_cluster;
liubo1abe9b82011-03-24 11:18:59 +000023struct map_lookup;
24struct extent_buffer;
Qu Wenruo52483bc2014-03-06 04:19:50 +000025struct btrfs_work;
Qu Wenruoc3a46892014-03-12 08:05:33 +000026struct __btrfs_workqueue;
Mark Fasheh0f5dcf82016-03-29 17:19:55 -070027struct btrfs_qgroup_extent_record;
Qu Wenruo3159fe72017-03-13 15:52:08 +080028struct btrfs_qgroup;
Jeff Mahoney00142752017-07-12 16:20:08 -060029struct prelim_ref;
liubo1abe9b82011-03-24 11:18:59 +000030
31#define show_ref_type(type) \
32 __print_symbolic(type, \
33 { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \
34 { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \
35 { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \
36 { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \
37 { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" })
38
39#define __show_root_type(obj) \
liubo7f34b742011-04-19 09:35:31 +080040 __print_symbolic_u64(obj, \
liubo1abe9b82011-03-24 11:18:59 +000041 { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \
42 { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \
43 { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \
44 { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \
45 { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \
46 { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \
47 { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \
48 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \
Liu Boe112e2b2013-05-26 13:50:28 +000049 { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \
liubo1abe9b82011-03-24 11:18:59 +000050 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \
Omar Sandoval208acb82015-09-29 20:50:34 -070051 { BTRFS_UUID_TREE_OBJECTID, "UUID_TREE" }, \
52 { BTRFS_FREE_SPACE_TREE_OBJECTID, "FREE_SPACE_TREE" }, \
liubo1abe9b82011-03-24 11:18:59 +000053 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
54
55#define show_root_type(obj) \
56 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
Liu Bofb57dc82012-11-30 11:24:22 +000057 (obj >= BTRFS_ROOT_TREE_OBJECTID && \
Liu Boe112e2b2013-05-26 13:50:28 +000058 obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
liubo1abe9b82011-03-24 11:18:59 +000059
Liu Bo09ed2f12017-03-10 11:09:48 -080060#define show_fi_type(type) \
61 __print_symbolic(type, \
62 { BTRFS_FILE_EXTENT_INLINE, "INLINE" }, \
63 { BTRFS_FILE_EXTENT_REG, "REG" }, \
64 { BTRFS_FILE_EXTENT_PREALLOC, "PREALLOC"})
65
Josef Bacik3f7de032011-11-10 08:29:20 -050066#define BTRFS_GROUP_FLAGS \
Liu Boe112e2b2013-05-26 13:50:28 +000067 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \
68 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
69 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
70 { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \
71 { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \
72 { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \
73 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
74 { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \
75 { BTRFS_BLOCK_GROUP_RAID6, "RAID6"}
Josef Bacik3f7de032011-11-10 08:29:20 -050076
Josef Bacik8c2a3ca2012-01-10 10:31:31 -050077#define BTRFS_UUID_SIZE 16
Jeff Mahoneybc074522016-06-09 17:27:55 -040078#define TP_STRUCT__entry_fsid __array(u8, fsid, BTRFS_UUID_SIZE)
79
80#define TP_fast_assign_fsid(fs_info) \
81 memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE)
82
83#define TP_STRUCT__entry_btrfs(args...) \
84 TP_STRUCT__entry( \
85 TP_STRUCT__entry_fsid \
86 args)
87#define TP_fast_assign_btrfs(fs_info, args...) \
88 TP_fast_assign( \
89 TP_fast_assign_fsid(fs_info); \
90 args)
91#define TP_printk_btrfs(fmt, args...) \
92 TP_printk("%pU: " fmt, __entry->fsid, args)
Josef Bacik8c2a3ca2012-01-10 10:31:31 -050093
liubo1abe9b82011-03-24 11:18:59 +000094TRACE_EVENT(btrfs_transaction_commit,
95
Jeff Mahoney9a35b632017-06-28 21:56:54 -060096 TP_PROTO(const struct btrfs_root *root),
liubo1abe9b82011-03-24 11:18:59 +000097
98 TP_ARGS(root),
99
Jeff Mahoneybc074522016-06-09 17:27:55 -0400100 TP_STRUCT__entry_btrfs(
liubo1abe9b82011-03-24 11:18:59 +0000101 __field( u64, generation )
102 __field( u64, root_objectid )
103 ),
104
Jeff Mahoneybc074522016-06-09 17:27:55 -0400105 TP_fast_assign_btrfs(root->fs_info,
liubo1abe9b82011-03-24 11:18:59 +0000106 __entry->generation = root->fs_info->generation;
107 __entry->root_objectid = root->root_key.objectid;
108 ),
109
Jeff Mahoneybc074522016-06-09 17:27:55 -0400110 TP_printk_btrfs("root = %llu(%s), gen = %llu",
liubo1abe9b82011-03-24 11:18:59 +0000111 show_root_type(__entry->root_objectid),
112 (unsigned long long)__entry->generation)
113);
114
115DECLARE_EVENT_CLASS(btrfs__inode,
116
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600117 TP_PROTO(const struct inode *inode),
liubo1abe9b82011-03-24 11:18:59 +0000118
119 TP_ARGS(inode),
120
Jeff Mahoneybc074522016-06-09 17:27:55 -0400121 TP_STRUCT__entry_btrfs(
liubo1abe9b82011-03-24 11:18:59 +0000122 __field( ino_t, ino )
123 __field( blkcnt_t, blocks )
124 __field( u64, disk_i_size )
125 __field( u64, generation )
126 __field( u64, last_trans )
127 __field( u64, logged_trans )
128 __field( u64, root_objectid )
129 ),
130
Jeff Mahoneybc074522016-06-09 17:27:55 -0400131 TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
liubo1abe9b82011-03-24 11:18:59 +0000132 __entry->ino = inode->i_ino;
133 __entry->blocks = inode->i_blocks;
134 __entry->disk_i_size = BTRFS_I(inode)->disk_i_size;
135 __entry->generation = BTRFS_I(inode)->generation;
136 __entry->last_trans = BTRFS_I(inode)->last_trans;
137 __entry->logged_trans = BTRFS_I(inode)->logged_trans;
138 __entry->root_objectid =
139 BTRFS_I(inode)->root->root_key.objectid;
140 ),
141
David Sterba562a7a02017-01-06 15:51:36 +0100142 TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%lu blocks=%llu "
143 "disk_i_size=%llu last_trans=%llu logged_trans=%llu",
liubo1abe9b82011-03-24 11:18:59 +0000144 show_root_type(__entry->root_objectid),
145 (unsigned long long)__entry->generation,
146 (unsigned long)__entry->ino,
147 (unsigned long long)__entry->blocks,
148 (unsigned long long)__entry->disk_i_size,
149 (unsigned long long)__entry->last_trans,
150 (unsigned long long)__entry->logged_trans)
151);
152
153DEFINE_EVENT(btrfs__inode, btrfs_inode_new,
154
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600155 TP_PROTO(const struct inode *inode),
liubo1abe9b82011-03-24 11:18:59 +0000156
157 TP_ARGS(inode)
158);
159
160DEFINE_EVENT(btrfs__inode, btrfs_inode_request,
161
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600162 TP_PROTO(const struct inode *inode),
liubo1abe9b82011-03-24 11:18:59 +0000163
164 TP_ARGS(inode)
165);
166
167DEFINE_EVENT(btrfs__inode, btrfs_inode_evict,
168
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600169 TP_PROTO(const struct inode *inode),
liubo1abe9b82011-03-24 11:18:59 +0000170
171 TP_ARGS(inode)
172);
173
174#define __show_map_type(type) \
liubo7f34b742011-04-19 09:35:31 +0800175 __print_symbolic_u64(type, \
liubo1abe9b82011-03-24 11:18:59 +0000176 { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \
177 { EXTENT_MAP_HOLE, "HOLE" }, \
178 { EXTENT_MAP_INLINE, "INLINE" }, \
179 { EXTENT_MAP_DELALLOC, "DELALLOC" })
180
181#define show_map_type(type) \
182 type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type)
183
184#define show_map_flags(flag) \
185 __print_flags(flag, "|", \
Liu Bo254a2d12014-09-17 21:36:41 +0800186 { (1 << EXTENT_FLAG_PINNED), "PINNED" },\
187 { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\
188 { (1 << EXTENT_FLAG_VACANCY), "VACANCY" },\
189 { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\
190 { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\
191 { (1 << EXTENT_FLAG_FILLING), "FILLING" },\
192 { (1 << EXTENT_FLAG_FS_MAPPING), "FS_MAPPING" })
liubo1abe9b82011-03-24 11:18:59 +0000193
Steven Rostedt4cd85872013-11-14 22:57:29 -0500194TRACE_EVENT_CONDITION(btrfs_get_extent,
liubo1abe9b82011-03-24 11:18:59 +0000195
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600196 TP_PROTO(const struct btrfs_root *root, const struct btrfs_inode *inode,
197 const struct extent_map *map),
liubo1abe9b82011-03-24 11:18:59 +0000198
Liu Bo92a1bf72016-11-17 15:00:50 -0800199 TP_ARGS(root, inode, map),
liubo1abe9b82011-03-24 11:18:59 +0000200
Steven Rostedt4cd85872013-11-14 22:57:29 -0500201 TP_CONDITION(map),
202
Jeff Mahoneybc074522016-06-09 17:27:55 -0400203 TP_STRUCT__entry_btrfs(
liubo1abe9b82011-03-24 11:18:59 +0000204 __field( u64, root_objectid )
Liu Bo92a1bf72016-11-17 15:00:50 -0800205 __field( u64, ino )
liubo1abe9b82011-03-24 11:18:59 +0000206 __field( u64, start )
207 __field( u64, len )
208 __field( u64, orig_start )
209 __field( u64, block_start )
210 __field( u64, block_len )
211 __field( unsigned long, flags )
212 __field( int, refs )
213 __field( unsigned int, compress_type )
214 ),
215
Jeff Mahoneybc074522016-06-09 17:27:55 -0400216 TP_fast_assign_btrfs(root->fs_info,
liubo1abe9b82011-03-24 11:18:59 +0000217 __entry->root_objectid = root->root_key.objectid;
Liu Bo92a1bf72016-11-17 15:00:50 -0800218 __entry->ino = btrfs_ino(inode);
219 __entry->start = map->start;
liubo1abe9b82011-03-24 11:18:59 +0000220 __entry->len = map->len;
221 __entry->orig_start = map->orig_start;
222 __entry->block_start = map->block_start;
223 __entry->block_len = map->block_len;
224 __entry->flags = map->flags;
Elena Reshetova490b54d2017-03-03 10:55:12 +0200225 __entry->refs = refcount_read(&map->refs);
liubo1abe9b82011-03-24 11:18:59 +0000226 __entry->compress_type = map->compress_type;
227 ),
228
David Sterba562a7a02017-01-06 15:51:36 +0100229 TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu "
230 "orig_start=%llu block_start=%llu(%s) "
231 "block_len=%llu flags=%s refs=%u "
232 "compress_type=%u",
liubo1abe9b82011-03-24 11:18:59 +0000233 show_root_type(__entry->root_objectid),
Liu Bo92a1bf72016-11-17 15:00:50 -0800234 (unsigned long long)__entry->ino,
liubo1abe9b82011-03-24 11:18:59 +0000235 (unsigned long long)__entry->start,
236 (unsigned long long)__entry->len,
237 (unsigned long long)__entry->orig_start,
238 show_map_type(__entry->block_start),
239 (unsigned long long)__entry->block_len,
240 show_map_flags(__entry->flags),
241 __entry->refs, __entry->compress_type)
242);
243
Liu Bo09ed2f12017-03-10 11:09:48 -0800244/* file extent item */
245DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular,
246
247 TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
248 struct btrfs_file_extent_item *fi, u64 start),
249
250 TP_ARGS(bi, l, fi, start),
251
252 TP_STRUCT__entry_btrfs(
253 __field( u64, root_obj )
254 __field( u64, ino )
255 __field( loff_t, isize )
256 __field( u64, disk_isize )
257 __field( u64, num_bytes )
258 __field( u64, ram_bytes )
259 __field( u64, disk_bytenr )
260 __field( u64, disk_num_bytes )
261 __field( u64, extent_offset )
262 __field( u8, extent_type )
263 __field( u8, compression )
264 __field( u64, extent_start )
265 __field( u64, extent_end )
266 ),
267
268 TP_fast_assign_btrfs(bi->root->fs_info,
269 __entry->root_obj = bi->root->objectid;
270 __entry->ino = btrfs_ino(bi);
271 __entry->isize = bi->vfs_inode.i_size;
272 __entry->disk_isize = bi->disk_i_size;
273 __entry->num_bytes = btrfs_file_extent_num_bytes(l, fi);
274 __entry->ram_bytes = btrfs_file_extent_ram_bytes(l, fi);
275 __entry->disk_bytenr = btrfs_file_extent_disk_bytenr(l, fi);
276 __entry->disk_num_bytes = btrfs_file_extent_disk_num_bytes(l, fi);
277 __entry->extent_offset = btrfs_file_extent_offset(l, fi);
278 __entry->extent_type = btrfs_file_extent_type(l, fi);
279 __entry->compression = btrfs_file_extent_compression(l, fi);
280 __entry->extent_start = start;
281 __entry->extent_end = (start + __entry->num_bytes);
282 ),
283
284 TP_printk_btrfs(
285 "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu "
286 "file extent range=[%llu %llu] "
287 "(num_bytes=%llu ram_bytes=%llu disk_bytenr=%llu "
288 "disk_num_bytes=%llu extent_offset=%llu type=%s "
289 "compression=%u",
290 show_root_type(__entry->root_obj), __entry->ino,
291 __entry->isize,
292 __entry->disk_isize, __entry->extent_start,
293 __entry->extent_end, __entry->num_bytes, __entry->ram_bytes,
294 __entry->disk_bytenr, __entry->disk_num_bytes,
295 __entry->extent_offset, show_fi_type(__entry->extent_type),
296 __entry->compression)
297);
298
299DECLARE_EVENT_CLASS(
300 btrfs__file_extent_item_inline,
301
302 TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
303 struct btrfs_file_extent_item *fi, int slot, u64 start),
304
305 TP_ARGS(bi, l, fi, slot, start),
306
307 TP_STRUCT__entry_btrfs(
308 __field( u64, root_obj )
309 __field( u64, ino )
310 __field( loff_t, isize )
311 __field( u64, disk_isize )
312 __field( u8, extent_type )
313 __field( u8, compression )
314 __field( u64, extent_start )
315 __field( u64, extent_end )
316 ),
317
318 TP_fast_assign_btrfs(
319 bi->root->fs_info,
320 __entry->root_obj = bi->root->objectid;
321 __entry->ino = btrfs_ino(bi);
322 __entry->isize = bi->vfs_inode.i_size;
323 __entry->disk_isize = bi->disk_i_size;
324 __entry->extent_type = btrfs_file_extent_type(l, fi);
325 __entry->compression = btrfs_file_extent_compression(l, fi);
326 __entry->extent_start = start;
327 __entry->extent_end = (start + btrfs_file_extent_inline_len(l, slot, fi));
328 ),
329
330 TP_printk_btrfs(
331 "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu "
332 "file extent range=[%llu %llu] "
333 "extent_type=%s compression=%u",
334 show_root_type(__entry->root_obj), __entry->ino, __entry->isize,
335 __entry->disk_isize, __entry->extent_start,
336 __entry->extent_end, show_fi_type(__entry->extent_type),
337 __entry->compression)
338);
339
340DEFINE_EVENT(
341 btrfs__file_extent_item_regular, btrfs_get_extent_show_fi_regular,
342
343 TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
344 struct btrfs_file_extent_item *fi, u64 start),
345
346 TP_ARGS(bi, l, fi, start)
347);
348
349DEFINE_EVENT(
350 btrfs__file_extent_item_regular, btrfs_truncate_show_fi_regular,
351
352 TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
353 struct btrfs_file_extent_item *fi, u64 start),
354
355 TP_ARGS(bi, l, fi, start)
356);
357
358DEFINE_EVENT(
359 btrfs__file_extent_item_inline, btrfs_get_extent_show_fi_inline,
360
361 TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
362 struct btrfs_file_extent_item *fi, int slot, u64 start),
363
364 TP_ARGS(bi, l, fi, slot, start)
365);
366
367DEFINE_EVENT(
368 btrfs__file_extent_item_inline, btrfs_truncate_show_fi_inline,
369
370 TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
371 struct btrfs_file_extent_item *fi, int slot, u64 start),
372
373 TP_ARGS(bi, l, fi, slot, start)
374);
375
Liu Bo9d04a8c2013-11-06 12:04:13 +0800376#define show_ordered_flags(flags) \
377 __print_flags(flags, "|", \
378 { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \
379 { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \
380 { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \
381 { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \
382 { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \
383 { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \
384 { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \
385 { (1 << BTRFS_ORDERED_UPDATED_ISIZE), "UPDATED_ISIZE" }, \
Liu Bo792ddef2013-11-06 12:04:14 +0800386 { (1 << BTRFS_ORDERED_LOGGED_CSUM), "LOGGED_CSUM" }, \
387 { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" })
Liu Boe112e2b2013-05-26 13:50:28 +0000388
liubo1abe9b82011-03-24 11:18:59 +0000389
390DECLARE_EVENT_CLASS(btrfs__ordered_extent,
391
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600392 TP_PROTO(const struct inode *inode,
393 const struct btrfs_ordered_extent *ordered),
liubo1abe9b82011-03-24 11:18:59 +0000394
395 TP_ARGS(inode, ordered),
396
Jeff Mahoneybc074522016-06-09 17:27:55 -0400397 TP_STRUCT__entry_btrfs(
liubo1abe9b82011-03-24 11:18:59 +0000398 __field( ino_t, ino )
399 __field( u64, file_offset )
400 __field( u64, start )
401 __field( u64, len )
402 __field( u64, disk_len )
403 __field( u64, bytes_left )
404 __field( unsigned long, flags )
405 __field( int, compress_type )
406 __field( int, refs )
407 __field( u64, root_objectid )
Liu Bo78566542016-11-30 16:10:10 -0800408 __field( u64, truncated_len )
liubo1abe9b82011-03-24 11:18:59 +0000409 ),
410
Jeff Mahoneybc074522016-06-09 17:27:55 -0400411 TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
liubo1abe9b82011-03-24 11:18:59 +0000412 __entry->ino = inode->i_ino;
413 __entry->file_offset = ordered->file_offset;
414 __entry->start = ordered->start;
415 __entry->len = ordered->len;
416 __entry->disk_len = ordered->disk_len;
417 __entry->bytes_left = ordered->bytes_left;
418 __entry->flags = ordered->flags;
419 __entry->compress_type = ordered->compress_type;
Elena Reshetovae76edab2017-03-03 10:55:13 +0200420 __entry->refs = refcount_read(&ordered->refs);
liubo1abe9b82011-03-24 11:18:59 +0000421 __entry->root_objectid =
422 BTRFS_I(inode)->root->root_key.objectid;
Liu Bo78566542016-11-30 16:10:10 -0800423 __entry->truncated_len = ordered->truncated_len;
liubo1abe9b82011-03-24 11:18:59 +0000424 ),
425
David Sterba562a7a02017-01-06 15:51:36 +0100426 TP_printk_btrfs("root=%llu(%s) ino=%llu file_offset=%llu "
427 "start=%llu len=%llu disk_len=%llu "
428 "truncated_len=%llu "
429 "bytes_left=%llu flags=%s compress_type=%d "
430 "refs=%d",
liubo1abe9b82011-03-24 11:18:59 +0000431 show_root_type(__entry->root_objectid),
432 (unsigned long long)__entry->ino,
433 (unsigned long long)__entry->file_offset,
434 (unsigned long long)__entry->start,
435 (unsigned long long)__entry->len,
436 (unsigned long long)__entry->disk_len,
Liu Bo78566542016-11-30 16:10:10 -0800437 (unsigned long long)__entry->truncated_len,
liubo1abe9b82011-03-24 11:18:59 +0000438 (unsigned long long)__entry->bytes_left,
439 show_ordered_flags(__entry->flags),
440 __entry->compress_type, __entry->refs)
441);
442
443DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add,
444
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600445 TP_PROTO(const struct inode *inode,
446 const struct btrfs_ordered_extent *ordered),
liubo1abe9b82011-03-24 11:18:59 +0000447
448 TP_ARGS(inode, ordered)
449);
450
451DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove,
452
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600453 TP_PROTO(const struct inode *inode,
454 const struct btrfs_ordered_extent *ordered),
liubo1abe9b82011-03-24 11:18:59 +0000455
456 TP_ARGS(inode, ordered)
457);
458
459DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start,
460
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600461 TP_PROTO(const struct inode *inode,
462 const struct btrfs_ordered_extent *ordered),
liubo1abe9b82011-03-24 11:18:59 +0000463
464 TP_ARGS(inode, ordered)
465);
466
467DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put,
468
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600469 TP_PROTO(const struct inode *inode,
470 const struct btrfs_ordered_extent *ordered),
liubo1abe9b82011-03-24 11:18:59 +0000471
472 TP_ARGS(inode, ordered)
473);
474
475DECLARE_EVENT_CLASS(btrfs__writepage,
476
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600477 TP_PROTO(const struct page *page, const struct inode *inode,
478 const struct writeback_control *wbc),
liubo1abe9b82011-03-24 11:18:59 +0000479
480 TP_ARGS(page, inode, wbc),
481
Jeff Mahoneybc074522016-06-09 17:27:55 -0400482 TP_STRUCT__entry_btrfs(
liubo1abe9b82011-03-24 11:18:59 +0000483 __field( ino_t, ino )
484 __field( pgoff_t, index )
485 __field( long, nr_to_write )
486 __field( long, pages_skipped )
487 __field( loff_t, range_start )
488 __field( loff_t, range_end )
liubo1abe9b82011-03-24 11:18:59 +0000489 __field( char, for_kupdate )
490 __field( char, for_reclaim )
491 __field( char, range_cyclic )
492 __field( pgoff_t, writeback_index )
493 __field( u64, root_objectid )
494 ),
495
Jeff Mahoneybc074522016-06-09 17:27:55 -0400496 TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
liubo1abe9b82011-03-24 11:18:59 +0000497 __entry->ino = inode->i_ino;
498 __entry->index = page->index;
499 __entry->nr_to_write = wbc->nr_to_write;
500 __entry->pages_skipped = wbc->pages_skipped;
501 __entry->range_start = wbc->range_start;
502 __entry->range_end = wbc->range_end;
liubo1abe9b82011-03-24 11:18:59 +0000503 __entry->for_kupdate = wbc->for_kupdate;
504 __entry->for_reclaim = wbc->for_reclaim;
505 __entry->range_cyclic = wbc->range_cyclic;
506 __entry->writeback_index = inode->i_mapping->writeback_index;
507 __entry->root_objectid =
508 BTRFS_I(inode)->root->root_key.objectid;
509 ),
510
David Sterba562a7a02017-01-06 15:51:36 +0100511 TP_printk_btrfs("root=%llu(%s) ino=%lu page_index=%lu "
512 "nr_to_write=%ld pages_skipped=%ld range_start=%llu "
513 "range_end=%llu for_kupdate=%d "
514 "for_reclaim=%d range_cyclic=%d writeback_index=%lu",
liubo1abe9b82011-03-24 11:18:59 +0000515 show_root_type(__entry->root_objectid),
516 (unsigned long)__entry->ino, __entry->index,
517 __entry->nr_to_write, __entry->pages_skipped,
518 __entry->range_start, __entry->range_end,
Wu Fengguang846d5a02011-05-05 21:10:38 -0600519 __entry->for_kupdate,
liubo1abe9b82011-03-24 11:18:59 +0000520 __entry->for_reclaim, __entry->range_cyclic,
521 (unsigned long)__entry->writeback_index)
522);
523
524DEFINE_EVENT(btrfs__writepage, __extent_writepage,
525
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600526 TP_PROTO(const struct page *page, const struct inode *inode,
527 const struct writeback_control *wbc),
liubo1abe9b82011-03-24 11:18:59 +0000528
529 TP_ARGS(page, inode, wbc)
530);
531
532TRACE_EVENT(btrfs_writepage_end_io_hook,
533
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600534 TP_PROTO(const struct page *page, u64 start, u64 end, int uptodate),
liubo1abe9b82011-03-24 11:18:59 +0000535
536 TP_ARGS(page, start, end, uptodate),
537
Jeff Mahoneybc074522016-06-09 17:27:55 -0400538 TP_STRUCT__entry_btrfs(
liubo1abe9b82011-03-24 11:18:59 +0000539 __field( ino_t, ino )
540 __field( pgoff_t, index )
541 __field( u64, start )
542 __field( u64, end )
543 __field( int, uptodate )
544 __field( u64, root_objectid )
545 ),
546
Jeff Mahoneybc074522016-06-09 17:27:55 -0400547 TP_fast_assign_btrfs(btrfs_sb(page->mapping->host->i_sb),
liubo1abe9b82011-03-24 11:18:59 +0000548 __entry->ino = page->mapping->host->i_ino;
549 __entry->index = page->index;
550 __entry->start = start;
551 __entry->end = end;
552 __entry->uptodate = uptodate;
553 __entry->root_objectid =
554 BTRFS_I(page->mapping->host)->root->root_key.objectid;
555 ),
556
David Sterba562a7a02017-01-06 15:51:36 +0100557 TP_printk_btrfs("root=%llu(%s) ino=%lu page_index=%lu start=%llu "
558 "end=%llu uptodate=%d",
liubo1abe9b82011-03-24 11:18:59 +0000559 show_root_type(__entry->root_objectid),
560 (unsigned long)__entry->ino, (unsigned long)__entry->index,
561 (unsigned long long)__entry->start,
562 (unsigned long long)__entry->end, __entry->uptodate)
563);
564
565TRACE_EVENT(btrfs_sync_file,
566
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600567 TP_PROTO(const struct file *file, int datasync),
liubo1abe9b82011-03-24 11:18:59 +0000568
569 TP_ARGS(file, datasync),
570
Jeff Mahoneybc074522016-06-09 17:27:55 -0400571 TP_STRUCT__entry_btrfs(
liubo1abe9b82011-03-24 11:18:59 +0000572 __field( ino_t, ino )
573 __field( ino_t, parent )
574 __field( int, datasync )
575 __field( u64, root_objectid )
576 ),
577
578 TP_fast_assign(
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600579 const struct dentry *dentry = file->f_path.dentry;
580 const struct inode *inode = d_inode(dentry);
liubo1abe9b82011-03-24 11:18:59 +0000581
Jeff Mahoneybc074522016-06-09 17:27:55 -0400582 TP_fast_assign_fsid(btrfs_sb(file->f_path.dentry->d_sb));
liubo1abe9b82011-03-24 11:18:59 +0000583 __entry->ino = inode->i_ino;
David Howells2b0143b2015-03-17 22:25:59 +0000584 __entry->parent = d_inode(dentry->d_parent)->i_ino;
liubo1abe9b82011-03-24 11:18:59 +0000585 __entry->datasync = datasync;
586 __entry->root_objectid =
587 BTRFS_I(inode)->root->root_key.objectid;
588 ),
589
David Sterba562a7a02017-01-06 15:51:36 +0100590 TP_printk_btrfs("root=%llu(%s) ino=%ld parent=%ld datasync=%d",
liubo1abe9b82011-03-24 11:18:59 +0000591 show_root_type(__entry->root_objectid),
592 (unsigned long)__entry->ino, (unsigned long)__entry->parent,
593 __entry->datasync)
594);
595
596TRACE_EVENT(btrfs_sync_fs,
597
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600598 TP_PROTO(const struct btrfs_fs_info *fs_info, int wait),
liubo1abe9b82011-03-24 11:18:59 +0000599
Jeff Mahoneybc074522016-06-09 17:27:55 -0400600 TP_ARGS(fs_info, wait),
liubo1abe9b82011-03-24 11:18:59 +0000601
Jeff Mahoneybc074522016-06-09 17:27:55 -0400602 TP_STRUCT__entry_btrfs(
liubo1abe9b82011-03-24 11:18:59 +0000603 __field( int, wait )
604 ),
605
Jeff Mahoneybc074522016-06-09 17:27:55 -0400606 TP_fast_assign_btrfs(fs_info,
liubo1abe9b82011-03-24 11:18:59 +0000607 __entry->wait = wait;
608 ),
609
Jeff Mahoneybc074522016-06-09 17:27:55 -0400610 TP_printk_btrfs("wait = %d", __entry->wait)
liubo1abe9b82011-03-24 11:18:59 +0000611);
612
Josef Bacikc83f8ef2016-03-25 13:25:52 -0400613TRACE_EVENT(btrfs_add_block_group,
614
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600615 TP_PROTO(const struct btrfs_fs_info *fs_info,
616 const struct btrfs_block_group_cache *block_group, int create),
Josef Bacikc83f8ef2016-03-25 13:25:52 -0400617
618 TP_ARGS(fs_info, block_group, create),
619
620 TP_STRUCT__entry(
621 __array( u8, fsid, BTRFS_UUID_SIZE )
622 __field( u64, offset )
623 __field( u64, size )
624 __field( u64, flags )
625 __field( u64, bytes_used )
626 __field( u64, bytes_super )
627 __field( int, create )
628 ),
629
630 TP_fast_assign(
631 memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE);
632 __entry->offset = block_group->key.objectid;
633 __entry->size = block_group->key.offset;
634 __entry->flags = block_group->flags;
635 __entry->bytes_used =
636 btrfs_block_group_used(&block_group->item);
637 __entry->bytes_super = block_group->bytes_super;
638 __entry->create = create;
639 ),
640
David Sterba562a7a02017-01-06 15:51:36 +0100641 TP_printk("%pU: block_group offset=%llu size=%llu "
642 "flags=%llu(%s) bytes_used=%llu bytes_super=%llu "
643 "create=%d", __entry->fsid,
Josef Bacikc83f8ef2016-03-25 13:25:52 -0400644 (unsigned long long)__entry->offset,
645 (unsigned long long)__entry->size,
646 (unsigned long long)__entry->flags,
647 __print_flags((unsigned long)__entry->flags, "|",
648 BTRFS_GROUP_FLAGS),
649 (unsigned long long)__entry->bytes_used,
650 (unsigned long long)__entry->bytes_super, __entry->create)
651);
652
liubo1abe9b82011-03-24 11:18:59 +0000653#define show_ref_action(action) \
654 __print_symbolic(action, \
655 { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \
656 { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \
657 { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \
658 { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
659
660
Liu Bo599c75e2013-07-16 19:03:36 +0800661DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref,
liubo1abe9b82011-03-24 11:18:59 +0000662
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600663 TP_PROTO(const struct btrfs_fs_info *fs_info,
664 const struct btrfs_delayed_ref_node *ref,
665 const struct btrfs_delayed_tree_ref *full_ref,
liubo1abe9b82011-03-24 11:18:59 +0000666 int action),
667
Jeff Mahoneybc074522016-06-09 17:27:55 -0400668 TP_ARGS(fs_info, ref, full_ref, action),
liubo1abe9b82011-03-24 11:18:59 +0000669
Jeff Mahoneybc074522016-06-09 17:27:55 -0400670 TP_STRUCT__entry_btrfs(
liubo1abe9b82011-03-24 11:18:59 +0000671 __field( u64, bytenr )
672 __field( u64, num_bytes )
673 __field( int, action )
674 __field( u64, parent )
675 __field( u64, ref_root )
676 __field( int, level )
677 __field( int, type )
Liu Bodea7d762012-09-07 20:01:27 -0600678 __field( u64, seq )
liubo1abe9b82011-03-24 11:18:59 +0000679 ),
680
Jeff Mahoneybc074522016-06-09 17:27:55 -0400681 TP_fast_assign_btrfs(fs_info,
liubo1abe9b82011-03-24 11:18:59 +0000682 __entry->bytenr = ref->bytenr;
683 __entry->num_bytes = ref->num_bytes;
684 __entry->action = action;
685 __entry->parent = full_ref->parent;
686 __entry->ref_root = full_ref->root;
687 __entry->level = full_ref->level;
688 __entry->type = ref->type;
Liu Bodea7d762012-09-07 20:01:27 -0600689 __entry->seq = ref->seq;
liubo1abe9b82011-03-24 11:18:59 +0000690 ),
691
David Sterba562a7a02017-01-06 15:51:36 +0100692 TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s "
693 "parent=%llu(%s) ref_root=%llu(%s) level=%d "
694 "type=%s seq=%llu",
liubo1abe9b82011-03-24 11:18:59 +0000695 (unsigned long long)__entry->bytenr,
696 (unsigned long long)__entry->num_bytes,
697 show_ref_action(__entry->action),
698 show_root_type(__entry->parent),
699 show_root_type(__entry->ref_root),
Liu Bodea7d762012-09-07 20:01:27 -0600700 __entry->level, show_ref_type(__entry->type),
701 (unsigned long long)__entry->seq)
liubo1abe9b82011-03-24 11:18:59 +0000702);
703
Liu Bo599c75e2013-07-16 19:03:36 +0800704DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref,
705
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600706 TP_PROTO(const struct btrfs_fs_info *fs_info,
707 const struct btrfs_delayed_ref_node *ref,
708 const struct btrfs_delayed_tree_ref *full_ref,
Liu Bo599c75e2013-07-16 19:03:36 +0800709 int action),
710
Jeff Mahoneybc074522016-06-09 17:27:55 -0400711 TP_ARGS(fs_info, ref, full_ref, action)
Liu Bo599c75e2013-07-16 19:03:36 +0800712);
713
714DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref,
715
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600716 TP_PROTO(const struct btrfs_fs_info *fs_info,
717 const struct btrfs_delayed_ref_node *ref,
718 const struct btrfs_delayed_tree_ref *full_ref,
Liu Bo599c75e2013-07-16 19:03:36 +0800719 int action),
720
Jeff Mahoneybc074522016-06-09 17:27:55 -0400721 TP_ARGS(fs_info, ref, full_ref, action)
Liu Bo599c75e2013-07-16 19:03:36 +0800722);
723
724DECLARE_EVENT_CLASS(btrfs_delayed_data_ref,
liubo1abe9b82011-03-24 11:18:59 +0000725
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600726 TP_PROTO(const struct btrfs_fs_info *fs_info,
727 const struct btrfs_delayed_ref_node *ref,
728 const struct btrfs_delayed_data_ref *full_ref,
liubo1abe9b82011-03-24 11:18:59 +0000729 int action),
730
Jeff Mahoneybc074522016-06-09 17:27:55 -0400731 TP_ARGS(fs_info, ref, full_ref, action),
liubo1abe9b82011-03-24 11:18:59 +0000732
Jeff Mahoneybc074522016-06-09 17:27:55 -0400733 TP_STRUCT__entry_btrfs(
liubo1abe9b82011-03-24 11:18:59 +0000734 __field( u64, bytenr )
735 __field( u64, num_bytes )
736 __field( int, action )
737 __field( u64, parent )
738 __field( u64, ref_root )
739 __field( u64, owner )
740 __field( u64, offset )
741 __field( int, type )
Liu Bodea7d762012-09-07 20:01:27 -0600742 __field( u64, seq )
liubo1abe9b82011-03-24 11:18:59 +0000743 ),
744
Jeff Mahoneybc074522016-06-09 17:27:55 -0400745 TP_fast_assign_btrfs(fs_info,
liubo1abe9b82011-03-24 11:18:59 +0000746 __entry->bytenr = ref->bytenr;
747 __entry->num_bytes = ref->num_bytes;
748 __entry->action = action;
749 __entry->parent = full_ref->parent;
750 __entry->ref_root = full_ref->root;
751 __entry->owner = full_ref->objectid;
752 __entry->offset = full_ref->offset;
753 __entry->type = ref->type;
Liu Bodea7d762012-09-07 20:01:27 -0600754 __entry->seq = ref->seq;
liubo1abe9b82011-03-24 11:18:59 +0000755 ),
756
David Sterba562a7a02017-01-06 15:51:36 +0100757 TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s "
758 "parent=%llu(%s) ref_root=%llu(%s) owner=%llu "
759 "offset=%llu type=%s seq=%llu",
liubo1abe9b82011-03-24 11:18:59 +0000760 (unsigned long long)__entry->bytenr,
761 (unsigned long long)__entry->num_bytes,
762 show_ref_action(__entry->action),
763 show_root_type(__entry->parent),
764 show_root_type(__entry->ref_root),
765 (unsigned long long)__entry->owner,
766 (unsigned long long)__entry->offset,
Liu Bodea7d762012-09-07 20:01:27 -0600767 show_ref_type(__entry->type),
768 (unsigned long long)__entry->seq)
liubo1abe9b82011-03-24 11:18:59 +0000769);
770
Liu Bo599c75e2013-07-16 19:03:36 +0800771DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref,
772
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600773 TP_PROTO(const struct btrfs_fs_info *fs_info,
774 const struct btrfs_delayed_ref_node *ref,
775 const struct btrfs_delayed_data_ref *full_ref,
Liu Bo599c75e2013-07-16 19:03:36 +0800776 int action),
777
Jeff Mahoneybc074522016-06-09 17:27:55 -0400778 TP_ARGS(fs_info, ref, full_ref, action)
Liu Bo599c75e2013-07-16 19:03:36 +0800779);
780
781DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref,
782
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600783 TP_PROTO(const struct btrfs_fs_info *fs_info,
784 const struct btrfs_delayed_ref_node *ref,
785 const struct btrfs_delayed_data_ref *full_ref,
Liu Bo599c75e2013-07-16 19:03:36 +0800786 int action),
787
Jeff Mahoneybc074522016-06-09 17:27:55 -0400788 TP_ARGS(fs_info, ref, full_ref, action)
Liu Bo599c75e2013-07-16 19:03:36 +0800789);
790
791DECLARE_EVENT_CLASS(btrfs_delayed_ref_head,
liubo1abe9b82011-03-24 11:18:59 +0000792
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600793 TP_PROTO(const struct btrfs_fs_info *fs_info,
794 const struct btrfs_delayed_ref_node *ref,
795 const struct btrfs_delayed_ref_head *head_ref,
liubo1abe9b82011-03-24 11:18:59 +0000796 int action),
797
Jeff Mahoneybc074522016-06-09 17:27:55 -0400798 TP_ARGS(fs_info, ref, head_ref, action),
liubo1abe9b82011-03-24 11:18:59 +0000799
Jeff Mahoneybc074522016-06-09 17:27:55 -0400800 TP_STRUCT__entry_btrfs(
liubo1abe9b82011-03-24 11:18:59 +0000801 __field( u64, bytenr )
802 __field( u64, num_bytes )
803 __field( int, action )
804 __field( int, is_data )
805 ),
806
Jeff Mahoneybc074522016-06-09 17:27:55 -0400807 TP_fast_assign_btrfs(fs_info,
liubo1abe9b82011-03-24 11:18:59 +0000808 __entry->bytenr = ref->bytenr;
809 __entry->num_bytes = ref->num_bytes;
810 __entry->action = action;
811 __entry->is_data = head_ref->is_data;
812 ),
813
David Sterba562a7a02017-01-06 15:51:36 +0100814 TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d",
liubo1abe9b82011-03-24 11:18:59 +0000815 (unsigned long long)__entry->bytenr,
816 (unsigned long long)__entry->num_bytes,
817 show_ref_action(__entry->action),
818 __entry->is_data)
819);
820
Liu Bo599c75e2013-07-16 19:03:36 +0800821DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head,
822
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600823 TP_PROTO(const struct btrfs_fs_info *fs_info,
824 const struct btrfs_delayed_ref_node *ref,
825 const struct btrfs_delayed_ref_head *head_ref,
Liu Bo599c75e2013-07-16 19:03:36 +0800826 int action),
827
Jeff Mahoneybc074522016-06-09 17:27:55 -0400828 TP_ARGS(fs_info, ref, head_ref, action)
Liu Bo599c75e2013-07-16 19:03:36 +0800829);
830
831DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head,
832
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600833 TP_PROTO(const struct btrfs_fs_info *fs_info,
834 const struct btrfs_delayed_ref_node *ref,
835 const struct btrfs_delayed_ref_head *head_ref,
Liu Bo599c75e2013-07-16 19:03:36 +0800836 int action),
837
Jeff Mahoneybc074522016-06-09 17:27:55 -0400838 TP_ARGS(fs_info, ref, head_ref, action)
Liu Bo599c75e2013-07-16 19:03:36 +0800839);
840
liubo1abe9b82011-03-24 11:18:59 +0000841#define show_chunk_type(type) \
842 __print_flags(type, "|", \
843 { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \
844 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
845 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
846 { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \
847 { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \
848 { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \
Liu Boe112e2b2013-05-26 13:50:28 +0000849 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
850 { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \
851 { BTRFS_BLOCK_GROUP_RAID6, "RAID6" })
liubo1abe9b82011-03-24 11:18:59 +0000852
853DECLARE_EVENT_CLASS(btrfs__chunk,
854
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600855 TP_PROTO(const struct btrfs_fs_info *fs_info,
856 const struct map_lookup *map, u64 offset, u64 size),
liubo1abe9b82011-03-24 11:18:59 +0000857
Jeff Mahoney6bccf3a2016-06-21 21:16:51 -0400858 TP_ARGS(fs_info, map, offset, size),
liubo1abe9b82011-03-24 11:18:59 +0000859
Jeff Mahoneybc074522016-06-09 17:27:55 -0400860 TP_STRUCT__entry_btrfs(
liubo1abe9b82011-03-24 11:18:59 +0000861 __field( int, num_stripes )
862 __field( u64, type )
863 __field( int, sub_stripes )
864 __field( u64, offset )
865 __field( u64, size )
866 __field( u64, root_objectid )
867 ),
868
Jeff Mahoney6bccf3a2016-06-21 21:16:51 -0400869 TP_fast_assign_btrfs(fs_info,
liubo1abe9b82011-03-24 11:18:59 +0000870 __entry->num_stripes = map->num_stripes;
871 __entry->type = map->type;
872 __entry->sub_stripes = map->sub_stripes;
873 __entry->offset = offset;
874 __entry->size = size;
Jeff Mahoney6bccf3a2016-06-21 21:16:51 -0400875 __entry->root_objectid = fs_info->chunk_root->root_key.objectid;
liubo1abe9b82011-03-24 11:18:59 +0000876 ),
877
David Sterba562a7a02017-01-06 15:51:36 +0100878 TP_printk_btrfs("root=%llu(%s) offset=%llu size=%llu "
879 "num_stripes=%d sub_stripes=%d type=%s",
liubo1abe9b82011-03-24 11:18:59 +0000880 show_root_type(__entry->root_objectid),
881 (unsigned long long)__entry->offset,
882 (unsigned long long)__entry->size,
883 __entry->num_stripes, __entry->sub_stripes,
884 show_chunk_type(__entry->type))
885);
886
887DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc,
888
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600889 TP_PROTO(const struct btrfs_fs_info *fs_info,
890 const struct map_lookup *map, u64 offset, u64 size),
liubo1abe9b82011-03-24 11:18:59 +0000891
Jeff Mahoney6bccf3a2016-06-21 21:16:51 -0400892 TP_ARGS(fs_info, map, offset, size)
liubo1abe9b82011-03-24 11:18:59 +0000893);
894
895DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free,
896
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600897 TP_PROTO(const struct btrfs_fs_info *fs_info,
898 const struct map_lookup *map, u64 offset, u64 size),
liubo1abe9b82011-03-24 11:18:59 +0000899
Jeff Mahoney6bccf3a2016-06-21 21:16:51 -0400900 TP_ARGS(fs_info, map, offset, size)
liubo1abe9b82011-03-24 11:18:59 +0000901);
902
903TRACE_EVENT(btrfs_cow_block,
904
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600905 TP_PROTO(const struct btrfs_root *root, const struct extent_buffer *buf,
906 const struct extent_buffer *cow),
liubo1abe9b82011-03-24 11:18:59 +0000907
908 TP_ARGS(root, buf, cow),
909
Jeff Mahoneybc074522016-06-09 17:27:55 -0400910 TP_STRUCT__entry_btrfs(
liubo1abe9b82011-03-24 11:18:59 +0000911 __field( u64, root_objectid )
912 __field( u64, buf_start )
913 __field( int, refs )
914 __field( u64, cow_start )
915 __field( int, buf_level )
916 __field( int, cow_level )
917 ),
918
Jeff Mahoneybc074522016-06-09 17:27:55 -0400919 TP_fast_assign_btrfs(root->fs_info,
liubo1abe9b82011-03-24 11:18:59 +0000920 __entry->root_objectid = root->root_key.objectid;
921 __entry->buf_start = buf->start;
922 __entry->refs = atomic_read(&buf->refs);
923 __entry->cow_start = cow->start;
924 __entry->buf_level = btrfs_header_level(buf);
925 __entry->cow_level = btrfs_header_level(cow);
926 ),
927
David Sterba562a7a02017-01-06 15:51:36 +0100928 TP_printk_btrfs("root=%llu(%s) refs=%d orig_buf=%llu "
929 "(orig_level=%d) cow_buf=%llu (cow_level=%d)",
liubo1abe9b82011-03-24 11:18:59 +0000930 show_root_type(__entry->root_objectid),
931 __entry->refs,
932 (unsigned long long)__entry->buf_start,
933 __entry->buf_level,
934 (unsigned long long)__entry->cow_start,
935 __entry->cow_level)
936);
937
Josef Bacik8c2a3ca2012-01-10 10:31:31 -0500938TRACE_EVENT(btrfs_space_reservation,
939
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600940 TP_PROTO(const struct btrfs_fs_info *fs_info, char *type, u64 val,
Josef Bacik8c2a3ca2012-01-10 10:31:31 -0500941 u64 bytes, int reserve),
942
943 TP_ARGS(fs_info, type, val, bytes, reserve),
944
Jeff Mahoneybc074522016-06-09 17:27:55 -0400945 TP_STRUCT__entry_btrfs(
Josef Bacik8c2a3ca2012-01-10 10:31:31 -0500946 __string( type, type )
947 __field( u64, val )
948 __field( u64, bytes )
949 __field( int, reserve )
950 ),
951
Jeff Mahoneybc074522016-06-09 17:27:55 -0400952 TP_fast_assign_btrfs(fs_info,
Josef Bacik8c2a3ca2012-01-10 10:31:31 -0500953 __assign_str(type, type);
954 __entry->val = val;
955 __entry->bytes = bytes;
956 __entry->reserve = reserve;
957 ),
958
Jeff Mahoneybc074522016-06-09 17:27:55 -0400959 TP_printk_btrfs("%s: %Lu %s %Lu", __get_str(type), __entry->val,
960 __entry->reserve ? "reserve" : "release",
961 __entry->bytes)
Josef Bacik8c2a3ca2012-01-10 10:31:31 -0500962);
963
Josef Bacikf376df22016-03-25 13:25:56 -0400964#define show_flush_action(action) \
965 __print_symbolic(action, \
966 { BTRFS_RESERVE_NO_FLUSH, "BTRFS_RESERVE_NO_FLUSH"}, \
967 { BTRFS_RESERVE_FLUSH_LIMIT, "BTRFS_RESERVE_FLUSH_LIMIT"}, \
968 { BTRFS_RESERVE_FLUSH_ALL, "BTRFS_RESERVE_FLUSH_ALL"})
969
970TRACE_EVENT(btrfs_trigger_flush,
971
Jeff Mahoney9a35b632017-06-28 21:56:54 -0600972 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes,
Josef Bacikf376df22016-03-25 13:25:56 -0400973 int flush, char *reason),
974
975 TP_ARGS(fs_info, flags, bytes, flush, reason),
976
977 TP_STRUCT__entry(
978 __array( u8, fsid, BTRFS_UUID_SIZE )
979 __field( u64, flags )
980 __field( u64, bytes )
981 __field( int, flush )
982 __string( reason, reason )
983 ),
984
985 TP_fast_assign(
986 memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE);
987 __entry->flags = flags;
988 __entry->bytes = bytes;
989 __entry->flush = flush;
990 __assign_str(reason, reason)
991 ),
992
David Sterba562a7a02017-01-06 15:51:36 +0100993 TP_printk("%pU: %s: flush=%d(%s) flags=%llu(%s) bytes=%llu",
Josef Bacikf376df22016-03-25 13:25:56 -0400994 __entry->fsid, __get_str(reason), __entry->flush,
995 show_flush_action(__entry->flush),
996 (unsigned long long)__entry->flags,
997 __print_flags((unsigned long)__entry->flags, "|",
998 BTRFS_GROUP_FLAGS),
999 (unsigned long long)__entry->bytes)
1000);
1001
1002#define show_flush_state(state) \
1003 __print_symbolic(state, \
1004 { FLUSH_DELAYED_ITEMS_NR, "FLUSH_DELAYED_ITEMS_NR"}, \
1005 { FLUSH_DELAYED_ITEMS, "FLUSH_DELAYED_ITEMS"}, \
1006 { FLUSH_DELALLOC, "FLUSH_DELALLOC"}, \
1007 { FLUSH_DELALLOC_WAIT, "FLUSH_DELALLOC_WAIT"}, \
1008 { ALLOC_CHUNK, "ALLOC_CHUNK"}, \
1009 { COMMIT_TRANS, "COMMIT_TRANS"})
1010
1011TRACE_EVENT(btrfs_flush_space,
1012
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001013 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 num_bytes,
Nikolay Borisov7bdd6272017-07-11 13:25:13 +03001014 int state, int ret),
Josef Bacikf376df22016-03-25 13:25:56 -04001015
Nikolay Borisov7bdd6272017-07-11 13:25:13 +03001016 TP_ARGS(fs_info, flags, num_bytes, state, ret),
Josef Bacikf376df22016-03-25 13:25:56 -04001017
1018 TP_STRUCT__entry(
1019 __array( u8, fsid, BTRFS_UUID_SIZE )
1020 __field( u64, flags )
1021 __field( u64, num_bytes )
Josef Bacikf376df22016-03-25 13:25:56 -04001022 __field( int, state )
1023 __field( int, ret )
1024 ),
1025
1026 TP_fast_assign(
1027 memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE);
1028 __entry->flags = flags;
1029 __entry->num_bytes = num_bytes;
Josef Bacikf376df22016-03-25 13:25:56 -04001030 __entry->state = state;
1031 __entry->ret = ret;
1032 ),
1033
Nikolay Borisov7bdd6272017-07-11 13:25:13 +03001034 TP_printk("%pU: state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d",
1035 __entry->fsid, __entry->state,
Josef Bacikf376df22016-03-25 13:25:56 -04001036 show_flush_state(__entry->state),
1037 (unsigned long long)__entry->flags,
1038 __print_flags((unsigned long)__entry->flags, "|",
1039 BTRFS_GROUP_FLAGS),
Nikolay Borisov7bdd6272017-07-11 13:25:13 +03001040 (unsigned long long)__entry->num_bytes, __entry->ret)
Josef Bacikf376df22016-03-25 13:25:56 -04001041);
1042
liubo1abe9b82011-03-24 11:18:59 +00001043DECLARE_EVENT_CLASS(btrfs__reserved_extent,
1044
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001045 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
liubo1abe9b82011-03-24 11:18:59 +00001046
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001047 TP_ARGS(fs_info, start, len),
liubo1abe9b82011-03-24 11:18:59 +00001048
Jeff Mahoneybc074522016-06-09 17:27:55 -04001049 TP_STRUCT__entry_btrfs(
Jeff Mahoneybc074522016-06-09 17:27:55 -04001050 __field( u64, start )
1051 __field( u64, len )
liubo1abe9b82011-03-24 11:18:59 +00001052 ),
1053
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001054 TP_fast_assign_btrfs(fs_info,
liubo1abe9b82011-03-24 11:18:59 +00001055 __entry->start = start;
1056 __entry->len = len;
1057 ),
1058
David Sterba562a7a02017-01-06 15:51:36 +01001059 TP_printk_btrfs("root=%llu(%s) start=%llu len=%llu",
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001060 show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
liubo1abe9b82011-03-24 11:18:59 +00001061 (unsigned long long)__entry->start,
1062 (unsigned long long)__entry->len)
1063);
1064
1065DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc,
1066
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001067 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
liubo1abe9b82011-03-24 11:18:59 +00001068
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001069 TP_ARGS(fs_info, start, len)
liubo1abe9b82011-03-24 11:18:59 +00001070);
1071
1072DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free,
1073
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001074 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
liubo1abe9b82011-03-24 11:18:59 +00001075
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001076 TP_ARGS(fs_info, start, len)
liubo1abe9b82011-03-24 11:18:59 +00001077);
1078
Josef Bacik3f7de032011-11-10 08:29:20 -05001079TRACE_EVENT(find_free_extent,
1080
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001081 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes,
1082 u64 empty_size, u64 data),
Josef Bacik3f7de032011-11-10 08:29:20 -05001083
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001084 TP_ARGS(fs_info, num_bytes, empty_size, data),
Josef Bacik3f7de032011-11-10 08:29:20 -05001085
Jeff Mahoneybc074522016-06-09 17:27:55 -04001086 TP_STRUCT__entry_btrfs(
Josef Bacik3f7de032011-11-10 08:29:20 -05001087 __field( u64, num_bytes )
1088 __field( u64, empty_size )
1089 __field( u64, data )
1090 ),
1091
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001092 TP_fast_assign_btrfs(fs_info,
Josef Bacik3f7de032011-11-10 08:29:20 -05001093 __entry->num_bytes = num_bytes;
1094 __entry->empty_size = empty_size;
1095 __entry->data = data;
1096 ),
1097
David Sterba562a7a02017-01-06 15:51:36 +01001098 TP_printk_btrfs("root=%Lu(%s) len=%Lu empty_size=%Lu flags=%Lu(%s)",
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001099 show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
Josef Bacik3f7de032011-11-10 08:29:20 -05001100 __entry->num_bytes, __entry->empty_size, __entry->data,
1101 __print_flags((unsigned long)__entry->data, "|",
1102 BTRFS_GROUP_FLAGS))
1103);
1104
1105DECLARE_EVENT_CLASS(btrfs__reserve_extent,
1106
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001107 TP_PROTO(const struct btrfs_fs_info *fs_info,
1108 const struct btrfs_block_group_cache *block_group, u64 start,
Josef Bacik3f7de032011-11-10 08:29:20 -05001109 u64 len),
1110
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001111 TP_ARGS(fs_info, block_group, start, len),
Josef Bacik3f7de032011-11-10 08:29:20 -05001112
Jeff Mahoneybc074522016-06-09 17:27:55 -04001113 TP_STRUCT__entry_btrfs(
Josef Bacik3f7de032011-11-10 08:29:20 -05001114 __field( u64, bg_objectid )
1115 __field( u64, flags )
1116 __field( u64, start )
1117 __field( u64, len )
1118 ),
1119
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001120 TP_fast_assign_btrfs(fs_info,
Josef Bacik3f7de032011-11-10 08:29:20 -05001121 __entry->bg_objectid = block_group->key.objectid;
1122 __entry->flags = block_group->flags;
1123 __entry->start = start;
1124 __entry->len = len;
1125 ),
1126
David Sterba562a7a02017-01-06 15:51:36 +01001127 TP_printk_btrfs("root=%Lu(%s) block_group=%Lu flags=%Lu(%s) "
1128 "start=%Lu len=%Lu",
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001129 show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
1130 __entry->bg_objectid,
Josef Bacik3f7de032011-11-10 08:29:20 -05001131 __entry->flags, __print_flags((unsigned long)__entry->flags,
1132 "|", BTRFS_GROUP_FLAGS),
1133 __entry->start, __entry->len)
1134);
1135
1136DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent,
1137
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001138 TP_PROTO(const struct btrfs_fs_info *fs_info,
1139 const struct btrfs_block_group_cache *block_group, u64 start,
Josef Bacik3f7de032011-11-10 08:29:20 -05001140 u64 len),
1141
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001142 TP_ARGS(fs_info, block_group, start, len)
Josef Bacik3f7de032011-11-10 08:29:20 -05001143);
1144
1145DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
1146
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001147 TP_PROTO(const struct btrfs_fs_info *fs_info,
1148 const struct btrfs_block_group_cache *block_group, u64 start,
Josef Bacik3f7de032011-11-10 08:29:20 -05001149 u64 len),
1150
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001151 TP_ARGS(fs_info, block_group, start, len)
Josef Bacik3f7de032011-11-10 08:29:20 -05001152);
1153
1154TRACE_EVENT(btrfs_find_cluster,
1155
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001156 TP_PROTO(const struct btrfs_block_group_cache *block_group, u64 start,
Josef Bacik3f7de032011-11-10 08:29:20 -05001157 u64 bytes, u64 empty_size, u64 min_bytes),
1158
1159 TP_ARGS(block_group, start, bytes, empty_size, min_bytes),
1160
Jeff Mahoneybc074522016-06-09 17:27:55 -04001161 TP_STRUCT__entry_btrfs(
Josef Bacik3f7de032011-11-10 08:29:20 -05001162 __field( u64, bg_objectid )
1163 __field( u64, flags )
1164 __field( u64, start )
1165 __field( u64, bytes )
1166 __field( u64, empty_size )
1167 __field( u64, min_bytes )
1168 ),
1169
Jeff Mahoneybc074522016-06-09 17:27:55 -04001170 TP_fast_assign_btrfs(block_group->fs_info,
Josef Bacik3f7de032011-11-10 08:29:20 -05001171 __entry->bg_objectid = block_group->key.objectid;
1172 __entry->flags = block_group->flags;
1173 __entry->start = start;
1174 __entry->bytes = bytes;
1175 __entry->empty_size = empty_size;
1176 __entry->min_bytes = min_bytes;
1177 ),
1178
David Sterba562a7a02017-01-06 15:51:36 +01001179 TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) start=%Lu len=%Lu "
1180 "empty_size=%Lu min_bytes=%Lu", __entry->bg_objectid,
Josef Bacik3f7de032011-11-10 08:29:20 -05001181 __entry->flags,
1182 __print_flags((unsigned long)__entry->flags, "|",
1183 BTRFS_GROUP_FLAGS), __entry->start,
1184 __entry->bytes, __entry->empty_size, __entry->min_bytes)
1185);
1186
1187TRACE_EVENT(btrfs_failed_cluster_setup,
1188
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001189 TP_PROTO(const struct btrfs_block_group_cache *block_group),
Josef Bacik3f7de032011-11-10 08:29:20 -05001190
1191 TP_ARGS(block_group),
1192
Jeff Mahoneybc074522016-06-09 17:27:55 -04001193 TP_STRUCT__entry_btrfs(
Josef Bacik3f7de032011-11-10 08:29:20 -05001194 __field( u64, bg_objectid )
1195 ),
1196
Jeff Mahoneybc074522016-06-09 17:27:55 -04001197 TP_fast_assign_btrfs(block_group->fs_info,
Josef Bacik3f7de032011-11-10 08:29:20 -05001198 __entry->bg_objectid = block_group->key.objectid;
1199 ),
1200
David Sterba562a7a02017-01-06 15:51:36 +01001201 TP_printk_btrfs("block_group=%Lu", __entry->bg_objectid)
Josef Bacik3f7de032011-11-10 08:29:20 -05001202);
1203
1204TRACE_EVENT(btrfs_setup_cluster,
1205
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001206 TP_PROTO(const struct btrfs_block_group_cache *block_group,
1207 const struct btrfs_free_cluster *cluster,
1208 u64 size, int bitmap),
Josef Bacik3f7de032011-11-10 08:29:20 -05001209
1210 TP_ARGS(block_group, cluster, size, bitmap),
1211
Jeff Mahoneybc074522016-06-09 17:27:55 -04001212 TP_STRUCT__entry_btrfs(
Josef Bacik3f7de032011-11-10 08:29:20 -05001213 __field( u64, bg_objectid )
1214 __field( u64, flags )
1215 __field( u64, start )
1216 __field( u64, max_size )
1217 __field( u64, size )
1218 __field( int, bitmap )
1219 ),
1220
Jeff Mahoneybc074522016-06-09 17:27:55 -04001221 TP_fast_assign_btrfs(block_group->fs_info,
Josef Bacik3f7de032011-11-10 08:29:20 -05001222 __entry->bg_objectid = block_group->key.objectid;
1223 __entry->flags = block_group->flags;
1224 __entry->start = cluster->window_start;
1225 __entry->max_size = cluster->max_size;
1226 __entry->size = size;
1227 __entry->bitmap = bitmap;
1228 ),
1229
David Sterba562a7a02017-01-06 15:51:36 +01001230 TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) window_start=%Lu "
1231 "size=%Lu max_size=%Lu bitmap=%d",
Josef Bacik3f7de032011-11-10 08:29:20 -05001232 __entry->bg_objectid,
1233 __entry->flags,
1234 __print_flags((unsigned long)__entry->flags, "|",
1235 BTRFS_GROUP_FLAGS), __entry->start,
1236 __entry->size, __entry->max_size, __entry->bitmap)
1237);
1238
Jeff Mahoney143bede2012-03-01 14:56:26 +01001239struct extent_state;
1240TRACE_EVENT(alloc_extent_state,
1241
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001242 TP_PROTO(const struct extent_state *state,
1243 gfp_t mask, unsigned long IP),
Jeff Mahoney143bede2012-03-01 14:56:26 +01001244
1245 TP_ARGS(state, mask, IP),
1246
1247 TP_STRUCT__entry(
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001248 __field(const struct extent_state *, state)
Jeff Mahoney143bede2012-03-01 14:56:26 +01001249 __field(gfp_t, mask)
1250 __field(unsigned long, ip)
1251 ),
1252
1253 TP_fast_assign(
1254 __entry->state = state,
1255 __entry->mask = mask,
1256 __entry->ip = IP
1257 ),
1258
David Sterba562a7a02017-01-06 15:51:36 +01001259 TP_printk("state=%p mask=%s caller=%pS", __entry->state,
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001260 show_gfp_flags(__entry->mask), (const void *)__entry->ip)
Jeff Mahoney143bede2012-03-01 14:56:26 +01001261);
1262
1263TRACE_EVENT(free_extent_state,
1264
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001265 TP_PROTO(const struct extent_state *state, unsigned long IP),
Jeff Mahoney143bede2012-03-01 14:56:26 +01001266
1267 TP_ARGS(state, IP),
1268
1269 TP_STRUCT__entry(
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001270 __field(const struct extent_state *, state)
Jeff Mahoney143bede2012-03-01 14:56:26 +01001271 __field(unsigned long, ip)
1272 ),
1273
1274 TP_fast_assign(
1275 __entry->state = state,
1276 __entry->ip = IP
1277 ),
1278
David Sterba562a7a02017-01-06 15:51:36 +01001279 TP_printk("state=%p caller=%pS", __entry->state,
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001280 (const void *)__entry->ip)
Jeff Mahoney143bede2012-03-01 14:56:26 +01001281);
1282
Qu Wenruo52483bc2014-03-06 04:19:50 +00001283DECLARE_EVENT_CLASS(btrfs__work,
1284
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001285 TP_PROTO(const struct btrfs_work *work),
Qu Wenruo52483bc2014-03-06 04:19:50 +00001286
1287 TP_ARGS(work),
1288
Jeff Mahoneybc074522016-06-09 17:27:55 -04001289 TP_STRUCT__entry_btrfs(
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001290 __field( const void *, work )
1291 __field( const void *, wq )
1292 __field( const void *, func )
1293 __field( const void *, ordered_func )
1294 __field( const void *, ordered_free )
1295 __field( const void *, normal_work )
Qu Wenruo52483bc2014-03-06 04:19:50 +00001296 ),
1297
Jeff Mahoneybc074522016-06-09 17:27:55 -04001298 TP_fast_assign_btrfs(btrfs_work_owner(work),
Qu Wenruo52483bc2014-03-06 04:19:50 +00001299 __entry->work = work;
1300 __entry->wq = work->wq;
1301 __entry->func = work->func;
1302 __entry->ordered_func = work->ordered_func;
1303 __entry->ordered_free = work->ordered_free;
Liu Bob38a6252014-08-12 16:33:17 +08001304 __entry->normal_work = &work->normal_work;
Qu Wenruo52483bc2014-03-06 04:19:50 +00001305 ),
1306
David Sterba562a7a02017-01-06 15:51:36 +01001307 TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%pf ordered_func=%p "
1308 "ordered_free=%p",
Liu Bob38a6252014-08-12 16:33:17 +08001309 __entry->work, __entry->normal_work, __entry->wq,
1310 __entry->func, __entry->ordered_func, __entry->ordered_free)
Qu Wenruo52483bc2014-03-06 04:19:50 +00001311);
1312
David Sterbaac0c7cf2017-01-06 14:12:51 +01001313/*
1314 * For situiations when the work is freed, we pass fs_info and a tag that that
1315 * matches address of the work structure so it can be paired with the
1316 * scheduling event.
1317 */
Qu Wenruo52483bc2014-03-06 04:19:50 +00001318DECLARE_EVENT_CLASS(btrfs__work__done,
1319
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001320 TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag),
Qu Wenruo52483bc2014-03-06 04:19:50 +00001321
David Sterbaac0c7cf2017-01-06 14:12:51 +01001322 TP_ARGS(fs_info, wtag),
Qu Wenruo52483bc2014-03-06 04:19:50 +00001323
Jeff Mahoneybc074522016-06-09 17:27:55 -04001324 TP_STRUCT__entry_btrfs(
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001325 __field( const void *, wtag )
Qu Wenruo52483bc2014-03-06 04:19:50 +00001326 ),
1327
David Sterbaac0c7cf2017-01-06 14:12:51 +01001328 TP_fast_assign_btrfs(fs_info,
1329 __entry->wtag = wtag;
Qu Wenruo52483bc2014-03-06 04:19:50 +00001330 ),
1331
David Sterbaac0c7cf2017-01-06 14:12:51 +01001332 TP_printk_btrfs("work->%p", __entry->wtag)
Qu Wenruo52483bc2014-03-06 04:19:50 +00001333);
1334
1335DEFINE_EVENT(btrfs__work, btrfs_work_queued,
1336
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001337 TP_PROTO(const struct btrfs_work *work),
Qu Wenruo52483bc2014-03-06 04:19:50 +00001338
1339 TP_ARGS(work)
1340);
1341
1342DEFINE_EVENT(btrfs__work, btrfs_work_sched,
1343
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001344 TP_PROTO(const struct btrfs_work *work),
Qu Wenruo52483bc2014-03-06 04:19:50 +00001345
1346 TP_ARGS(work)
1347);
1348
Qu Wenruo52483bc2014-03-06 04:19:50 +00001349DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done,
1350
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001351 TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag),
Qu Wenruo52483bc2014-03-06 04:19:50 +00001352
David Sterbaac0c7cf2017-01-06 14:12:51 +01001353 TP_ARGS(fs_info, wtag)
Qu Wenruo52483bc2014-03-06 04:19:50 +00001354);
1355
1356DEFINE_EVENT(btrfs__work, btrfs_ordered_sched,
1357
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001358 TP_PROTO(const struct btrfs_work *work),
Qu Wenruo52483bc2014-03-06 04:19:50 +00001359
1360 TP_ARGS(work)
1361);
1362
Qu Wenruoc3a46892014-03-12 08:05:33 +00001363DECLARE_EVENT_CLASS(btrfs__workqueue,
1364
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001365 TP_PROTO(const struct __btrfs_workqueue *wq,
1366 const char *name, int high),
Qu Wenruoc3a46892014-03-12 08:05:33 +00001367
1368 TP_ARGS(wq, name, high),
1369
Jeff Mahoneybc074522016-06-09 17:27:55 -04001370 TP_STRUCT__entry_btrfs(
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001371 __field( const void *, wq )
Qu Wenruoc3a46892014-03-12 08:05:33 +00001372 __string( name, name )
1373 __field( int , high )
1374 ),
1375
Jeff Mahoneybc074522016-06-09 17:27:55 -04001376 TP_fast_assign_btrfs(btrfs_workqueue_owner(wq),
Qu Wenruoc3a46892014-03-12 08:05:33 +00001377 __entry->wq = wq;
1378 __assign_str(name, name);
1379 __entry->high = high;
1380 ),
1381
David Sterba562a7a02017-01-06 15:51:36 +01001382 TP_printk_btrfs("name=%s%s wq=%p", __get_str(name),
Qu Wenruoc3a46892014-03-12 08:05:33 +00001383 __print_flags(__entry->high, "",
1384 {(WQ_HIGHPRI), "-high"}),
1385 __entry->wq)
1386);
1387
1388DEFINE_EVENT(btrfs__workqueue, btrfs_workqueue_alloc,
1389
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001390 TP_PROTO(const struct __btrfs_workqueue *wq,
1391 const char *name, int high),
Qu Wenruoc3a46892014-03-12 08:05:33 +00001392
1393 TP_ARGS(wq, name, high)
1394);
1395
1396DECLARE_EVENT_CLASS(btrfs__workqueue_done,
1397
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001398 TP_PROTO(const struct __btrfs_workqueue *wq),
Qu Wenruoc3a46892014-03-12 08:05:33 +00001399
1400 TP_ARGS(wq),
1401
Jeff Mahoneybc074522016-06-09 17:27:55 -04001402 TP_STRUCT__entry_btrfs(
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001403 __field( const void *, wq )
Qu Wenruoc3a46892014-03-12 08:05:33 +00001404 ),
1405
Jeff Mahoneybc074522016-06-09 17:27:55 -04001406 TP_fast_assign_btrfs(btrfs_workqueue_owner(wq),
Qu Wenruoc3a46892014-03-12 08:05:33 +00001407 __entry->wq = wq;
1408 ),
1409
Jeff Mahoneybc074522016-06-09 17:27:55 -04001410 TP_printk_btrfs("wq=%p", __entry->wq)
Qu Wenruoc3a46892014-03-12 08:05:33 +00001411);
1412
1413DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy,
1414
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001415 TP_PROTO(const struct __btrfs_workqueue *wq),
Qu Wenruoc3a46892014-03-12 08:05:33 +00001416
1417 TP_ARGS(wq)
1418);
Qu Wenruo52483bc2014-03-06 04:19:50 +00001419
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001420#define BTRFS_QGROUP_OPERATIONS \
1421 { QGROUP_RESERVE, "reserve" }, \
1422 { QGROUP_RELEASE, "release" }, \
1423 { QGROUP_FREE, "free" }
1424
1425DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data,
1426
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001427 TP_PROTO(const struct inode *inode, u64 start, u64 len,
1428 u64 reserved, int op),
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001429
1430 TP_ARGS(inode, start, len, reserved, op),
1431
Jeff Mahoneybc074522016-06-09 17:27:55 -04001432 TP_STRUCT__entry_btrfs(
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001433 __field( u64, rootid )
1434 __field( unsigned long, ino )
1435 __field( u64, start )
1436 __field( u64, len )
1437 __field( u64, reserved )
1438 __field( int, op )
1439 ),
1440
Jeff Mahoneybc074522016-06-09 17:27:55 -04001441 TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001442 __entry->rootid = BTRFS_I(inode)->root->objectid;
1443 __entry->ino = inode->i_ino;
1444 __entry->start = start;
1445 __entry->len = len;
1446 __entry->reserved = reserved;
1447 __entry->op = op;
1448 ),
1449
David Sterba562a7a02017-01-06 15:51:36 +01001450 TP_printk_btrfs("root=%llu ino=%lu start=%llu len=%llu reserved=%llu op=%s",
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001451 __entry->rootid, __entry->ino, __entry->start, __entry->len,
1452 __entry->reserved,
1453 __print_flags((unsigned long)__entry->op, "",
1454 BTRFS_QGROUP_OPERATIONS)
1455 )
1456);
1457
1458DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_reserve_data,
1459
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001460 TP_PROTO(const struct inode *inode, u64 start, u64 len,
1461 u64 reserved, int op),
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001462
1463 TP_ARGS(inode, start, len, reserved, op)
1464);
1465
1466DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_release_data,
1467
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001468 TP_PROTO(const struct inode *inode, u64 start, u64 len,
1469 u64 reserved, int op),
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001470
1471 TP_ARGS(inode, start, len, reserved, op)
1472);
1473
1474DECLARE_EVENT_CLASS(btrfs__qgroup_delayed_ref,
1475
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001476 TP_PROTO(const struct btrfs_fs_info *fs_info,
1477 u64 ref_root, u64 reserved),
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001478
Jeff Mahoneybc074522016-06-09 17:27:55 -04001479 TP_ARGS(fs_info, ref_root, reserved),
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001480
Jeff Mahoneybc074522016-06-09 17:27:55 -04001481 TP_STRUCT__entry_btrfs(
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001482 __field( u64, ref_root )
1483 __field( u64, reserved )
1484 ),
1485
Jeff Mahoneybc074522016-06-09 17:27:55 -04001486 TP_fast_assign_btrfs(fs_info,
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001487 __entry->ref_root = ref_root;
1488 __entry->reserved = reserved;
1489 ),
1490
David Sterba562a7a02017-01-06 15:51:36 +01001491 TP_printk_btrfs("root=%llu reserved=%llu op=free",
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001492 __entry->ref_root, __entry->reserved)
1493);
1494
1495DEFINE_EVENT(btrfs__qgroup_delayed_ref, btrfs_qgroup_free_delayed_ref,
1496
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001497 TP_PROTO(const struct btrfs_fs_info *fs_info,
1498 u64 ref_root, u64 reserved),
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001499
Jeff Mahoneybc074522016-06-09 17:27:55 -04001500 TP_ARGS(fs_info, ref_root, reserved)
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001501);
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001502
1503DECLARE_EVENT_CLASS(btrfs_qgroup_extent,
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001504 TP_PROTO(const struct btrfs_fs_info *fs_info,
1505 const struct btrfs_qgroup_extent_record *rec),
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001506
Jeff Mahoneybc074522016-06-09 17:27:55 -04001507 TP_ARGS(fs_info, rec),
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001508
Jeff Mahoneybc074522016-06-09 17:27:55 -04001509 TP_STRUCT__entry_btrfs(
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001510 __field( u64, bytenr )
1511 __field( u64, num_bytes )
1512 ),
1513
Jeff Mahoneybc074522016-06-09 17:27:55 -04001514 TP_fast_assign_btrfs(fs_info,
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001515 __entry->bytenr = rec->bytenr,
1516 __entry->num_bytes = rec->num_bytes;
1517 ),
1518
David Sterba562a7a02017-01-06 15:51:36 +01001519 TP_printk_btrfs("bytenr=%llu num_bytes=%llu",
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001520 (unsigned long long)__entry->bytenr,
1521 (unsigned long long)__entry->num_bytes)
1522);
1523
1524DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents,
1525
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001526 TP_PROTO(const struct btrfs_fs_info *fs_info,
1527 const struct btrfs_qgroup_extent_record *rec),
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001528
Jeff Mahoneybc074522016-06-09 17:27:55 -04001529 TP_ARGS(fs_info, rec)
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001530);
1531
Qu Wenruo50b3e042016-10-18 09:31:27 +08001532DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_trace_extent,
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001533
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001534 TP_PROTO(const struct btrfs_fs_info *fs_info,
1535 const struct btrfs_qgroup_extent_record *rec),
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001536
Jeff Mahoneybc074522016-06-09 17:27:55 -04001537 TP_ARGS(fs_info, rec)
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001538);
1539
1540TRACE_EVENT(btrfs_qgroup_account_extent,
1541
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001542 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 bytenr,
Jeff Mahoneybc074522016-06-09 17:27:55 -04001543 u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots),
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001544
Jeff Mahoneybc074522016-06-09 17:27:55 -04001545 TP_ARGS(fs_info, bytenr, num_bytes, nr_old_roots, nr_new_roots),
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001546
Jeff Mahoneybc074522016-06-09 17:27:55 -04001547 TP_STRUCT__entry_btrfs(
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001548 __field( u64, bytenr )
1549 __field( u64, num_bytes )
1550 __field( u64, nr_old_roots )
1551 __field( u64, nr_new_roots )
1552 ),
1553
Jeff Mahoneybc074522016-06-09 17:27:55 -04001554 TP_fast_assign_btrfs(fs_info,
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001555 __entry->bytenr = bytenr;
1556 __entry->num_bytes = num_bytes;
1557 __entry->nr_old_roots = nr_old_roots;
1558 __entry->nr_new_roots = nr_new_roots;
1559 ),
1560
David Sterba562a7a02017-01-06 15:51:36 +01001561 TP_printk_btrfs("bytenr=%llu num_bytes=%llu nr_old_roots=%llu "
1562 "nr_new_roots=%llu",
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001563 __entry->bytenr,
1564 __entry->num_bytes,
1565 __entry->nr_old_roots,
1566 __entry->nr_new_roots)
1567);
1568
1569TRACE_EVENT(qgroup_update_counters,
1570
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001571 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 qgid,
Jeff Mahoneybc074522016-06-09 17:27:55 -04001572 u64 cur_old_count, u64 cur_new_count),
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001573
Jeff Mahoneybc074522016-06-09 17:27:55 -04001574 TP_ARGS(fs_info, qgid, cur_old_count, cur_new_count),
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001575
Jeff Mahoneybc074522016-06-09 17:27:55 -04001576 TP_STRUCT__entry_btrfs(
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001577 __field( u64, qgid )
1578 __field( u64, cur_old_count )
1579 __field( u64, cur_new_count )
1580 ),
1581
Jeff Mahoneybc074522016-06-09 17:27:55 -04001582 TP_fast_assign_btrfs(fs_info,
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001583 __entry->qgid = qgid;
1584 __entry->cur_old_count = cur_old_count;
1585 __entry->cur_new_count = cur_new_count;
1586 ),
1587
David Sterba562a7a02017-01-06 15:51:36 +01001588 TP_printk_btrfs("qgid=%llu cur_old_count=%llu cur_new_count=%llu",
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001589 __entry->qgid,
1590 __entry->cur_old_count,
1591 __entry->cur_new_count)
1592);
1593
Qu Wenruo3159fe72017-03-13 15:52:08 +08001594TRACE_EVENT(qgroup_update_reserve,
1595
1596 TP_PROTO(struct btrfs_fs_info *fs_info, struct btrfs_qgroup *qgroup,
1597 s64 diff),
1598
1599 TP_ARGS(fs_info, qgroup, diff),
1600
1601 TP_STRUCT__entry_btrfs(
1602 __field( u64, qgid )
1603 __field( u64, cur_reserved )
1604 __field( s64, diff )
1605 ),
1606
1607 TP_fast_assign_btrfs(fs_info,
1608 __entry->qgid = qgroup->qgroupid;
1609 __entry->cur_reserved = qgroup->reserved;
1610 __entry->diff = diff;
1611 ),
1612
1613 TP_printk_btrfs("qgid=%llu cur_reserved=%llu diff=%lld",
1614 __entry->qgid, __entry->cur_reserved, __entry->diff)
1615);
1616
1617TRACE_EVENT(qgroup_meta_reserve,
1618
1619 TP_PROTO(struct btrfs_root *root, s64 diff),
1620
1621 TP_ARGS(root, diff),
1622
1623 TP_STRUCT__entry_btrfs(
1624 __field( u64, refroot )
1625 __field( s64, diff )
1626 ),
1627
1628 TP_fast_assign_btrfs(root->fs_info,
1629 __entry->refroot = root->objectid;
1630 __entry->diff = diff;
1631 ),
1632
1633 TP_printk_btrfs("refroot=%llu(%s) diff=%lld",
1634 show_root_type(__entry->refroot), __entry->diff)
1635);
1636
Jeff Mahoney00142752017-07-12 16:20:08 -06001637DECLARE_EVENT_CLASS(btrfs__prelim_ref,
1638 TP_PROTO(const struct btrfs_fs_info *fs_info,
1639 const struct prelim_ref *oldref,
1640 const struct prelim_ref *newref, u64 tree_size),
1641 TP_ARGS(fs_info, newref, oldref, tree_size),
1642
1643 TP_STRUCT__entry_btrfs(
1644 __field( u64, root_id )
1645 __field( u64, objectid )
1646 __field( u8, type )
1647 __field( u64, offset )
1648 __field( int, level )
1649 __field( int, old_count )
1650 __field( u64, parent )
1651 __field( u64, bytenr )
1652 __field( int, mod_count )
1653 __field( u64, tree_size )
1654 ),
1655
1656 TP_fast_assign_btrfs(fs_info,
1657 __entry->root_id = oldref->root_id;
1658 __entry->objectid = oldref->key_for_search.objectid;
1659 __entry->type = oldref->key_for_search.type;
1660 __entry->offset = oldref->key_for_search.offset;
1661 __entry->level = oldref->level;
1662 __entry->old_count = oldref->count;
1663 __entry->parent = oldref->parent;
1664 __entry->bytenr = oldref->wanted_disk_byte;
1665 __entry->mod_count = newref ? newref->count : 0;
1666 __entry->tree_size = tree_size;
1667 ),
1668
1669 TP_printk_btrfs("root_id=%llu key=[%llu,%u,%llu] level=%d count=[%d+%d=%d] parent=%llu wanted_disk_byte=%llu nodes=%llu",
1670 (unsigned long long)__entry->root_id,
1671 (unsigned long long)__entry->objectid, __entry->type,
1672 (unsigned long long)__entry->offset, __entry->level,
1673 __entry->old_count, __entry->mod_count,
1674 __entry->old_count + __entry->mod_count,
1675 (unsigned long long)__entry->parent,
1676 (unsigned long long)__entry->bytenr,
1677 (unsigned long long)__entry->tree_size)
1678);
1679
1680DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_merge,
1681 TP_PROTO(const struct btrfs_fs_info *fs_info,
1682 const struct prelim_ref *oldref,
1683 const struct prelim_ref *newref, u64 tree_size),
1684 TP_ARGS(fs_info, oldref, newref, tree_size)
1685);
1686
1687DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_insert,
1688 TP_PROTO(const struct btrfs_fs_info *fs_info,
1689 const struct prelim_ref *oldref,
1690 const struct prelim_ref *newref, u64 tree_size),
1691 TP_ARGS(fs_info, oldref, newref, tree_size)
1692);
1693
liubo1abe9b82011-03-24 11:18:59 +00001694#endif /* _TRACE_BTRFS_H */
1695
1696/* This part must be outside protection */
1697#include <trace/define_trace.h>