blob: 90d25085762fcf396d16d39e50b4f9e08e56e413 [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,
Josef Bacikf376df22016-03-25 13:25:56 -04001014 u64 orig_bytes, int state, int ret),
1015
1016 TP_ARGS(fs_info, flags, num_bytes, orig_bytes, state, ret),
1017
1018 TP_STRUCT__entry(
1019 __array( u8, fsid, BTRFS_UUID_SIZE )
1020 __field( u64, flags )
1021 __field( u64, num_bytes )
1022 __field( u64, orig_bytes )
1023 __field( int, state )
1024 __field( int, ret )
1025 ),
1026
1027 TP_fast_assign(
1028 memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE);
1029 __entry->flags = flags;
1030 __entry->num_bytes = num_bytes;
1031 __entry->orig_bytes = orig_bytes;
1032 __entry->state = state;
1033 __entry->ret = ret;
1034 ),
1035
David Sterba562a7a02017-01-06 15:51:36 +01001036 TP_printk("%pU: state=%d(%s) flags=%llu(%s) num_bytes=%llu "
1037 "orig_bytes=%llu ret=%d", __entry->fsid, __entry->state,
Josef Bacikf376df22016-03-25 13:25:56 -04001038 show_flush_state(__entry->state),
1039 (unsigned long long)__entry->flags,
1040 __print_flags((unsigned long)__entry->flags, "|",
1041 BTRFS_GROUP_FLAGS),
1042 (unsigned long long)__entry->num_bytes,
1043 (unsigned long long)__entry->orig_bytes, __entry->ret)
1044);
1045
liubo1abe9b82011-03-24 11:18:59 +00001046DECLARE_EVENT_CLASS(btrfs__reserved_extent,
1047
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001048 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
liubo1abe9b82011-03-24 11:18:59 +00001049
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001050 TP_ARGS(fs_info, start, len),
liubo1abe9b82011-03-24 11:18:59 +00001051
Jeff Mahoneybc074522016-06-09 17:27:55 -04001052 TP_STRUCT__entry_btrfs(
Jeff Mahoneybc074522016-06-09 17:27:55 -04001053 __field( u64, start )
1054 __field( u64, len )
liubo1abe9b82011-03-24 11:18:59 +00001055 ),
1056
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001057 TP_fast_assign_btrfs(fs_info,
liubo1abe9b82011-03-24 11:18:59 +00001058 __entry->start = start;
1059 __entry->len = len;
1060 ),
1061
David Sterba562a7a02017-01-06 15:51:36 +01001062 TP_printk_btrfs("root=%llu(%s) start=%llu len=%llu",
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001063 show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
liubo1abe9b82011-03-24 11:18:59 +00001064 (unsigned long long)__entry->start,
1065 (unsigned long long)__entry->len)
1066);
1067
1068DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc,
1069
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001070 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
liubo1abe9b82011-03-24 11:18:59 +00001071
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001072 TP_ARGS(fs_info, start, len)
liubo1abe9b82011-03-24 11:18:59 +00001073);
1074
1075DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free,
1076
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001077 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
liubo1abe9b82011-03-24 11:18:59 +00001078
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001079 TP_ARGS(fs_info, start, len)
liubo1abe9b82011-03-24 11:18:59 +00001080);
1081
Josef Bacik3f7de032011-11-10 08:29:20 -05001082TRACE_EVENT(find_free_extent,
1083
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001084 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes,
1085 u64 empty_size, u64 data),
Josef Bacik3f7de032011-11-10 08:29:20 -05001086
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001087 TP_ARGS(fs_info, num_bytes, empty_size, data),
Josef Bacik3f7de032011-11-10 08:29:20 -05001088
Jeff Mahoneybc074522016-06-09 17:27:55 -04001089 TP_STRUCT__entry_btrfs(
Josef Bacik3f7de032011-11-10 08:29:20 -05001090 __field( u64, num_bytes )
1091 __field( u64, empty_size )
1092 __field( u64, data )
1093 ),
1094
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001095 TP_fast_assign_btrfs(fs_info,
Josef Bacik3f7de032011-11-10 08:29:20 -05001096 __entry->num_bytes = num_bytes;
1097 __entry->empty_size = empty_size;
1098 __entry->data = data;
1099 ),
1100
David Sterba562a7a02017-01-06 15:51:36 +01001101 TP_printk_btrfs("root=%Lu(%s) len=%Lu empty_size=%Lu flags=%Lu(%s)",
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001102 show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
Josef Bacik3f7de032011-11-10 08:29:20 -05001103 __entry->num_bytes, __entry->empty_size, __entry->data,
1104 __print_flags((unsigned long)__entry->data, "|",
1105 BTRFS_GROUP_FLAGS))
1106);
1107
1108DECLARE_EVENT_CLASS(btrfs__reserve_extent,
1109
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001110 TP_PROTO(const struct btrfs_fs_info *fs_info,
1111 const struct btrfs_block_group_cache *block_group, u64 start,
Josef Bacik3f7de032011-11-10 08:29:20 -05001112 u64 len),
1113
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001114 TP_ARGS(fs_info, block_group, start, len),
Josef Bacik3f7de032011-11-10 08:29:20 -05001115
Jeff Mahoneybc074522016-06-09 17:27:55 -04001116 TP_STRUCT__entry_btrfs(
Josef Bacik3f7de032011-11-10 08:29:20 -05001117 __field( u64, bg_objectid )
1118 __field( u64, flags )
1119 __field( u64, start )
1120 __field( u64, len )
1121 ),
1122
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001123 TP_fast_assign_btrfs(fs_info,
Josef Bacik3f7de032011-11-10 08:29:20 -05001124 __entry->bg_objectid = block_group->key.objectid;
1125 __entry->flags = block_group->flags;
1126 __entry->start = start;
1127 __entry->len = len;
1128 ),
1129
David Sterba562a7a02017-01-06 15:51:36 +01001130 TP_printk_btrfs("root=%Lu(%s) block_group=%Lu flags=%Lu(%s) "
1131 "start=%Lu len=%Lu",
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001132 show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
1133 __entry->bg_objectid,
Josef Bacik3f7de032011-11-10 08:29:20 -05001134 __entry->flags, __print_flags((unsigned long)__entry->flags,
1135 "|", BTRFS_GROUP_FLAGS),
1136 __entry->start, __entry->len)
1137);
1138
1139DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent,
1140
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001141 TP_PROTO(const struct btrfs_fs_info *fs_info,
1142 const struct btrfs_block_group_cache *block_group, u64 start,
Josef Bacik3f7de032011-11-10 08:29:20 -05001143 u64 len),
1144
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001145 TP_ARGS(fs_info, block_group, start, len)
Josef Bacik3f7de032011-11-10 08:29:20 -05001146);
1147
1148DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
1149
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001150 TP_PROTO(const struct btrfs_fs_info *fs_info,
1151 const struct btrfs_block_group_cache *block_group, u64 start,
Josef Bacik3f7de032011-11-10 08:29:20 -05001152 u64 len),
1153
Jeff Mahoney71ff6432016-09-06 16:00:42 -04001154 TP_ARGS(fs_info, block_group, start, len)
Josef Bacik3f7de032011-11-10 08:29:20 -05001155);
1156
1157TRACE_EVENT(btrfs_find_cluster,
1158
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001159 TP_PROTO(const struct btrfs_block_group_cache *block_group, u64 start,
Josef Bacik3f7de032011-11-10 08:29:20 -05001160 u64 bytes, u64 empty_size, u64 min_bytes),
1161
1162 TP_ARGS(block_group, start, bytes, empty_size, min_bytes),
1163
Jeff Mahoneybc074522016-06-09 17:27:55 -04001164 TP_STRUCT__entry_btrfs(
Josef Bacik3f7de032011-11-10 08:29:20 -05001165 __field( u64, bg_objectid )
1166 __field( u64, flags )
1167 __field( u64, start )
1168 __field( u64, bytes )
1169 __field( u64, empty_size )
1170 __field( u64, min_bytes )
1171 ),
1172
Jeff Mahoneybc074522016-06-09 17:27:55 -04001173 TP_fast_assign_btrfs(block_group->fs_info,
Josef Bacik3f7de032011-11-10 08:29:20 -05001174 __entry->bg_objectid = block_group->key.objectid;
1175 __entry->flags = block_group->flags;
1176 __entry->start = start;
1177 __entry->bytes = bytes;
1178 __entry->empty_size = empty_size;
1179 __entry->min_bytes = min_bytes;
1180 ),
1181
David Sterba562a7a02017-01-06 15:51:36 +01001182 TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) start=%Lu len=%Lu "
1183 "empty_size=%Lu min_bytes=%Lu", __entry->bg_objectid,
Josef Bacik3f7de032011-11-10 08:29:20 -05001184 __entry->flags,
1185 __print_flags((unsigned long)__entry->flags, "|",
1186 BTRFS_GROUP_FLAGS), __entry->start,
1187 __entry->bytes, __entry->empty_size, __entry->min_bytes)
1188);
1189
1190TRACE_EVENT(btrfs_failed_cluster_setup,
1191
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001192 TP_PROTO(const struct btrfs_block_group_cache *block_group),
Josef Bacik3f7de032011-11-10 08:29:20 -05001193
1194 TP_ARGS(block_group),
1195
Jeff Mahoneybc074522016-06-09 17:27:55 -04001196 TP_STRUCT__entry_btrfs(
Josef Bacik3f7de032011-11-10 08:29:20 -05001197 __field( u64, bg_objectid )
1198 ),
1199
Jeff Mahoneybc074522016-06-09 17:27:55 -04001200 TP_fast_assign_btrfs(block_group->fs_info,
Josef Bacik3f7de032011-11-10 08:29:20 -05001201 __entry->bg_objectid = block_group->key.objectid;
1202 ),
1203
David Sterba562a7a02017-01-06 15:51:36 +01001204 TP_printk_btrfs("block_group=%Lu", __entry->bg_objectid)
Josef Bacik3f7de032011-11-10 08:29:20 -05001205);
1206
1207TRACE_EVENT(btrfs_setup_cluster,
1208
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001209 TP_PROTO(const struct btrfs_block_group_cache *block_group,
1210 const struct btrfs_free_cluster *cluster,
1211 u64 size, int bitmap),
Josef Bacik3f7de032011-11-10 08:29:20 -05001212
1213 TP_ARGS(block_group, cluster, size, bitmap),
1214
Jeff Mahoneybc074522016-06-09 17:27:55 -04001215 TP_STRUCT__entry_btrfs(
Josef Bacik3f7de032011-11-10 08:29:20 -05001216 __field( u64, bg_objectid )
1217 __field( u64, flags )
1218 __field( u64, start )
1219 __field( u64, max_size )
1220 __field( u64, size )
1221 __field( int, bitmap )
1222 ),
1223
Jeff Mahoneybc074522016-06-09 17:27:55 -04001224 TP_fast_assign_btrfs(block_group->fs_info,
Josef Bacik3f7de032011-11-10 08:29:20 -05001225 __entry->bg_objectid = block_group->key.objectid;
1226 __entry->flags = block_group->flags;
1227 __entry->start = cluster->window_start;
1228 __entry->max_size = cluster->max_size;
1229 __entry->size = size;
1230 __entry->bitmap = bitmap;
1231 ),
1232
David Sterba562a7a02017-01-06 15:51:36 +01001233 TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) window_start=%Lu "
1234 "size=%Lu max_size=%Lu bitmap=%d",
Josef Bacik3f7de032011-11-10 08:29:20 -05001235 __entry->bg_objectid,
1236 __entry->flags,
1237 __print_flags((unsigned long)__entry->flags, "|",
1238 BTRFS_GROUP_FLAGS), __entry->start,
1239 __entry->size, __entry->max_size, __entry->bitmap)
1240);
1241
Jeff Mahoney143bede2012-03-01 14:56:26 +01001242struct extent_state;
1243TRACE_EVENT(alloc_extent_state,
1244
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001245 TP_PROTO(const struct extent_state *state,
1246 gfp_t mask, unsigned long IP),
Jeff Mahoney143bede2012-03-01 14:56:26 +01001247
1248 TP_ARGS(state, mask, IP),
1249
1250 TP_STRUCT__entry(
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001251 __field(const struct extent_state *, state)
Jeff Mahoney143bede2012-03-01 14:56:26 +01001252 __field(gfp_t, mask)
1253 __field(unsigned long, ip)
1254 ),
1255
1256 TP_fast_assign(
1257 __entry->state = state,
1258 __entry->mask = mask,
1259 __entry->ip = IP
1260 ),
1261
David Sterba562a7a02017-01-06 15:51:36 +01001262 TP_printk("state=%p mask=%s caller=%pS", __entry->state,
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001263 show_gfp_flags(__entry->mask), (const void *)__entry->ip)
Jeff Mahoney143bede2012-03-01 14:56:26 +01001264);
1265
1266TRACE_EVENT(free_extent_state,
1267
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001268 TP_PROTO(const struct extent_state *state, unsigned long IP),
Jeff Mahoney143bede2012-03-01 14:56:26 +01001269
1270 TP_ARGS(state, IP),
1271
1272 TP_STRUCT__entry(
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001273 __field(const struct extent_state *, state)
Jeff Mahoney143bede2012-03-01 14:56:26 +01001274 __field(unsigned long, ip)
1275 ),
1276
1277 TP_fast_assign(
1278 __entry->state = state,
1279 __entry->ip = IP
1280 ),
1281
David Sterba562a7a02017-01-06 15:51:36 +01001282 TP_printk("state=%p caller=%pS", __entry->state,
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001283 (const void *)__entry->ip)
Jeff Mahoney143bede2012-03-01 14:56:26 +01001284);
1285
Qu Wenruo52483bc2014-03-06 04:19:50 +00001286DECLARE_EVENT_CLASS(btrfs__work,
1287
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001288 TP_PROTO(const struct btrfs_work *work),
Qu Wenruo52483bc2014-03-06 04:19:50 +00001289
1290 TP_ARGS(work),
1291
Jeff Mahoneybc074522016-06-09 17:27:55 -04001292 TP_STRUCT__entry_btrfs(
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001293 __field( const void *, work )
1294 __field( const void *, wq )
1295 __field( const void *, func )
1296 __field( const void *, ordered_func )
1297 __field( const void *, ordered_free )
1298 __field( const void *, normal_work )
Qu Wenruo52483bc2014-03-06 04:19:50 +00001299 ),
1300
Jeff Mahoneybc074522016-06-09 17:27:55 -04001301 TP_fast_assign_btrfs(btrfs_work_owner(work),
Qu Wenruo52483bc2014-03-06 04:19:50 +00001302 __entry->work = work;
1303 __entry->wq = work->wq;
1304 __entry->func = work->func;
1305 __entry->ordered_func = work->ordered_func;
1306 __entry->ordered_free = work->ordered_free;
Liu Bob38a6252014-08-12 16:33:17 +08001307 __entry->normal_work = &work->normal_work;
Qu Wenruo52483bc2014-03-06 04:19:50 +00001308 ),
1309
David Sterba562a7a02017-01-06 15:51:36 +01001310 TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%pf ordered_func=%p "
1311 "ordered_free=%p",
Liu Bob38a6252014-08-12 16:33:17 +08001312 __entry->work, __entry->normal_work, __entry->wq,
1313 __entry->func, __entry->ordered_func, __entry->ordered_free)
Qu Wenruo52483bc2014-03-06 04:19:50 +00001314);
1315
David Sterbaac0c7cf2017-01-06 14:12:51 +01001316/*
1317 * For situiations when the work is freed, we pass fs_info and a tag that that
1318 * matches address of the work structure so it can be paired with the
1319 * scheduling event.
1320 */
Qu Wenruo52483bc2014-03-06 04:19:50 +00001321DECLARE_EVENT_CLASS(btrfs__work__done,
1322
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001323 TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag),
Qu Wenruo52483bc2014-03-06 04:19:50 +00001324
David Sterbaac0c7cf2017-01-06 14:12:51 +01001325 TP_ARGS(fs_info, wtag),
Qu Wenruo52483bc2014-03-06 04:19:50 +00001326
Jeff Mahoneybc074522016-06-09 17:27:55 -04001327 TP_STRUCT__entry_btrfs(
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001328 __field( const void *, wtag )
Qu Wenruo52483bc2014-03-06 04:19:50 +00001329 ),
1330
David Sterbaac0c7cf2017-01-06 14:12:51 +01001331 TP_fast_assign_btrfs(fs_info,
1332 __entry->wtag = wtag;
Qu Wenruo52483bc2014-03-06 04:19:50 +00001333 ),
1334
David Sterbaac0c7cf2017-01-06 14:12:51 +01001335 TP_printk_btrfs("work->%p", __entry->wtag)
Qu Wenruo52483bc2014-03-06 04:19:50 +00001336);
1337
1338DEFINE_EVENT(btrfs__work, btrfs_work_queued,
1339
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001340 TP_PROTO(const struct btrfs_work *work),
Qu Wenruo52483bc2014-03-06 04:19:50 +00001341
1342 TP_ARGS(work)
1343);
1344
1345DEFINE_EVENT(btrfs__work, btrfs_work_sched,
1346
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001347 TP_PROTO(const struct btrfs_work *work),
Qu Wenruo52483bc2014-03-06 04:19:50 +00001348
1349 TP_ARGS(work)
1350);
1351
Qu Wenruo52483bc2014-03-06 04:19:50 +00001352DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done,
1353
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001354 TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag),
Qu Wenruo52483bc2014-03-06 04:19:50 +00001355
David Sterbaac0c7cf2017-01-06 14:12:51 +01001356 TP_ARGS(fs_info, wtag)
Qu Wenruo52483bc2014-03-06 04:19:50 +00001357);
1358
1359DEFINE_EVENT(btrfs__work, btrfs_ordered_sched,
1360
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001361 TP_PROTO(const struct btrfs_work *work),
Qu Wenruo52483bc2014-03-06 04:19:50 +00001362
1363 TP_ARGS(work)
1364);
1365
Qu Wenruoc3a46892014-03-12 08:05:33 +00001366DECLARE_EVENT_CLASS(btrfs__workqueue,
1367
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001368 TP_PROTO(const struct __btrfs_workqueue *wq,
1369 const char *name, int high),
Qu Wenruoc3a46892014-03-12 08:05:33 +00001370
1371 TP_ARGS(wq, name, high),
1372
Jeff Mahoneybc074522016-06-09 17:27:55 -04001373 TP_STRUCT__entry_btrfs(
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001374 __field( const void *, wq )
Qu Wenruoc3a46892014-03-12 08:05:33 +00001375 __string( name, name )
1376 __field( int , high )
1377 ),
1378
Jeff Mahoneybc074522016-06-09 17:27:55 -04001379 TP_fast_assign_btrfs(btrfs_workqueue_owner(wq),
Qu Wenruoc3a46892014-03-12 08:05:33 +00001380 __entry->wq = wq;
1381 __assign_str(name, name);
1382 __entry->high = high;
1383 ),
1384
David Sterba562a7a02017-01-06 15:51:36 +01001385 TP_printk_btrfs("name=%s%s wq=%p", __get_str(name),
Qu Wenruoc3a46892014-03-12 08:05:33 +00001386 __print_flags(__entry->high, "",
1387 {(WQ_HIGHPRI), "-high"}),
1388 __entry->wq)
1389);
1390
1391DEFINE_EVENT(btrfs__workqueue, btrfs_workqueue_alloc,
1392
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001393 TP_PROTO(const struct __btrfs_workqueue *wq,
1394 const char *name, int high),
Qu Wenruoc3a46892014-03-12 08:05:33 +00001395
1396 TP_ARGS(wq, name, high)
1397);
1398
1399DECLARE_EVENT_CLASS(btrfs__workqueue_done,
1400
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001401 TP_PROTO(const struct __btrfs_workqueue *wq),
Qu Wenruoc3a46892014-03-12 08:05:33 +00001402
1403 TP_ARGS(wq),
1404
Jeff Mahoneybc074522016-06-09 17:27:55 -04001405 TP_STRUCT__entry_btrfs(
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001406 __field( const void *, wq )
Qu Wenruoc3a46892014-03-12 08:05:33 +00001407 ),
1408
Jeff Mahoneybc074522016-06-09 17:27:55 -04001409 TP_fast_assign_btrfs(btrfs_workqueue_owner(wq),
Qu Wenruoc3a46892014-03-12 08:05:33 +00001410 __entry->wq = wq;
1411 ),
1412
Jeff Mahoneybc074522016-06-09 17:27:55 -04001413 TP_printk_btrfs("wq=%p", __entry->wq)
Qu Wenruoc3a46892014-03-12 08:05:33 +00001414);
1415
1416DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy,
1417
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001418 TP_PROTO(const struct __btrfs_workqueue *wq),
Qu Wenruoc3a46892014-03-12 08:05:33 +00001419
1420 TP_ARGS(wq)
1421);
Qu Wenruo52483bc2014-03-06 04:19:50 +00001422
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001423#define BTRFS_QGROUP_OPERATIONS \
1424 { QGROUP_RESERVE, "reserve" }, \
1425 { QGROUP_RELEASE, "release" }, \
1426 { QGROUP_FREE, "free" }
1427
1428DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data,
1429
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001430 TP_PROTO(const struct inode *inode, u64 start, u64 len,
1431 u64 reserved, int op),
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001432
1433 TP_ARGS(inode, start, len, reserved, op),
1434
Jeff Mahoneybc074522016-06-09 17:27:55 -04001435 TP_STRUCT__entry_btrfs(
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001436 __field( u64, rootid )
1437 __field( unsigned long, ino )
1438 __field( u64, start )
1439 __field( u64, len )
1440 __field( u64, reserved )
1441 __field( int, op )
1442 ),
1443
Jeff Mahoneybc074522016-06-09 17:27:55 -04001444 TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001445 __entry->rootid = BTRFS_I(inode)->root->objectid;
1446 __entry->ino = inode->i_ino;
1447 __entry->start = start;
1448 __entry->len = len;
1449 __entry->reserved = reserved;
1450 __entry->op = op;
1451 ),
1452
David Sterba562a7a02017-01-06 15:51:36 +01001453 TP_printk_btrfs("root=%llu ino=%lu start=%llu len=%llu reserved=%llu op=%s",
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001454 __entry->rootid, __entry->ino, __entry->start, __entry->len,
1455 __entry->reserved,
1456 __print_flags((unsigned long)__entry->op, "",
1457 BTRFS_QGROUP_OPERATIONS)
1458 )
1459);
1460
1461DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_reserve_data,
1462
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001463 TP_PROTO(const struct inode *inode, u64 start, u64 len,
1464 u64 reserved, int op),
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001465
1466 TP_ARGS(inode, start, len, reserved, op)
1467);
1468
1469DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_release_data,
1470
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001471 TP_PROTO(const struct inode *inode, u64 start, u64 len,
1472 u64 reserved, int op),
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001473
1474 TP_ARGS(inode, start, len, reserved, op)
1475);
1476
1477DECLARE_EVENT_CLASS(btrfs__qgroup_delayed_ref,
1478
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001479 TP_PROTO(const struct btrfs_fs_info *fs_info,
1480 u64 ref_root, u64 reserved),
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001481
Jeff Mahoneybc074522016-06-09 17:27:55 -04001482 TP_ARGS(fs_info, ref_root, reserved),
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001483
Jeff Mahoneybc074522016-06-09 17:27:55 -04001484 TP_STRUCT__entry_btrfs(
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001485 __field( u64, ref_root )
1486 __field( u64, reserved )
1487 ),
1488
Jeff Mahoneybc074522016-06-09 17:27:55 -04001489 TP_fast_assign_btrfs(fs_info,
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001490 __entry->ref_root = ref_root;
1491 __entry->reserved = reserved;
1492 ),
1493
David Sterba562a7a02017-01-06 15:51:36 +01001494 TP_printk_btrfs("root=%llu reserved=%llu op=free",
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001495 __entry->ref_root, __entry->reserved)
1496);
1497
1498DEFINE_EVENT(btrfs__qgroup_delayed_ref, btrfs_qgroup_free_delayed_ref,
1499
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001500 TP_PROTO(const struct btrfs_fs_info *fs_info,
1501 u64 ref_root, u64 reserved),
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001502
Jeff Mahoneybc074522016-06-09 17:27:55 -04001503 TP_ARGS(fs_info, ref_root, reserved)
Qu Wenruo81fb6f72015-09-28 16:57:53 +08001504);
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001505
1506DECLARE_EVENT_CLASS(btrfs_qgroup_extent,
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001507 TP_PROTO(const struct btrfs_fs_info *fs_info,
1508 const struct btrfs_qgroup_extent_record *rec),
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001509
Jeff Mahoneybc074522016-06-09 17:27:55 -04001510 TP_ARGS(fs_info, rec),
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001511
Jeff Mahoneybc074522016-06-09 17:27:55 -04001512 TP_STRUCT__entry_btrfs(
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001513 __field( u64, bytenr )
1514 __field( u64, num_bytes )
1515 ),
1516
Jeff Mahoneybc074522016-06-09 17:27:55 -04001517 TP_fast_assign_btrfs(fs_info,
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001518 __entry->bytenr = rec->bytenr,
1519 __entry->num_bytes = rec->num_bytes;
1520 ),
1521
David Sterba562a7a02017-01-06 15:51:36 +01001522 TP_printk_btrfs("bytenr=%llu num_bytes=%llu",
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001523 (unsigned long long)__entry->bytenr,
1524 (unsigned long long)__entry->num_bytes)
1525);
1526
1527DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents,
1528
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001529 TP_PROTO(const struct btrfs_fs_info *fs_info,
1530 const struct btrfs_qgroup_extent_record *rec),
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001531
Jeff Mahoneybc074522016-06-09 17:27:55 -04001532 TP_ARGS(fs_info, rec)
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001533);
1534
Qu Wenruo50b3e042016-10-18 09:31:27 +08001535DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_trace_extent,
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001536
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001537 TP_PROTO(const struct btrfs_fs_info *fs_info,
1538 const struct btrfs_qgroup_extent_record *rec),
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001539
Jeff Mahoneybc074522016-06-09 17:27:55 -04001540 TP_ARGS(fs_info, rec)
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001541);
1542
1543TRACE_EVENT(btrfs_qgroup_account_extent,
1544
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001545 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 bytenr,
Jeff Mahoneybc074522016-06-09 17:27:55 -04001546 u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots),
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001547
Jeff Mahoneybc074522016-06-09 17:27:55 -04001548 TP_ARGS(fs_info, bytenr, num_bytes, nr_old_roots, nr_new_roots),
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001549
Jeff Mahoneybc074522016-06-09 17:27:55 -04001550 TP_STRUCT__entry_btrfs(
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001551 __field( u64, bytenr )
1552 __field( u64, num_bytes )
1553 __field( u64, nr_old_roots )
1554 __field( u64, nr_new_roots )
1555 ),
1556
Jeff Mahoneybc074522016-06-09 17:27:55 -04001557 TP_fast_assign_btrfs(fs_info,
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001558 __entry->bytenr = bytenr;
1559 __entry->num_bytes = num_bytes;
1560 __entry->nr_old_roots = nr_old_roots;
1561 __entry->nr_new_roots = nr_new_roots;
1562 ),
1563
David Sterba562a7a02017-01-06 15:51:36 +01001564 TP_printk_btrfs("bytenr=%llu num_bytes=%llu nr_old_roots=%llu "
1565 "nr_new_roots=%llu",
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001566 __entry->bytenr,
1567 __entry->num_bytes,
1568 __entry->nr_old_roots,
1569 __entry->nr_new_roots)
1570);
1571
1572TRACE_EVENT(qgroup_update_counters,
1573
Jeff Mahoney9a35b632017-06-28 21:56:54 -06001574 TP_PROTO(const struct btrfs_fs_info *fs_info, u64 qgid,
Jeff Mahoneybc074522016-06-09 17:27:55 -04001575 u64 cur_old_count, u64 cur_new_count),
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001576
Jeff Mahoneybc074522016-06-09 17:27:55 -04001577 TP_ARGS(fs_info, qgid, cur_old_count, cur_new_count),
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001578
Jeff Mahoneybc074522016-06-09 17:27:55 -04001579 TP_STRUCT__entry_btrfs(
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001580 __field( u64, qgid )
1581 __field( u64, cur_old_count )
1582 __field( u64, cur_new_count )
1583 ),
1584
Jeff Mahoneybc074522016-06-09 17:27:55 -04001585 TP_fast_assign_btrfs(fs_info,
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001586 __entry->qgid = qgid;
1587 __entry->cur_old_count = cur_old_count;
1588 __entry->cur_new_count = cur_new_count;
1589 ),
1590
David Sterba562a7a02017-01-06 15:51:36 +01001591 TP_printk_btrfs("qgid=%llu cur_old_count=%llu cur_new_count=%llu",
Mark Fasheh0f5dcf82016-03-29 17:19:55 -07001592 __entry->qgid,
1593 __entry->cur_old_count,
1594 __entry->cur_new_count)
1595);
1596
Qu Wenruo3159fe72017-03-13 15:52:08 +08001597TRACE_EVENT(qgroup_update_reserve,
1598
1599 TP_PROTO(struct btrfs_fs_info *fs_info, struct btrfs_qgroup *qgroup,
1600 s64 diff),
1601
1602 TP_ARGS(fs_info, qgroup, diff),
1603
1604 TP_STRUCT__entry_btrfs(
1605 __field( u64, qgid )
1606 __field( u64, cur_reserved )
1607 __field( s64, diff )
1608 ),
1609
1610 TP_fast_assign_btrfs(fs_info,
1611 __entry->qgid = qgroup->qgroupid;
1612 __entry->cur_reserved = qgroup->reserved;
1613 __entry->diff = diff;
1614 ),
1615
1616 TP_printk_btrfs("qgid=%llu cur_reserved=%llu diff=%lld",
1617 __entry->qgid, __entry->cur_reserved, __entry->diff)
1618);
1619
1620TRACE_EVENT(qgroup_meta_reserve,
1621
1622 TP_PROTO(struct btrfs_root *root, s64 diff),
1623
1624 TP_ARGS(root, diff),
1625
1626 TP_STRUCT__entry_btrfs(
1627 __field( u64, refroot )
1628 __field( s64, diff )
1629 ),
1630
1631 TP_fast_assign_btrfs(root->fs_info,
1632 __entry->refroot = root->objectid;
1633 __entry->diff = diff;
1634 ),
1635
1636 TP_printk_btrfs("refroot=%llu(%s) diff=%lld",
1637 show_root_type(__entry->refroot), __entry->diff)
1638);
1639
Jeff Mahoney00142752017-07-12 16:20:08 -06001640DECLARE_EVENT_CLASS(btrfs__prelim_ref,
1641 TP_PROTO(const struct btrfs_fs_info *fs_info,
1642 const struct prelim_ref *oldref,
1643 const struct prelim_ref *newref, u64 tree_size),
1644 TP_ARGS(fs_info, newref, oldref, tree_size),
1645
1646 TP_STRUCT__entry_btrfs(
1647 __field( u64, root_id )
1648 __field( u64, objectid )
1649 __field( u8, type )
1650 __field( u64, offset )
1651 __field( int, level )
1652 __field( int, old_count )
1653 __field( u64, parent )
1654 __field( u64, bytenr )
1655 __field( int, mod_count )
1656 __field( u64, tree_size )
1657 ),
1658
1659 TP_fast_assign_btrfs(fs_info,
1660 __entry->root_id = oldref->root_id;
1661 __entry->objectid = oldref->key_for_search.objectid;
1662 __entry->type = oldref->key_for_search.type;
1663 __entry->offset = oldref->key_for_search.offset;
1664 __entry->level = oldref->level;
1665 __entry->old_count = oldref->count;
1666 __entry->parent = oldref->parent;
1667 __entry->bytenr = oldref->wanted_disk_byte;
1668 __entry->mod_count = newref ? newref->count : 0;
1669 __entry->tree_size = tree_size;
1670 ),
1671
1672 TP_printk_btrfs("root_id=%llu key=[%llu,%u,%llu] level=%d count=[%d+%d=%d] parent=%llu wanted_disk_byte=%llu nodes=%llu",
1673 (unsigned long long)__entry->root_id,
1674 (unsigned long long)__entry->objectid, __entry->type,
1675 (unsigned long long)__entry->offset, __entry->level,
1676 __entry->old_count, __entry->mod_count,
1677 __entry->old_count + __entry->mod_count,
1678 (unsigned long long)__entry->parent,
1679 (unsigned long long)__entry->bytenr,
1680 (unsigned long long)__entry->tree_size)
1681);
1682
1683DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_merge,
1684 TP_PROTO(const struct btrfs_fs_info *fs_info,
1685 const struct prelim_ref *oldref,
1686 const struct prelim_ref *newref, u64 tree_size),
1687 TP_ARGS(fs_info, oldref, newref, tree_size)
1688);
1689
1690DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_insert,
1691 TP_PROTO(const struct btrfs_fs_info *fs_info,
1692 const struct prelim_ref *oldref,
1693 const struct prelim_ref *newref, u64 tree_size),
1694 TP_ARGS(fs_info, oldref, newref, tree_size)
1695);
1696
liubo1abe9b82011-03-24 11:18:59 +00001697#endif /* _TRACE_BTRFS_H */
1698
1699/* This part must be outside protection */
1700#include <trace/define_trace.h>