xref: /openbmc/linux/include/trace/events/btrfs.h (revision b94417ea)
11abe9b8aSliubo #undef TRACE_SYSTEM
21abe9b8aSliubo #define TRACE_SYSTEM btrfs
31abe9b8aSliubo 
41abe9b8aSliubo #if !defined(_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ)
51abe9b8aSliubo #define _TRACE_BTRFS_H
61abe9b8aSliubo 
71abe9b8aSliubo #include <linux/writeback.h>
81abe9b8aSliubo #include <linux/tracepoint.h>
9420adbe9SVlastimil Babka #include <trace/events/mmflags.h>
101abe9b8aSliubo 
111abe9b8aSliubo struct btrfs_root;
121abe9b8aSliubo struct btrfs_fs_info;
131abe9b8aSliubo struct btrfs_inode;
141abe9b8aSliubo struct extent_map;
1509ed2f16SLiu Bo struct btrfs_file_extent_item;
161abe9b8aSliubo struct btrfs_ordered_extent;
171abe9b8aSliubo struct btrfs_delayed_ref_node;
181abe9b8aSliubo struct btrfs_delayed_tree_ref;
191abe9b8aSliubo struct btrfs_delayed_data_ref;
201abe9b8aSliubo struct btrfs_delayed_ref_head;
213f7de037SJosef Bacik struct btrfs_block_group_cache;
223f7de037SJosef Bacik struct btrfs_free_cluster;
231abe9b8aSliubo struct map_lookup;
241abe9b8aSliubo struct extent_buffer;
2552483bc2SQu Wenruo struct btrfs_work;
26c3a46891SQu Wenruo struct __btrfs_workqueue;
270f5dcf8dSMark Fasheh struct btrfs_qgroup_extent_record;
283159fe7bSQu Wenruo struct btrfs_qgroup;
2900142756SJeff Mahoney struct prelim_ref;
301abe9b8aSliubo 
311abe9b8aSliubo #define show_ref_type(type)						\
321abe9b8aSliubo 	__print_symbolic(type,						\
331abe9b8aSliubo 		{ BTRFS_TREE_BLOCK_REF_KEY, 	"TREE_BLOCK_REF" },	\
341abe9b8aSliubo 		{ BTRFS_EXTENT_DATA_REF_KEY, 	"EXTENT_DATA_REF" },	\
351abe9b8aSliubo 		{ BTRFS_EXTENT_REF_V0_KEY, 	"EXTENT_REF_V0" },	\
361abe9b8aSliubo 		{ BTRFS_SHARED_BLOCK_REF_KEY, 	"SHARED_BLOCK_REF" },	\
371abe9b8aSliubo 		{ BTRFS_SHARED_DATA_REF_KEY, 	"SHARED_DATA_REF" })
381abe9b8aSliubo 
391abe9b8aSliubo #define __show_root_type(obj)						\
407f34b746Sliubo 	__print_symbolic_u64(obj,					\
411abe9b8aSliubo 		{ BTRFS_ROOT_TREE_OBJECTID, 	"ROOT_TREE"	},	\
421abe9b8aSliubo 		{ BTRFS_EXTENT_TREE_OBJECTID, 	"EXTENT_TREE"	},	\
431abe9b8aSliubo 		{ BTRFS_CHUNK_TREE_OBJECTID, 	"CHUNK_TREE"	},	\
441abe9b8aSliubo 		{ BTRFS_DEV_TREE_OBJECTID, 	"DEV_TREE"	},	\
451abe9b8aSliubo 		{ BTRFS_FS_TREE_OBJECTID, 	"FS_TREE"	},	\
461abe9b8aSliubo 		{ BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR"	},	\
471abe9b8aSliubo 		{ BTRFS_CSUM_TREE_OBJECTID, 	"CSUM_TREE"	},	\
481abe9b8aSliubo 		{ BTRFS_TREE_LOG_OBJECTID,	"TREE_LOG"	},	\
49e112e2b4SLiu Bo 		{ BTRFS_QUOTA_TREE_OBJECTID,	"QUOTA_TREE"	},	\
501abe9b8aSliubo 		{ BTRFS_TREE_RELOC_OBJECTID,	"TREE_RELOC"	},	\
51208acb8cSOmar Sandoval 		{ BTRFS_UUID_TREE_OBJECTID,	"UUID_TREE"	},	\
52208acb8cSOmar Sandoval 		{ BTRFS_FREE_SPACE_TREE_OBJECTID, "FREE_SPACE_TREE" },	\
531abe9b8aSliubo 		{ BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
541abe9b8aSliubo 
551abe9b8aSliubo #define show_root_type(obj)						\
561abe9b8aSliubo 	obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) ||		\
57fb57dc81SLiu Bo 	      (obj >= BTRFS_ROOT_TREE_OBJECTID &&			\
58e112e2b4SLiu Bo 	       obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
591abe9b8aSliubo 
6009ed2f16SLiu Bo #define show_fi_type(type)						\
6109ed2f16SLiu Bo 	__print_symbolic(type,						\
6209ed2f16SLiu Bo 		 { BTRFS_FILE_EXTENT_INLINE,	"INLINE" },		\
6309ed2f16SLiu Bo 		 { BTRFS_FILE_EXTENT_REG,	"REG"	 },		\
6409ed2f16SLiu Bo 		 { BTRFS_FILE_EXTENT_PREALLOC,	"PREALLOC"})
6509ed2f16SLiu Bo 
663f7de037SJosef Bacik #define BTRFS_GROUP_FLAGS	\
673f7de037SJosef Bacik 	{ BTRFS_BLOCK_GROUP_DATA,	"DATA"},	\
683f7de037SJosef Bacik 	{ BTRFS_BLOCK_GROUP_SYSTEM,	"SYSTEM"},	\
693f7de037SJosef Bacik 	{ BTRFS_BLOCK_GROUP_METADATA,	"METADATA"},	\
703f7de037SJosef Bacik 	{ BTRFS_BLOCK_GROUP_RAID0,	"RAID0"}, 	\
713f7de037SJosef Bacik 	{ BTRFS_BLOCK_GROUP_RAID1,	"RAID1"}, 	\
723f7de037SJosef Bacik 	{ BTRFS_BLOCK_GROUP_DUP,	"DUP"}, 	\
73e112e2b4SLiu Bo 	{ BTRFS_BLOCK_GROUP_RAID10,	"RAID10"}, 	\
74e112e2b4SLiu Bo 	{ BTRFS_BLOCK_GROUP_RAID5,	"RAID5"},	\
75e112e2b4SLiu Bo 	{ BTRFS_BLOCK_GROUP_RAID6,	"RAID6"}
763f7de037SJosef Bacik 
77b94417eaSAnand Jain #define BTRFS_FSID_SIZE 16
78b94417eaSAnand Jain #define TP_STRUCT__entry_fsid __array(u8, fsid, BTRFS_FSID_SIZE)
79bc074524SJeff Mahoney 
80bc074524SJeff Mahoney #define TP_fast_assign_fsid(fs_info)					\
81b94417eaSAnand Jain 	memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE)
82bc074524SJeff Mahoney 
83bc074524SJeff Mahoney #define TP_STRUCT__entry_btrfs(args...)					\
84bc074524SJeff Mahoney 	TP_STRUCT__entry(						\
85bc074524SJeff Mahoney 		TP_STRUCT__entry_fsid					\
86bc074524SJeff Mahoney 		args)
87bc074524SJeff Mahoney #define TP_fast_assign_btrfs(fs_info, args...)				\
88bc074524SJeff Mahoney 	TP_fast_assign(							\
89bc074524SJeff Mahoney 		TP_fast_assign_fsid(fs_info);				\
90bc074524SJeff Mahoney 		args)
91bc074524SJeff Mahoney #define TP_printk_btrfs(fmt, args...) \
92bc074524SJeff Mahoney 	TP_printk("%pU: " fmt, __entry->fsid, args)
938c2a3ca2SJosef Bacik 
941abe9b8aSliubo TRACE_EVENT(btrfs_transaction_commit,
951abe9b8aSliubo 
969a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_root *root),
971abe9b8aSliubo 
981abe9b8aSliubo 	TP_ARGS(root),
991abe9b8aSliubo 
100bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
1011abe9b8aSliubo 		__field(	u64,  generation		)
1021abe9b8aSliubo 		__field(	u64,  root_objectid		)
1031abe9b8aSliubo 	),
1041abe9b8aSliubo 
105bc074524SJeff Mahoney 	TP_fast_assign_btrfs(root->fs_info,
1061abe9b8aSliubo 		__entry->generation	= root->fs_info->generation;
1071abe9b8aSliubo 		__entry->root_objectid	= root->root_key.objectid;
1081abe9b8aSliubo 	),
1091abe9b8aSliubo 
110bc074524SJeff Mahoney 	TP_printk_btrfs("root = %llu(%s), gen = %llu",
1111abe9b8aSliubo 		  show_root_type(__entry->root_objectid),
1121abe9b8aSliubo 		  (unsigned long long)__entry->generation)
1131abe9b8aSliubo );
1141abe9b8aSliubo 
1151abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__inode,
1161abe9b8aSliubo 
1179a35b637SJeff Mahoney 	TP_PROTO(const struct inode *inode),
1181abe9b8aSliubo 
1191abe9b8aSliubo 	TP_ARGS(inode),
1201abe9b8aSliubo 
121bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
1221abe9b8aSliubo 		__field(	ino_t,  ino			)
1231abe9b8aSliubo 		__field(	blkcnt_t,  blocks		)
1241abe9b8aSliubo 		__field(	u64,  disk_i_size		)
1251abe9b8aSliubo 		__field(	u64,  generation		)
1261abe9b8aSliubo 		__field(	u64,  last_trans		)
1271abe9b8aSliubo 		__field(	u64,  logged_trans		)
1281abe9b8aSliubo 		__field(	u64,  root_objectid		)
1291abe9b8aSliubo 	),
1301abe9b8aSliubo 
131bc074524SJeff Mahoney 	TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
1321abe9b8aSliubo 		__entry->ino	= inode->i_ino;
1331abe9b8aSliubo 		__entry->blocks	= inode->i_blocks;
1341abe9b8aSliubo 		__entry->disk_i_size  = BTRFS_I(inode)->disk_i_size;
1351abe9b8aSliubo 		__entry->generation = BTRFS_I(inode)->generation;
1361abe9b8aSliubo 		__entry->last_trans = BTRFS_I(inode)->last_trans;
1371abe9b8aSliubo 		__entry->logged_trans = BTRFS_I(inode)->logged_trans;
1381abe9b8aSliubo 		__entry->root_objectid =
1391abe9b8aSliubo 				BTRFS_I(inode)->root->root_key.objectid;
1401abe9b8aSliubo 	),
1411abe9b8aSliubo 
142562a7a07SDavid Sterba 	TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%lu blocks=%llu "
143562a7a07SDavid Sterba 		  "disk_i_size=%llu last_trans=%llu logged_trans=%llu",
1441abe9b8aSliubo 		  show_root_type(__entry->root_objectid),
1451abe9b8aSliubo 		  (unsigned long long)__entry->generation,
1461abe9b8aSliubo 		  (unsigned long)__entry->ino,
1471abe9b8aSliubo 		  (unsigned long long)__entry->blocks,
1481abe9b8aSliubo 		  (unsigned long long)__entry->disk_i_size,
1491abe9b8aSliubo 		  (unsigned long long)__entry->last_trans,
1501abe9b8aSliubo 		  (unsigned long long)__entry->logged_trans)
1511abe9b8aSliubo );
1521abe9b8aSliubo 
1531abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_new,
1541abe9b8aSliubo 
1559a35b637SJeff Mahoney 	TP_PROTO(const struct inode *inode),
1561abe9b8aSliubo 
1571abe9b8aSliubo 	TP_ARGS(inode)
1581abe9b8aSliubo );
1591abe9b8aSliubo 
1601abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_request,
1611abe9b8aSliubo 
1629a35b637SJeff Mahoney 	TP_PROTO(const struct inode *inode),
1631abe9b8aSliubo 
1641abe9b8aSliubo 	TP_ARGS(inode)
1651abe9b8aSliubo );
1661abe9b8aSliubo 
1671abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_evict,
1681abe9b8aSliubo 
1699a35b637SJeff Mahoney 	TP_PROTO(const struct inode *inode),
1701abe9b8aSliubo 
1711abe9b8aSliubo 	TP_ARGS(inode)
1721abe9b8aSliubo );
1731abe9b8aSliubo 
1741abe9b8aSliubo #define __show_map_type(type)						\
1757f34b746Sliubo 	__print_symbolic_u64(type,					\
1761abe9b8aSliubo 		{ EXTENT_MAP_LAST_BYTE, "LAST_BYTE" 	},		\
1771abe9b8aSliubo 		{ EXTENT_MAP_HOLE, 	"HOLE" 		},		\
1781abe9b8aSliubo 		{ EXTENT_MAP_INLINE, 	"INLINE" 	},		\
1791abe9b8aSliubo 		{ EXTENT_MAP_DELALLOC,	"DELALLOC" 	})
1801abe9b8aSliubo 
1811abe9b8aSliubo #define show_map_type(type)			\
1821abe9b8aSliubo 	type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" :  __show_map_type(type)
1831abe9b8aSliubo 
1841abe9b8aSliubo #define show_map_flags(flag)						\
1851abe9b8aSliubo 	__print_flags(flag, "|",					\
186254a2d14SLiu Bo 		{ (1 << EXTENT_FLAG_PINNED), 		"PINNED" 	},\
187254a2d14SLiu Bo 		{ (1 << EXTENT_FLAG_COMPRESSED), 	"COMPRESSED" 	},\
188254a2d14SLiu Bo 		{ (1 << EXTENT_FLAG_VACANCY), 		"VACANCY" 	},\
189254a2d14SLiu Bo 		{ (1 << EXTENT_FLAG_PREALLOC), 		"PREALLOC" 	},\
190254a2d14SLiu Bo 		{ (1 << EXTENT_FLAG_LOGGING),	 	"LOGGING" 	},\
191254a2d14SLiu Bo 		{ (1 << EXTENT_FLAG_FILLING),	 	"FILLING" 	},\
192254a2d14SLiu Bo 		{ (1 << EXTENT_FLAG_FS_MAPPING),	"FS_MAPPING"	})
1931abe9b8aSliubo 
1944cd8587cSSteven Rostedt TRACE_EVENT_CONDITION(btrfs_get_extent,
1951abe9b8aSliubo 
1969a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_root *root, const struct btrfs_inode *inode,
1979a35b637SJeff Mahoney 		 const struct extent_map *map),
1981abe9b8aSliubo 
19992a1bf76SLiu Bo 	TP_ARGS(root, inode, map),
2001abe9b8aSliubo 
2014cd8587cSSteven Rostedt 	TP_CONDITION(map),
2024cd8587cSSteven Rostedt 
203bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
2041abe9b8aSliubo 		__field(	u64,  root_objectid	)
20592a1bf76SLiu Bo 		__field(	u64,  ino		)
2061abe9b8aSliubo 		__field(	u64,  start		)
2071abe9b8aSliubo 		__field(	u64,  len		)
2081abe9b8aSliubo 		__field(	u64,  orig_start	)
2091abe9b8aSliubo 		__field(	u64,  block_start	)
2101abe9b8aSliubo 		__field(	u64,  block_len		)
2111abe9b8aSliubo 		__field(	unsigned long,  flags	)
2121abe9b8aSliubo 		__field(	int,  refs		)
2131abe9b8aSliubo 		__field(	unsigned int,  compress_type	)
2141abe9b8aSliubo 	),
2151abe9b8aSliubo 
216bc074524SJeff Mahoney 	TP_fast_assign_btrfs(root->fs_info,
2171abe9b8aSliubo 		__entry->root_objectid	= root->root_key.objectid;
21892a1bf76SLiu Bo 		__entry->ino		= btrfs_ino(inode);
2191abe9b8aSliubo 		__entry->start		= map->start;
2201abe9b8aSliubo 		__entry->len		= map->len;
2211abe9b8aSliubo 		__entry->orig_start	= map->orig_start;
2221abe9b8aSliubo 		__entry->block_start	= map->block_start;
2231abe9b8aSliubo 		__entry->block_len	= map->block_len;
2241abe9b8aSliubo 		__entry->flags		= map->flags;
225490b54d6SElena Reshetova 		__entry->refs		= refcount_read(&map->refs);
2261abe9b8aSliubo 		__entry->compress_type	= map->compress_type;
2271abe9b8aSliubo 	),
2281abe9b8aSliubo 
229562a7a07SDavid Sterba 	TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu "
230562a7a07SDavid Sterba 		  "orig_start=%llu block_start=%llu(%s) "
231562a7a07SDavid Sterba 		  "block_len=%llu flags=%s refs=%u "
2321abe9b8aSliubo 		  "compress_type=%u",
2331abe9b8aSliubo 		  show_root_type(__entry->root_objectid),
23492a1bf76SLiu Bo 		  (unsigned long long)__entry->ino,
2351abe9b8aSliubo 		  (unsigned long long)__entry->start,
2361abe9b8aSliubo 		  (unsigned long long)__entry->len,
2371abe9b8aSliubo 		  (unsigned long long)__entry->orig_start,
2381abe9b8aSliubo 		  show_map_type(__entry->block_start),
2391abe9b8aSliubo 		  (unsigned long long)__entry->block_len,
2401abe9b8aSliubo 		  show_map_flags(__entry->flags),
2411abe9b8aSliubo 		  __entry->refs, __entry->compress_type)
2421abe9b8aSliubo );
2431abe9b8aSliubo 
24409ed2f16SLiu Bo /* file extent item */
24509ed2f16SLiu Bo DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular,
24609ed2f16SLiu Bo 
24709ed2f16SLiu Bo 	TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
24809ed2f16SLiu Bo 		 struct btrfs_file_extent_item *fi, u64 start),
24909ed2f16SLiu Bo 
25009ed2f16SLiu Bo 	TP_ARGS(bi, l, fi, start),
25109ed2f16SLiu Bo 
25209ed2f16SLiu Bo 	TP_STRUCT__entry_btrfs(
25309ed2f16SLiu Bo 		__field(	u64,	root_obj	)
25409ed2f16SLiu Bo 		__field(	u64,	ino		)
25509ed2f16SLiu Bo 		__field(	loff_t,	isize		)
25609ed2f16SLiu Bo 		__field(	u64,	disk_isize	)
25709ed2f16SLiu Bo 		__field(	u64,	num_bytes	)
25809ed2f16SLiu Bo 		__field(	u64,	ram_bytes	)
25909ed2f16SLiu Bo 		__field(	u64,	disk_bytenr	)
26009ed2f16SLiu Bo 		__field(	u64,	disk_num_bytes	)
26109ed2f16SLiu Bo 		__field(	u64,	extent_offset	)
26209ed2f16SLiu Bo 		__field(	u8,	extent_type	)
26309ed2f16SLiu Bo 		__field(	u8,	compression	)
26409ed2f16SLiu Bo 		__field(	u64,	extent_start	)
26509ed2f16SLiu Bo 		__field(	u64,	extent_end	)
26609ed2f16SLiu Bo 	),
26709ed2f16SLiu Bo 
26809ed2f16SLiu Bo 	TP_fast_assign_btrfs(bi->root->fs_info,
26909ed2f16SLiu Bo 		__entry->root_obj	= bi->root->objectid;
27009ed2f16SLiu Bo 		__entry->ino		= btrfs_ino(bi);
27109ed2f16SLiu Bo 		__entry->isize		= bi->vfs_inode.i_size;
27209ed2f16SLiu Bo 		__entry->disk_isize	= bi->disk_i_size;
27309ed2f16SLiu Bo 		__entry->num_bytes	= btrfs_file_extent_num_bytes(l, fi);
27409ed2f16SLiu Bo 		__entry->ram_bytes	= btrfs_file_extent_ram_bytes(l, fi);
27509ed2f16SLiu Bo 		__entry->disk_bytenr	= btrfs_file_extent_disk_bytenr(l, fi);
27609ed2f16SLiu Bo 		__entry->disk_num_bytes	= btrfs_file_extent_disk_num_bytes(l, fi);
27709ed2f16SLiu Bo 		__entry->extent_offset	= btrfs_file_extent_offset(l, fi);
27809ed2f16SLiu Bo 		__entry->extent_type	= btrfs_file_extent_type(l, fi);
27909ed2f16SLiu Bo 		__entry->compression	= btrfs_file_extent_compression(l, fi);
28009ed2f16SLiu Bo 		__entry->extent_start	= start;
28109ed2f16SLiu Bo 		__entry->extent_end	= (start + __entry->num_bytes);
28209ed2f16SLiu Bo 	),
28309ed2f16SLiu Bo 
28409ed2f16SLiu Bo 	TP_printk_btrfs(
28509ed2f16SLiu Bo 		"root=%llu(%s) inode=%llu size=%llu disk_isize=%llu "
28609ed2f16SLiu Bo 		"file extent range=[%llu %llu] "
28709ed2f16SLiu Bo 		"(num_bytes=%llu ram_bytes=%llu disk_bytenr=%llu "
28809ed2f16SLiu Bo 		"disk_num_bytes=%llu extent_offset=%llu type=%s "
28909ed2f16SLiu Bo 		"compression=%u",
29009ed2f16SLiu Bo 		show_root_type(__entry->root_obj), __entry->ino,
29109ed2f16SLiu Bo 		__entry->isize,
29209ed2f16SLiu Bo 		__entry->disk_isize, __entry->extent_start,
29309ed2f16SLiu Bo 		__entry->extent_end, __entry->num_bytes, __entry->ram_bytes,
29409ed2f16SLiu Bo 		__entry->disk_bytenr, __entry->disk_num_bytes,
29509ed2f16SLiu Bo 		__entry->extent_offset, show_fi_type(__entry->extent_type),
29609ed2f16SLiu Bo 		__entry->compression)
29709ed2f16SLiu Bo );
29809ed2f16SLiu Bo 
29909ed2f16SLiu Bo DECLARE_EVENT_CLASS(
30009ed2f16SLiu Bo 	btrfs__file_extent_item_inline,
30109ed2f16SLiu Bo 
30209ed2f16SLiu Bo 	TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
30309ed2f16SLiu Bo 		 struct btrfs_file_extent_item *fi, int slot, u64 start),
30409ed2f16SLiu Bo 
30509ed2f16SLiu Bo 	TP_ARGS(bi, l, fi, slot,  start),
30609ed2f16SLiu Bo 
30709ed2f16SLiu Bo 	TP_STRUCT__entry_btrfs(
30809ed2f16SLiu Bo 		__field(	u64,	root_obj	)
30909ed2f16SLiu Bo 		__field(	u64,	ino		)
31009ed2f16SLiu Bo 		__field(	loff_t,	isize		)
31109ed2f16SLiu Bo 		__field(	u64,	disk_isize	)
31209ed2f16SLiu Bo 		__field(	u8,	extent_type	)
31309ed2f16SLiu Bo 		__field(	u8,	compression	)
31409ed2f16SLiu Bo 		__field(	u64,	extent_start	)
31509ed2f16SLiu Bo 		__field(	u64,	extent_end	)
31609ed2f16SLiu Bo 	),
31709ed2f16SLiu Bo 
31809ed2f16SLiu Bo 	TP_fast_assign_btrfs(
31909ed2f16SLiu Bo 		bi->root->fs_info,
32009ed2f16SLiu Bo 		__entry->root_obj	= bi->root->objectid;
32109ed2f16SLiu Bo 		__entry->ino		= btrfs_ino(bi);
32209ed2f16SLiu Bo 		__entry->isize		= bi->vfs_inode.i_size;
32309ed2f16SLiu Bo 		__entry->disk_isize	= bi->disk_i_size;
32409ed2f16SLiu Bo 		__entry->extent_type	= btrfs_file_extent_type(l, fi);
32509ed2f16SLiu Bo 		__entry->compression	= btrfs_file_extent_compression(l, fi);
32609ed2f16SLiu Bo 		__entry->extent_start	= start;
32709ed2f16SLiu Bo 		__entry->extent_end	= (start + btrfs_file_extent_inline_len(l, slot, fi));
32809ed2f16SLiu Bo 	),
32909ed2f16SLiu Bo 
33009ed2f16SLiu Bo 	TP_printk_btrfs(
33109ed2f16SLiu Bo 		"root=%llu(%s) inode=%llu size=%llu disk_isize=%llu "
33209ed2f16SLiu Bo 		"file extent range=[%llu %llu] "
33309ed2f16SLiu Bo 		"extent_type=%s compression=%u",
33409ed2f16SLiu Bo 		show_root_type(__entry->root_obj), __entry->ino, __entry->isize,
33509ed2f16SLiu Bo 		__entry->disk_isize, __entry->extent_start,
33609ed2f16SLiu Bo 		__entry->extent_end, show_fi_type(__entry->extent_type),
33709ed2f16SLiu Bo 		__entry->compression)
33809ed2f16SLiu Bo );
33909ed2f16SLiu Bo 
34009ed2f16SLiu Bo DEFINE_EVENT(
34109ed2f16SLiu Bo 	btrfs__file_extent_item_regular, btrfs_get_extent_show_fi_regular,
34209ed2f16SLiu Bo 
34309ed2f16SLiu Bo 	TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
34409ed2f16SLiu Bo 		 struct btrfs_file_extent_item *fi, u64 start),
34509ed2f16SLiu Bo 
34609ed2f16SLiu Bo 	TP_ARGS(bi, l, fi, start)
34709ed2f16SLiu Bo );
34809ed2f16SLiu Bo 
34909ed2f16SLiu Bo DEFINE_EVENT(
35009ed2f16SLiu Bo 	btrfs__file_extent_item_regular, btrfs_truncate_show_fi_regular,
35109ed2f16SLiu Bo 
35209ed2f16SLiu Bo 	TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
35309ed2f16SLiu Bo 		 struct btrfs_file_extent_item *fi, u64 start),
35409ed2f16SLiu Bo 
35509ed2f16SLiu Bo 	TP_ARGS(bi, l, fi, start)
35609ed2f16SLiu Bo );
35709ed2f16SLiu Bo 
35809ed2f16SLiu Bo DEFINE_EVENT(
35909ed2f16SLiu Bo 	btrfs__file_extent_item_inline, btrfs_get_extent_show_fi_inline,
36009ed2f16SLiu Bo 
36109ed2f16SLiu Bo 	TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
36209ed2f16SLiu Bo 		 struct btrfs_file_extent_item *fi, int slot, u64 start),
36309ed2f16SLiu Bo 
36409ed2f16SLiu Bo 	TP_ARGS(bi, l, fi, slot, start)
36509ed2f16SLiu Bo );
36609ed2f16SLiu Bo 
36709ed2f16SLiu Bo DEFINE_EVENT(
36809ed2f16SLiu Bo 	btrfs__file_extent_item_inline, btrfs_truncate_show_fi_inline,
36909ed2f16SLiu Bo 
37009ed2f16SLiu Bo 	TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
37109ed2f16SLiu Bo 		 struct btrfs_file_extent_item *fi, int slot, u64 start),
37209ed2f16SLiu Bo 
37309ed2f16SLiu Bo 	TP_ARGS(bi, l, fi, slot, start)
37409ed2f16SLiu Bo );
37509ed2f16SLiu Bo 
3761abe9b8aSliubo #define show_ordered_flags(flags)					   \
3779d04a8ceSLiu Bo 	__print_flags(flags, "|",					   \
3789d04a8ceSLiu Bo 		{ (1 << BTRFS_ORDERED_IO_DONE), 	"IO_DONE" 	}, \
3799d04a8ceSLiu Bo 		{ (1 << BTRFS_ORDERED_COMPLETE), 	"COMPLETE" 	}, \
3809d04a8ceSLiu Bo 		{ (1 << BTRFS_ORDERED_NOCOW), 		"NOCOW" 	}, \
3819d04a8ceSLiu Bo 		{ (1 << BTRFS_ORDERED_COMPRESSED), 	"COMPRESSED" 	}, \
3829d04a8ceSLiu Bo 		{ (1 << BTRFS_ORDERED_PREALLOC), 	"PREALLOC" 	}, \
3839d04a8ceSLiu Bo 		{ (1 << BTRFS_ORDERED_DIRECT),	 	"DIRECT" 	}, \
3849d04a8ceSLiu Bo 		{ (1 << BTRFS_ORDERED_IOERR), 		"IOERR" 	}, \
3859d04a8ceSLiu Bo 		{ (1 << BTRFS_ORDERED_UPDATED_ISIZE), 	"UPDATED_ISIZE"	}, \
386792ddef0SLiu Bo 		{ (1 << BTRFS_ORDERED_LOGGED_CSUM), 	"LOGGED_CSUM"	}, \
387792ddef0SLiu Bo 		{ (1 << BTRFS_ORDERED_TRUNCATED), 	"TRUNCATED"	})
388e112e2b4SLiu Bo 
3891abe9b8aSliubo 
3901abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__ordered_extent,
3911abe9b8aSliubo 
3929a35b637SJeff Mahoney 	TP_PROTO(const struct inode *inode,
3939a35b637SJeff Mahoney 		 const struct btrfs_ordered_extent *ordered),
3941abe9b8aSliubo 
3951abe9b8aSliubo 	TP_ARGS(inode, ordered),
3961abe9b8aSliubo 
397bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
3981abe9b8aSliubo 		__field(	ino_t,  ino		)
3991abe9b8aSliubo 		__field(	u64,  file_offset	)
4001abe9b8aSliubo 		__field(	u64,  start		)
4011abe9b8aSliubo 		__field(	u64,  len		)
4021abe9b8aSliubo 		__field(	u64,  disk_len		)
4031abe9b8aSliubo 		__field(	u64,  bytes_left	)
4041abe9b8aSliubo 		__field(	unsigned long,  flags	)
4051abe9b8aSliubo 		__field(	int,  compress_type	)
4061abe9b8aSliubo 		__field(	int,  refs		)
4071abe9b8aSliubo 		__field(	u64,  root_objectid	)
40878566548SLiu Bo 		__field(	u64,  truncated_len	)
4091abe9b8aSliubo 	),
4101abe9b8aSliubo 
411bc074524SJeff Mahoney 	TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
4121abe9b8aSliubo 		__entry->ino 		= inode->i_ino;
4131abe9b8aSliubo 		__entry->file_offset	= ordered->file_offset;
4141abe9b8aSliubo 		__entry->start		= ordered->start;
4151abe9b8aSliubo 		__entry->len		= ordered->len;
4161abe9b8aSliubo 		__entry->disk_len	= ordered->disk_len;
4171abe9b8aSliubo 		__entry->bytes_left	= ordered->bytes_left;
4181abe9b8aSliubo 		__entry->flags		= ordered->flags;
4191abe9b8aSliubo 		__entry->compress_type	= ordered->compress_type;
420e76edab7SElena Reshetova 		__entry->refs		= refcount_read(&ordered->refs);
4211abe9b8aSliubo 		__entry->root_objectid	=
4221abe9b8aSliubo 				BTRFS_I(inode)->root->root_key.objectid;
42378566548SLiu Bo 		__entry->truncated_len	= ordered->truncated_len;
4241abe9b8aSliubo 	),
4251abe9b8aSliubo 
426562a7a07SDavid Sterba 	TP_printk_btrfs("root=%llu(%s) ino=%llu file_offset=%llu "
427562a7a07SDavid Sterba 		  "start=%llu len=%llu disk_len=%llu "
428562a7a07SDavid Sterba 		  "truncated_len=%llu "
429562a7a07SDavid Sterba 		  "bytes_left=%llu flags=%s compress_type=%d "
4301abe9b8aSliubo 		  "refs=%d",
4311abe9b8aSliubo 		  show_root_type(__entry->root_objectid),
4321abe9b8aSliubo 		  (unsigned long long)__entry->ino,
4331abe9b8aSliubo 		  (unsigned long long)__entry->file_offset,
4341abe9b8aSliubo 		  (unsigned long long)__entry->start,
4351abe9b8aSliubo 		  (unsigned long long)__entry->len,
4361abe9b8aSliubo 		  (unsigned long long)__entry->disk_len,
43778566548SLiu Bo 		  (unsigned long long)__entry->truncated_len,
4381abe9b8aSliubo 		  (unsigned long long)__entry->bytes_left,
4391abe9b8aSliubo 		  show_ordered_flags(__entry->flags),
4401abe9b8aSliubo 		  __entry->compress_type, __entry->refs)
4411abe9b8aSliubo );
4421abe9b8aSliubo 
4431abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add,
4441abe9b8aSliubo 
4459a35b637SJeff Mahoney 	TP_PROTO(const struct inode *inode,
4469a35b637SJeff Mahoney 		 const struct btrfs_ordered_extent *ordered),
4471abe9b8aSliubo 
4481abe9b8aSliubo 	TP_ARGS(inode, ordered)
4491abe9b8aSliubo );
4501abe9b8aSliubo 
4511abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove,
4521abe9b8aSliubo 
4539a35b637SJeff Mahoney 	TP_PROTO(const struct inode *inode,
4549a35b637SJeff Mahoney 		 const struct btrfs_ordered_extent *ordered),
4551abe9b8aSliubo 
4561abe9b8aSliubo 	TP_ARGS(inode, ordered)
4571abe9b8aSliubo );
4581abe9b8aSliubo 
4591abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start,
4601abe9b8aSliubo 
4619a35b637SJeff Mahoney 	TP_PROTO(const struct inode *inode,
4629a35b637SJeff Mahoney 		 const struct btrfs_ordered_extent *ordered),
4631abe9b8aSliubo 
4641abe9b8aSliubo 	TP_ARGS(inode, ordered)
4651abe9b8aSliubo );
4661abe9b8aSliubo 
4671abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put,
4681abe9b8aSliubo 
4699a35b637SJeff Mahoney 	TP_PROTO(const struct inode *inode,
4709a35b637SJeff Mahoney 		 const struct btrfs_ordered_extent *ordered),
4711abe9b8aSliubo 
4721abe9b8aSliubo 	TP_ARGS(inode, ordered)
4731abe9b8aSliubo );
4741abe9b8aSliubo 
4751abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__writepage,
4761abe9b8aSliubo 
4779a35b637SJeff Mahoney 	TP_PROTO(const struct page *page, const struct inode *inode,
4789a35b637SJeff Mahoney 		 const struct writeback_control *wbc),
4791abe9b8aSliubo 
4801abe9b8aSliubo 	TP_ARGS(page, inode, wbc),
4811abe9b8aSliubo 
482bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
4831abe9b8aSliubo 		__field(	ino_t,  ino			)
4841abe9b8aSliubo 		__field(	pgoff_t,  index			)
4851abe9b8aSliubo 		__field(	long,   nr_to_write		)
4861abe9b8aSliubo 		__field(	long,   pages_skipped		)
4871abe9b8aSliubo 		__field(	loff_t, range_start		)
4881abe9b8aSliubo 		__field(	loff_t, range_end		)
4891abe9b8aSliubo 		__field(	char,   for_kupdate		)
4901abe9b8aSliubo 		__field(	char,   for_reclaim		)
4911abe9b8aSliubo 		__field(	char,   range_cyclic		)
4921abe9b8aSliubo 		__field(	pgoff_t,  writeback_index	)
4931abe9b8aSliubo 		__field(	u64,    root_objectid		)
4941abe9b8aSliubo 	),
4951abe9b8aSliubo 
496bc074524SJeff Mahoney 	TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
4971abe9b8aSliubo 		__entry->ino		= inode->i_ino;
4981abe9b8aSliubo 		__entry->index		= page->index;
4991abe9b8aSliubo 		__entry->nr_to_write	= wbc->nr_to_write;
5001abe9b8aSliubo 		__entry->pages_skipped	= wbc->pages_skipped;
5011abe9b8aSliubo 		__entry->range_start	= wbc->range_start;
5021abe9b8aSliubo 		__entry->range_end	= wbc->range_end;
5031abe9b8aSliubo 		__entry->for_kupdate	= wbc->for_kupdate;
5041abe9b8aSliubo 		__entry->for_reclaim	= wbc->for_reclaim;
5051abe9b8aSliubo 		__entry->range_cyclic	= wbc->range_cyclic;
5061abe9b8aSliubo 		__entry->writeback_index = inode->i_mapping->writeback_index;
5071abe9b8aSliubo 		__entry->root_objectid	=
5081abe9b8aSliubo 				 BTRFS_I(inode)->root->root_key.objectid;
5091abe9b8aSliubo 	),
5101abe9b8aSliubo 
511562a7a07SDavid Sterba 	TP_printk_btrfs("root=%llu(%s) ino=%lu page_index=%lu "
512562a7a07SDavid Sterba 		  "nr_to_write=%ld pages_skipped=%ld range_start=%llu "
513562a7a07SDavid Sterba 		  "range_end=%llu for_kupdate=%d "
514562a7a07SDavid Sterba 		  "for_reclaim=%d range_cyclic=%d writeback_index=%lu",
5151abe9b8aSliubo 		  show_root_type(__entry->root_objectid),
5161abe9b8aSliubo 		  (unsigned long)__entry->ino, __entry->index,
5171abe9b8aSliubo 		  __entry->nr_to_write, __entry->pages_skipped,
5181abe9b8aSliubo 		  __entry->range_start, __entry->range_end,
519846d5a09SWu Fengguang 		  __entry->for_kupdate,
5201abe9b8aSliubo 		  __entry->for_reclaim, __entry->range_cyclic,
5211abe9b8aSliubo 		  (unsigned long)__entry->writeback_index)
5221abe9b8aSliubo );
5231abe9b8aSliubo 
5241abe9b8aSliubo DEFINE_EVENT(btrfs__writepage, __extent_writepage,
5251abe9b8aSliubo 
5269a35b637SJeff Mahoney 	TP_PROTO(const struct page *page, const struct inode *inode,
5279a35b637SJeff Mahoney 		 const struct writeback_control *wbc),
5281abe9b8aSliubo 
5291abe9b8aSliubo 	TP_ARGS(page, inode, wbc)
5301abe9b8aSliubo );
5311abe9b8aSliubo 
5321abe9b8aSliubo TRACE_EVENT(btrfs_writepage_end_io_hook,
5331abe9b8aSliubo 
5349a35b637SJeff Mahoney 	TP_PROTO(const struct page *page, u64 start, u64 end, int uptodate),
5351abe9b8aSliubo 
5361abe9b8aSliubo 	TP_ARGS(page, start, end, uptodate),
5371abe9b8aSliubo 
538bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
5391abe9b8aSliubo 		__field(	ino_t,	 ino		)
5401abe9b8aSliubo 		__field(	pgoff_t, index		)
5411abe9b8aSliubo 		__field(	u64,	 start		)
5421abe9b8aSliubo 		__field(	u64,	 end		)
5431abe9b8aSliubo 		__field(	int,	 uptodate	)
5441abe9b8aSliubo 		__field(	u64,    root_objectid	)
5451abe9b8aSliubo 	),
5461abe9b8aSliubo 
547bc074524SJeff Mahoney 	TP_fast_assign_btrfs(btrfs_sb(page->mapping->host->i_sb),
5481abe9b8aSliubo 		__entry->ino	= page->mapping->host->i_ino;
5491abe9b8aSliubo 		__entry->index	= page->index;
5501abe9b8aSliubo 		__entry->start	= start;
5511abe9b8aSliubo 		__entry->end	= end;
5521abe9b8aSliubo 		__entry->uptodate = uptodate;
5531abe9b8aSliubo 		__entry->root_objectid	=
5541abe9b8aSliubo 			 BTRFS_I(page->mapping->host)->root->root_key.objectid;
5551abe9b8aSliubo 	),
5561abe9b8aSliubo 
557562a7a07SDavid Sterba 	TP_printk_btrfs("root=%llu(%s) ino=%lu page_index=%lu start=%llu "
558562a7a07SDavid Sterba 		  "end=%llu uptodate=%d",
5591abe9b8aSliubo 		  show_root_type(__entry->root_objectid),
5601abe9b8aSliubo 		  (unsigned long)__entry->ino, (unsigned long)__entry->index,
5611abe9b8aSliubo 		  (unsigned long long)__entry->start,
5621abe9b8aSliubo 		  (unsigned long long)__entry->end, __entry->uptodate)
5631abe9b8aSliubo );
5641abe9b8aSliubo 
5651abe9b8aSliubo TRACE_EVENT(btrfs_sync_file,
5661abe9b8aSliubo 
5679a35b637SJeff Mahoney 	TP_PROTO(const struct file *file, int datasync),
5681abe9b8aSliubo 
5691abe9b8aSliubo 	TP_ARGS(file, datasync),
5701abe9b8aSliubo 
571bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
5721abe9b8aSliubo 		__field(	ino_t,  ino		)
5731abe9b8aSliubo 		__field(	ino_t,  parent		)
5741abe9b8aSliubo 		__field(	int,    datasync	)
5751abe9b8aSliubo 		__field(	u64,    root_objectid	)
5761abe9b8aSliubo 	),
5771abe9b8aSliubo 
5781abe9b8aSliubo 	TP_fast_assign(
5799a35b637SJeff Mahoney 		const struct dentry *dentry = file->f_path.dentry;
5809a35b637SJeff Mahoney 		const struct inode *inode = d_inode(dentry);
5811abe9b8aSliubo 
582bc074524SJeff Mahoney 		TP_fast_assign_fsid(btrfs_sb(file->f_path.dentry->d_sb));
5831abe9b8aSliubo 		__entry->ino		= inode->i_ino;
5842b0143b5SDavid Howells 		__entry->parent		= d_inode(dentry->d_parent)->i_ino;
5851abe9b8aSliubo 		__entry->datasync	= datasync;
5861abe9b8aSliubo 		__entry->root_objectid	=
5871abe9b8aSliubo 				 BTRFS_I(inode)->root->root_key.objectid;
5881abe9b8aSliubo 	),
5891abe9b8aSliubo 
590562a7a07SDavid Sterba 	TP_printk_btrfs("root=%llu(%s) ino=%ld parent=%ld datasync=%d",
5911abe9b8aSliubo 		  show_root_type(__entry->root_objectid),
5921abe9b8aSliubo 		  (unsigned long)__entry->ino, (unsigned long)__entry->parent,
5931abe9b8aSliubo 		  __entry->datasync)
5941abe9b8aSliubo );
5951abe9b8aSliubo 
5961abe9b8aSliubo TRACE_EVENT(btrfs_sync_fs,
5971abe9b8aSliubo 
5989a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info, int wait),
5991abe9b8aSliubo 
600bc074524SJeff Mahoney 	TP_ARGS(fs_info, wait),
6011abe9b8aSliubo 
602bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
6031abe9b8aSliubo 		__field(	int,  wait		)
6041abe9b8aSliubo 	),
6051abe9b8aSliubo 
606bc074524SJeff Mahoney 	TP_fast_assign_btrfs(fs_info,
6071abe9b8aSliubo 		__entry->wait	= wait;
6081abe9b8aSliubo 	),
6091abe9b8aSliubo 
610bc074524SJeff Mahoney 	TP_printk_btrfs("wait = %d", __entry->wait)
6111abe9b8aSliubo );
6121abe9b8aSliubo 
613c83f8effSJosef Bacik TRACE_EVENT(btrfs_add_block_group,
614c83f8effSJosef Bacik 
6159a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
6169a35b637SJeff Mahoney 		 const struct btrfs_block_group_cache *block_group, int create),
617c83f8effSJosef Bacik 
618c83f8effSJosef Bacik 	TP_ARGS(fs_info, block_group, create),
619c83f8effSJosef Bacik 
620c83f8effSJosef Bacik 	TP_STRUCT__entry(
621b94417eaSAnand Jain 		__array(	u8,	fsid,	BTRFS_FSID_SIZE	)
622c83f8effSJosef Bacik 		__field(	u64,	offset			)
623c83f8effSJosef Bacik 		__field(	u64,	size			)
624c83f8effSJosef Bacik 		__field(	u64,	flags			)
625c83f8effSJosef Bacik 		__field(	u64,	bytes_used		)
626c83f8effSJosef Bacik 		__field(	u64,	bytes_super		)
627c83f8effSJosef Bacik 		__field(	int,	create			)
628c83f8effSJosef Bacik 	),
629c83f8effSJosef Bacik 
630c83f8effSJosef Bacik 	TP_fast_assign(
631b94417eaSAnand Jain 		memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE);
632c83f8effSJosef Bacik 		__entry->offset		= block_group->key.objectid;
633c83f8effSJosef Bacik 		__entry->size		= block_group->key.offset;
634c83f8effSJosef Bacik 		__entry->flags		= block_group->flags;
635c83f8effSJosef Bacik 		__entry->bytes_used	=
636c83f8effSJosef Bacik 			btrfs_block_group_used(&block_group->item);
637c83f8effSJosef Bacik 		__entry->bytes_super	= block_group->bytes_super;
638c83f8effSJosef Bacik 		__entry->create		= create;
639c83f8effSJosef Bacik 	),
640c83f8effSJosef Bacik 
641562a7a07SDavid Sterba 	TP_printk("%pU: block_group offset=%llu size=%llu "
642562a7a07SDavid Sterba 		  "flags=%llu(%s) bytes_used=%llu bytes_super=%llu "
643c83f8effSJosef Bacik 		  "create=%d", __entry->fsid,
644c83f8effSJosef Bacik 		  (unsigned long long)__entry->offset,
645c83f8effSJosef Bacik 		  (unsigned long long)__entry->size,
646c83f8effSJosef Bacik 		  (unsigned long long)__entry->flags,
647c83f8effSJosef Bacik 		  __print_flags((unsigned long)__entry->flags, "|",
648c83f8effSJosef Bacik 				BTRFS_GROUP_FLAGS),
649c83f8effSJosef Bacik 		  (unsigned long long)__entry->bytes_used,
650c83f8effSJosef Bacik 		  (unsigned long long)__entry->bytes_super, __entry->create)
651c83f8effSJosef Bacik );
652c83f8effSJosef Bacik 
6531abe9b8aSliubo #define show_ref_action(action)						\
6541abe9b8aSliubo 	__print_symbolic(action,					\
6551abe9b8aSliubo 		{ BTRFS_ADD_DELAYED_REF,    "ADD_DELAYED_REF" },	\
6561abe9b8aSliubo 		{ BTRFS_DROP_DELAYED_REF,   "DROP_DELAYED_REF" },	\
6571abe9b8aSliubo 		{ BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, 	\
6581abe9b8aSliubo 		{ BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
6591abe9b8aSliubo 
6601abe9b8aSliubo 
661599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref,
6621abe9b8aSliubo 
6639a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
6649a35b637SJeff Mahoney 		 const struct btrfs_delayed_ref_node *ref,
6659a35b637SJeff Mahoney 		 const struct btrfs_delayed_tree_ref *full_ref,
6661abe9b8aSliubo 		 int action),
6671abe9b8aSliubo 
668bc074524SJeff Mahoney 	TP_ARGS(fs_info, ref, full_ref, action),
6691abe9b8aSliubo 
670bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
6711abe9b8aSliubo 		__field(	u64,  bytenr		)
6721abe9b8aSliubo 		__field(	u64,  num_bytes		)
6731abe9b8aSliubo 		__field(	int,  action		)
6741abe9b8aSliubo 		__field(	u64,  parent		)
6751abe9b8aSliubo 		__field(	u64,  ref_root		)
6761abe9b8aSliubo 		__field(	int,  level		)
6771abe9b8aSliubo 		__field(	int,  type		)
678dea7d76eSLiu Bo 		__field(	u64,  seq		)
6791abe9b8aSliubo 	),
6801abe9b8aSliubo 
681bc074524SJeff Mahoney 	TP_fast_assign_btrfs(fs_info,
6821abe9b8aSliubo 		__entry->bytenr		= ref->bytenr;
6831abe9b8aSliubo 		__entry->num_bytes	= ref->num_bytes;
6841abe9b8aSliubo 		__entry->action		= action;
6851abe9b8aSliubo 		__entry->parent		= full_ref->parent;
6861abe9b8aSliubo 		__entry->ref_root	= full_ref->root;
6871abe9b8aSliubo 		__entry->level		= full_ref->level;
6881abe9b8aSliubo 		__entry->type		= ref->type;
689dea7d76eSLiu Bo 		__entry->seq		= ref->seq;
6901abe9b8aSliubo 	),
6911abe9b8aSliubo 
692562a7a07SDavid Sterba 	TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s "
693562a7a07SDavid Sterba 		  "parent=%llu(%s) ref_root=%llu(%s) level=%d "
694562a7a07SDavid Sterba 		  "type=%s seq=%llu",
6951abe9b8aSliubo 		  (unsigned long long)__entry->bytenr,
6961abe9b8aSliubo 		  (unsigned long long)__entry->num_bytes,
6971abe9b8aSliubo 		  show_ref_action(__entry->action),
6981abe9b8aSliubo 		  show_root_type(__entry->parent),
6991abe9b8aSliubo 		  show_root_type(__entry->ref_root),
700dea7d76eSLiu Bo 		  __entry->level, show_ref_type(__entry->type),
701dea7d76eSLiu Bo 		  (unsigned long long)__entry->seq)
7021abe9b8aSliubo );
7031abe9b8aSliubo 
704599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_tree_ref,  add_delayed_tree_ref,
705599c75ecSLiu Bo 
7069a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
7079a35b637SJeff Mahoney 		 const struct btrfs_delayed_ref_node *ref,
7089a35b637SJeff Mahoney 		 const struct btrfs_delayed_tree_ref *full_ref,
709599c75ecSLiu Bo 		 int action),
710599c75ecSLiu Bo 
711bc074524SJeff Mahoney 	TP_ARGS(fs_info, ref, full_ref, action)
712599c75ecSLiu Bo );
713599c75ecSLiu Bo 
714599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_tree_ref,  run_delayed_tree_ref,
715599c75ecSLiu Bo 
7169a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
7179a35b637SJeff Mahoney 		 const struct btrfs_delayed_ref_node *ref,
7189a35b637SJeff Mahoney 		 const struct btrfs_delayed_tree_ref *full_ref,
719599c75ecSLiu Bo 		 int action),
720599c75ecSLiu Bo 
721bc074524SJeff Mahoney 	TP_ARGS(fs_info, ref, full_ref, action)
722599c75ecSLiu Bo );
723599c75ecSLiu Bo 
724599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_data_ref,
7251abe9b8aSliubo 
7269a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
7279a35b637SJeff Mahoney 		 const struct btrfs_delayed_ref_node *ref,
7289a35b637SJeff Mahoney 		 const struct btrfs_delayed_data_ref *full_ref,
7291abe9b8aSliubo 		 int action),
7301abe9b8aSliubo 
731bc074524SJeff Mahoney 	TP_ARGS(fs_info, ref, full_ref, action),
7321abe9b8aSliubo 
733bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
7341abe9b8aSliubo 		__field(	u64,  bytenr		)
7351abe9b8aSliubo 		__field(	u64,  num_bytes		)
7361abe9b8aSliubo 		__field(	int,  action		)
7371abe9b8aSliubo 		__field(	u64,  parent		)
7381abe9b8aSliubo 		__field(	u64,  ref_root		)
7391abe9b8aSliubo 		__field(	u64,  owner		)
7401abe9b8aSliubo 		__field(	u64,  offset		)
7411abe9b8aSliubo 		__field(	int,  type		)
742dea7d76eSLiu Bo 		__field(	u64,  seq		)
7431abe9b8aSliubo 	),
7441abe9b8aSliubo 
745bc074524SJeff Mahoney 	TP_fast_assign_btrfs(fs_info,
7461abe9b8aSliubo 		__entry->bytenr		= ref->bytenr;
7471abe9b8aSliubo 		__entry->num_bytes	= ref->num_bytes;
7481abe9b8aSliubo 		__entry->action		= action;
7491abe9b8aSliubo 		__entry->parent		= full_ref->parent;
7501abe9b8aSliubo 		__entry->ref_root	= full_ref->root;
7511abe9b8aSliubo 		__entry->owner		= full_ref->objectid;
7521abe9b8aSliubo 		__entry->offset		= full_ref->offset;
7531abe9b8aSliubo 		__entry->type		= ref->type;
754dea7d76eSLiu Bo 		__entry->seq		= ref->seq;
7551abe9b8aSliubo 	),
7561abe9b8aSliubo 
757562a7a07SDavid Sterba 	TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s "
758562a7a07SDavid Sterba 		  "parent=%llu(%s) ref_root=%llu(%s) owner=%llu "
759562a7a07SDavid Sterba 		  "offset=%llu type=%s seq=%llu",
7601abe9b8aSliubo 		  (unsigned long long)__entry->bytenr,
7611abe9b8aSliubo 		  (unsigned long long)__entry->num_bytes,
7621abe9b8aSliubo 		  show_ref_action(__entry->action),
7631abe9b8aSliubo 		  show_root_type(__entry->parent),
7641abe9b8aSliubo 		  show_root_type(__entry->ref_root),
7651abe9b8aSliubo 		  (unsigned long long)__entry->owner,
7661abe9b8aSliubo 		  (unsigned long long)__entry->offset,
767dea7d76eSLiu Bo 		  show_ref_type(__entry->type),
768dea7d76eSLiu Bo 		  (unsigned long long)__entry->seq)
7691abe9b8aSliubo );
7701abe9b8aSliubo 
771599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_data_ref,  add_delayed_data_ref,
772599c75ecSLiu Bo 
7739a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
7749a35b637SJeff Mahoney 		 const struct btrfs_delayed_ref_node *ref,
7759a35b637SJeff Mahoney 		 const struct btrfs_delayed_data_ref *full_ref,
776599c75ecSLiu Bo 		 int action),
777599c75ecSLiu Bo 
778bc074524SJeff Mahoney 	TP_ARGS(fs_info, ref, full_ref, action)
779599c75ecSLiu Bo );
780599c75ecSLiu Bo 
781599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_data_ref,  run_delayed_data_ref,
782599c75ecSLiu Bo 
7839a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
7849a35b637SJeff Mahoney 		 const struct btrfs_delayed_ref_node *ref,
7859a35b637SJeff Mahoney 		 const struct btrfs_delayed_data_ref *full_ref,
786599c75ecSLiu Bo 		 int action),
787599c75ecSLiu Bo 
788bc074524SJeff Mahoney 	TP_ARGS(fs_info, ref, full_ref, action)
789599c75ecSLiu Bo );
790599c75ecSLiu Bo 
791599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_ref_head,
7921abe9b8aSliubo 
7939a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
7949a35b637SJeff Mahoney 		 const struct btrfs_delayed_ref_node *ref,
7959a35b637SJeff Mahoney 		 const struct btrfs_delayed_ref_head *head_ref,
7961abe9b8aSliubo 		 int action),
7971abe9b8aSliubo 
798bc074524SJeff Mahoney 	TP_ARGS(fs_info, ref, head_ref, action),
7991abe9b8aSliubo 
800bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
8011abe9b8aSliubo 		__field(	u64,  bytenr		)
8021abe9b8aSliubo 		__field(	u64,  num_bytes		)
8031abe9b8aSliubo 		__field(	int,  action		)
8041abe9b8aSliubo 		__field(	int,  is_data		)
8051abe9b8aSliubo 	),
8061abe9b8aSliubo 
807bc074524SJeff Mahoney 	TP_fast_assign_btrfs(fs_info,
8081abe9b8aSliubo 		__entry->bytenr		= ref->bytenr;
8091abe9b8aSliubo 		__entry->num_bytes	= ref->num_bytes;
8101abe9b8aSliubo 		__entry->action		= action;
8111abe9b8aSliubo 		__entry->is_data	= head_ref->is_data;
8121abe9b8aSliubo 	),
8131abe9b8aSliubo 
814562a7a07SDavid Sterba 	TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d",
8151abe9b8aSliubo 		  (unsigned long long)__entry->bytenr,
8161abe9b8aSliubo 		  (unsigned long long)__entry->num_bytes,
8171abe9b8aSliubo 		  show_ref_action(__entry->action),
8181abe9b8aSliubo 		  __entry->is_data)
8191abe9b8aSliubo );
8201abe9b8aSliubo 
821599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_ref_head,  add_delayed_ref_head,
822599c75ecSLiu Bo 
8239a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
8249a35b637SJeff Mahoney 		 const struct btrfs_delayed_ref_node *ref,
8259a35b637SJeff Mahoney 		 const struct btrfs_delayed_ref_head *head_ref,
826599c75ecSLiu Bo 		 int action),
827599c75ecSLiu Bo 
828bc074524SJeff Mahoney 	TP_ARGS(fs_info, ref, head_ref, action)
829599c75ecSLiu Bo );
830599c75ecSLiu Bo 
831599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_ref_head,  run_delayed_ref_head,
832599c75ecSLiu Bo 
8339a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
8349a35b637SJeff Mahoney 		 const struct btrfs_delayed_ref_node *ref,
8359a35b637SJeff Mahoney 		 const struct btrfs_delayed_ref_head *head_ref,
836599c75ecSLiu Bo 		 int action),
837599c75ecSLiu Bo 
838bc074524SJeff Mahoney 	TP_ARGS(fs_info, ref, head_ref, action)
839599c75ecSLiu Bo );
840599c75ecSLiu Bo 
8411abe9b8aSliubo #define show_chunk_type(type)					\
8421abe9b8aSliubo 	__print_flags(type, "|",				\
8431abe9b8aSliubo 		{ BTRFS_BLOCK_GROUP_DATA, 	"DATA"	},	\
8441abe9b8aSliubo 		{ BTRFS_BLOCK_GROUP_SYSTEM, 	"SYSTEM"},	\
8451abe9b8aSliubo 		{ BTRFS_BLOCK_GROUP_METADATA, 	"METADATA"},	\
8461abe9b8aSliubo 		{ BTRFS_BLOCK_GROUP_RAID0, 	"RAID0" },	\
8471abe9b8aSliubo 		{ BTRFS_BLOCK_GROUP_RAID1, 	"RAID1" },	\
8481abe9b8aSliubo 		{ BTRFS_BLOCK_GROUP_DUP, 	"DUP"	},	\
849e112e2b4SLiu Bo 		{ BTRFS_BLOCK_GROUP_RAID10, 	"RAID10"},	\
850e112e2b4SLiu Bo 		{ BTRFS_BLOCK_GROUP_RAID5, 	"RAID5"	},	\
851e112e2b4SLiu Bo 		{ BTRFS_BLOCK_GROUP_RAID6, 	"RAID6"	})
8521abe9b8aSliubo 
8531abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__chunk,
8541abe9b8aSliubo 
8559a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
8569a35b637SJeff Mahoney 		 const struct map_lookup *map, u64 offset, u64 size),
8571abe9b8aSliubo 
8586bccf3abSJeff Mahoney 	TP_ARGS(fs_info, map, offset, size),
8591abe9b8aSliubo 
860bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
8611abe9b8aSliubo 		__field(	int,  num_stripes		)
8621abe9b8aSliubo 		__field(	u64,  type			)
8631abe9b8aSliubo 		__field(	int,  sub_stripes		)
8641abe9b8aSliubo 		__field(	u64,  offset			)
8651abe9b8aSliubo 		__field(	u64,  size			)
8661abe9b8aSliubo 		__field(	u64,  root_objectid		)
8671abe9b8aSliubo 	),
8681abe9b8aSliubo 
8696bccf3abSJeff Mahoney 	TP_fast_assign_btrfs(fs_info,
8701abe9b8aSliubo 		__entry->num_stripes	= map->num_stripes;
8711abe9b8aSliubo 		__entry->type		= map->type;
8721abe9b8aSliubo 		__entry->sub_stripes	= map->sub_stripes;
8731abe9b8aSliubo 		__entry->offset		= offset;
8741abe9b8aSliubo 		__entry->size		= size;
8756bccf3abSJeff Mahoney 		__entry->root_objectid	= fs_info->chunk_root->root_key.objectid;
8761abe9b8aSliubo 	),
8771abe9b8aSliubo 
878562a7a07SDavid Sterba 	TP_printk_btrfs("root=%llu(%s) offset=%llu size=%llu "
879562a7a07SDavid Sterba 		  "num_stripes=%d sub_stripes=%d type=%s",
8801abe9b8aSliubo 		  show_root_type(__entry->root_objectid),
8811abe9b8aSliubo 		  (unsigned long long)__entry->offset,
8821abe9b8aSliubo 		  (unsigned long long)__entry->size,
8831abe9b8aSliubo 		  __entry->num_stripes, __entry->sub_stripes,
8841abe9b8aSliubo 		  show_chunk_type(__entry->type))
8851abe9b8aSliubo );
8861abe9b8aSliubo 
8871abe9b8aSliubo DEFINE_EVENT(btrfs__chunk,  btrfs_chunk_alloc,
8881abe9b8aSliubo 
8899a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
8909a35b637SJeff Mahoney 		 const struct map_lookup *map, u64 offset, u64 size),
8911abe9b8aSliubo 
8926bccf3abSJeff Mahoney 	TP_ARGS(fs_info, map, offset, size)
8931abe9b8aSliubo );
8941abe9b8aSliubo 
8951abe9b8aSliubo DEFINE_EVENT(btrfs__chunk,  btrfs_chunk_free,
8961abe9b8aSliubo 
8979a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
8989a35b637SJeff Mahoney 		 const struct map_lookup *map, u64 offset, u64 size),
8991abe9b8aSliubo 
9006bccf3abSJeff Mahoney 	TP_ARGS(fs_info, map, offset, size)
9011abe9b8aSliubo );
9021abe9b8aSliubo 
9031abe9b8aSliubo TRACE_EVENT(btrfs_cow_block,
9041abe9b8aSliubo 
9059a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_root *root, const struct extent_buffer *buf,
9069a35b637SJeff Mahoney 		 const struct extent_buffer *cow),
9071abe9b8aSliubo 
9081abe9b8aSliubo 	TP_ARGS(root, buf, cow),
9091abe9b8aSliubo 
910bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
9111abe9b8aSliubo 		__field(	u64,  root_objectid		)
9121abe9b8aSliubo 		__field(	u64,  buf_start			)
9131abe9b8aSliubo 		__field(	int,  refs			)
9141abe9b8aSliubo 		__field(	u64,  cow_start			)
9151abe9b8aSliubo 		__field(	int,  buf_level			)
9161abe9b8aSliubo 		__field(	int,  cow_level			)
9171abe9b8aSliubo 	),
9181abe9b8aSliubo 
919bc074524SJeff Mahoney 	TP_fast_assign_btrfs(root->fs_info,
9201abe9b8aSliubo 		__entry->root_objectid	= root->root_key.objectid;
9211abe9b8aSliubo 		__entry->buf_start	= buf->start;
9221abe9b8aSliubo 		__entry->refs		= atomic_read(&buf->refs);
9231abe9b8aSliubo 		__entry->cow_start	= cow->start;
9241abe9b8aSliubo 		__entry->buf_level	= btrfs_header_level(buf);
9251abe9b8aSliubo 		__entry->cow_level	= btrfs_header_level(cow);
9261abe9b8aSliubo 	),
9271abe9b8aSliubo 
928562a7a07SDavid Sterba 	TP_printk_btrfs("root=%llu(%s) refs=%d orig_buf=%llu "
929562a7a07SDavid Sterba 		  "(orig_level=%d) cow_buf=%llu (cow_level=%d)",
9301abe9b8aSliubo 		  show_root_type(__entry->root_objectid),
9311abe9b8aSliubo 		  __entry->refs,
9321abe9b8aSliubo 		  (unsigned long long)__entry->buf_start,
9331abe9b8aSliubo 		  __entry->buf_level,
9341abe9b8aSliubo 		  (unsigned long long)__entry->cow_start,
9351abe9b8aSliubo 		  __entry->cow_level)
9361abe9b8aSliubo );
9371abe9b8aSliubo 
9388c2a3ca2SJosef Bacik TRACE_EVENT(btrfs_space_reservation,
9398c2a3ca2SJosef Bacik 
9409a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info, char *type, u64 val,
9418c2a3ca2SJosef Bacik 		 u64 bytes, int reserve),
9428c2a3ca2SJosef Bacik 
9438c2a3ca2SJosef Bacik 	TP_ARGS(fs_info, type, val, bytes, reserve),
9448c2a3ca2SJosef Bacik 
945bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
9468c2a3ca2SJosef Bacik 		__string(	type,	type			)
9478c2a3ca2SJosef Bacik 		__field(	u64,	val			)
9488c2a3ca2SJosef Bacik 		__field(	u64,	bytes			)
9498c2a3ca2SJosef Bacik 		__field(	int,	reserve			)
9508c2a3ca2SJosef Bacik 	),
9518c2a3ca2SJosef Bacik 
952bc074524SJeff Mahoney 	TP_fast_assign_btrfs(fs_info,
9538c2a3ca2SJosef Bacik 		__assign_str(type, type);
9548c2a3ca2SJosef Bacik 		__entry->val		= val;
9558c2a3ca2SJosef Bacik 		__entry->bytes		= bytes;
9568c2a3ca2SJosef Bacik 		__entry->reserve	= reserve;
9578c2a3ca2SJosef Bacik 	),
9588c2a3ca2SJosef Bacik 
959bc074524SJeff Mahoney 	TP_printk_btrfs("%s: %Lu %s %Lu", __get_str(type), __entry->val,
960bc074524SJeff Mahoney 			__entry->reserve ? "reserve" : "release",
9618c2a3ca2SJosef Bacik 			__entry->bytes)
9628c2a3ca2SJosef Bacik );
9638c2a3ca2SJosef Bacik 
964f376df2bSJosef Bacik #define show_flush_action(action)						\
965f376df2bSJosef Bacik 	__print_symbolic(action,						\
966f376df2bSJosef Bacik 		{ BTRFS_RESERVE_NO_FLUSH,	"BTRFS_RESERVE_NO_FLUSH"},	\
967f376df2bSJosef Bacik 		{ BTRFS_RESERVE_FLUSH_LIMIT,	"BTRFS_RESERVE_FLUSH_LIMIT"},	\
968f376df2bSJosef Bacik 		{ BTRFS_RESERVE_FLUSH_ALL,	"BTRFS_RESERVE_FLUSH_ALL"})
969f376df2bSJosef Bacik 
970f376df2bSJosef Bacik TRACE_EVENT(btrfs_trigger_flush,
971f376df2bSJosef Bacik 
9729a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes,
973f376df2bSJosef Bacik 		 int flush, char *reason),
974f376df2bSJosef Bacik 
975f376df2bSJosef Bacik 	TP_ARGS(fs_info, flags, bytes, flush, reason),
976f376df2bSJosef Bacik 
977f376df2bSJosef Bacik 	TP_STRUCT__entry(
978b94417eaSAnand Jain 		__array(	u8,	fsid,	BTRFS_FSID_SIZE	)
979f376df2bSJosef Bacik 		__field(	u64,	flags			)
980f376df2bSJosef Bacik 		__field(	u64,	bytes			)
981f376df2bSJosef Bacik 		__field(	int,	flush			)
982f376df2bSJosef Bacik 		__string(	reason,	reason			)
983f376df2bSJosef Bacik 	),
984f376df2bSJosef Bacik 
985f376df2bSJosef Bacik 	TP_fast_assign(
986b94417eaSAnand Jain 		memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE);
987f376df2bSJosef Bacik 		__entry->flags	= flags;
988f376df2bSJosef Bacik 		__entry->bytes	= bytes;
989f376df2bSJosef Bacik 		__entry->flush	= flush;
990f376df2bSJosef Bacik 		__assign_str(reason, reason)
991f376df2bSJosef Bacik 	),
992f376df2bSJosef Bacik 
993562a7a07SDavid Sterba 	TP_printk("%pU: %s: flush=%d(%s) flags=%llu(%s) bytes=%llu",
994f376df2bSJosef Bacik 		  __entry->fsid, __get_str(reason), __entry->flush,
995f376df2bSJosef Bacik 		  show_flush_action(__entry->flush),
996f376df2bSJosef Bacik 		  (unsigned long long)__entry->flags,
997f376df2bSJosef Bacik 		  __print_flags((unsigned long)__entry->flags, "|",
998f376df2bSJosef Bacik 				BTRFS_GROUP_FLAGS),
999f376df2bSJosef Bacik 		  (unsigned long long)__entry->bytes)
1000f376df2bSJosef Bacik );
1001f376df2bSJosef Bacik 
1002f376df2bSJosef Bacik #define show_flush_state(state)							\
1003f376df2bSJosef Bacik 	__print_symbolic(state,							\
1004f376df2bSJosef Bacik 		{ FLUSH_DELAYED_ITEMS_NR,	"FLUSH_DELAYED_ITEMS_NR"},	\
1005f376df2bSJosef Bacik 		{ FLUSH_DELAYED_ITEMS,		"FLUSH_DELAYED_ITEMS"},		\
1006f376df2bSJosef Bacik 		{ FLUSH_DELALLOC,		"FLUSH_DELALLOC"},		\
1007f376df2bSJosef Bacik 		{ FLUSH_DELALLOC_WAIT,		"FLUSH_DELALLOC_WAIT"},		\
1008f376df2bSJosef Bacik 		{ ALLOC_CHUNK,			"ALLOC_CHUNK"},			\
1009f376df2bSJosef Bacik 		{ COMMIT_TRANS,			"COMMIT_TRANS"})
1010f376df2bSJosef Bacik 
1011f376df2bSJosef Bacik TRACE_EVENT(btrfs_flush_space,
1012f376df2bSJosef Bacik 
10139a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 num_bytes,
10147bdd6277SNikolay Borisov 		 int state, int ret),
1015f376df2bSJosef Bacik 
10167bdd6277SNikolay Borisov 	TP_ARGS(fs_info, flags, num_bytes, state, ret),
1017f376df2bSJosef Bacik 
1018f376df2bSJosef Bacik 	TP_STRUCT__entry(
1019b94417eaSAnand Jain 		__array(	u8,	fsid,	BTRFS_FSID_SIZE	)
1020f376df2bSJosef Bacik 		__field(	u64,	flags			)
1021f376df2bSJosef Bacik 		__field(	u64,	num_bytes		)
1022f376df2bSJosef Bacik 		__field(	int,	state			)
1023f376df2bSJosef Bacik 		__field(	int,	ret			)
1024f376df2bSJosef Bacik 	),
1025f376df2bSJosef Bacik 
1026f376df2bSJosef Bacik 	TP_fast_assign(
1027b94417eaSAnand Jain 		memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE);
1028f376df2bSJosef Bacik 		__entry->flags		=	flags;
1029f376df2bSJosef Bacik 		__entry->num_bytes	=	num_bytes;
1030f376df2bSJosef Bacik 		__entry->state		=	state;
1031f376df2bSJosef Bacik 		__entry->ret		=	ret;
1032f376df2bSJosef Bacik 	),
1033f376df2bSJosef Bacik 
10347bdd6277SNikolay Borisov 	TP_printk("%pU: state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d",
10357bdd6277SNikolay Borisov 		  __entry->fsid, __entry->state,
1036f376df2bSJosef Bacik 		  show_flush_state(__entry->state),
1037f376df2bSJosef Bacik 		  (unsigned long long)__entry->flags,
1038f376df2bSJosef Bacik 		  __print_flags((unsigned long)__entry->flags, "|",
1039f376df2bSJosef Bacik 				BTRFS_GROUP_FLAGS),
10407bdd6277SNikolay Borisov 		  (unsigned long long)__entry->num_bytes, __entry->ret)
1041f376df2bSJosef Bacik );
1042f376df2bSJosef Bacik 
10431abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__reserved_extent,
10441abe9b8aSliubo 
10459a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
10461abe9b8aSliubo 
104771ff6437SJeff Mahoney 	TP_ARGS(fs_info, start, len),
10481abe9b8aSliubo 
1049bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
10501abe9b8aSliubo 		__field(	u64,  start			)
10511abe9b8aSliubo 		__field(	u64,  len			)
10521abe9b8aSliubo 	),
10531abe9b8aSliubo 
105471ff6437SJeff Mahoney 	TP_fast_assign_btrfs(fs_info,
10551abe9b8aSliubo 		__entry->start		= start;
10561abe9b8aSliubo 		__entry->len		= len;
10571abe9b8aSliubo 	),
10581abe9b8aSliubo 
1059562a7a07SDavid Sterba 	TP_printk_btrfs("root=%llu(%s) start=%llu len=%llu",
106071ff6437SJeff Mahoney 		  show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
10611abe9b8aSliubo 		  (unsigned long long)__entry->start,
10621abe9b8aSliubo 		  (unsigned long long)__entry->len)
10631abe9b8aSliubo );
10641abe9b8aSliubo 
10651abe9b8aSliubo DEFINE_EVENT(btrfs__reserved_extent,  btrfs_reserved_extent_alloc,
10661abe9b8aSliubo 
10679a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
10681abe9b8aSliubo 
106971ff6437SJeff Mahoney 	TP_ARGS(fs_info, start, len)
10701abe9b8aSliubo );
10711abe9b8aSliubo 
10721abe9b8aSliubo DEFINE_EVENT(btrfs__reserved_extent,  btrfs_reserved_extent_free,
10731abe9b8aSliubo 
10749a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
10751abe9b8aSliubo 
107671ff6437SJeff Mahoney 	TP_ARGS(fs_info, start, len)
10771abe9b8aSliubo );
10781abe9b8aSliubo 
10793f7de037SJosef Bacik TRACE_EVENT(find_free_extent,
10803f7de037SJosef Bacik 
10819a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes,
10829a35b637SJeff Mahoney 		 u64 empty_size, u64 data),
10833f7de037SJosef Bacik 
108471ff6437SJeff Mahoney 	TP_ARGS(fs_info, num_bytes, empty_size, data),
10853f7de037SJosef Bacik 
1086bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
10873f7de037SJosef Bacik 		__field(	u64,	num_bytes		)
10883f7de037SJosef Bacik 		__field(	u64,	empty_size		)
10893f7de037SJosef Bacik 		__field(	u64,	data			)
10903f7de037SJosef Bacik 	),
10913f7de037SJosef Bacik 
109271ff6437SJeff Mahoney 	TP_fast_assign_btrfs(fs_info,
10933f7de037SJosef Bacik 		__entry->num_bytes	= num_bytes;
10943f7de037SJosef Bacik 		__entry->empty_size	= empty_size;
10953f7de037SJosef Bacik 		__entry->data		= data;
10963f7de037SJosef Bacik 	),
10973f7de037SJosef Bacik 
1098562a7a07SDavid Sterba 	TP_printk_btrfs("root=%Lu(%s) len=%Lu empty_size=%Lu flags=%Lu(%s)",
109971ff6437SJeff Mahoney 		  show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
11003f7de037SJosef Bacik 		  __entry->num_bytes, __entry->empty_size, __entry->data,
11013f7de037SJosef Bacik 		  __print_flags((unsigned long)__entry->data, "|",
11023f7de037SJosef Bacik 				 BTRFS_GROUP_FLAGS))
11033f7de037SJosef Bacik );
11043f7de037SJosef Bacik 
11053f7de037SJosef Bacik DECLARE_EVENT_CLASS(btrfs__reserve_extent,
11063f7de037SJosef Bacik 
11079a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
11089a35b637SJeff Mahoney 		 const struct btrfs_block_group_cache *block_group, u64 start,
11093f7de037SJosef Bacik 		 u64 len),
11103f7de037SJosef Bacik 
111171ff6437SJeff Mahoney 	TP_ARGS(fs_info, block_group, start, len),
11123f7de037SJosef Bacik 
1113bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
11143f7de037SJosef Bacik 		__field(	u64,	bg_objectid		)
11153f7de037SJosef Bacik 		__field(	u64,	flags			)
11163f7de037SJosef Bacik 		__field(	u64,	start			)
11173f7de037SJosef Bacik 		__field(	u64,	len			)
11183f7de037SJosef Bacik 	),
11193f7de037SJosef Bacik 
112071ff6437SJeff Mahoney 	TP_fast_assign_btrfs(fs_info,
11213f7de037SJosef Bacik 		__entry->bg_objectid	= block_group->key.objectid;
11223f7de037SJosef Bacik 		__entry->flags		= block_group->flags;
11233f7de037SJosef Bacik 		__entry->start		= start;
11243f7de037SJosef Bacik 		__entry->len		= len;
11253f7de037SJosef Bacik 	),
11263f7de037SJosef Bacik 
1127562a7a07SDavid Sterba 	TP_printk_btrfs("root=%Lu(%s) block_group=%Lu flags=%Lu(%s) "
1128562a7a07SDavid Sterba 		  "start=%Lu len=%Lu",
112971ff6437SJeff Mahoney 		  show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
113071ff6437SJeff Mahoney 		  __entry->bg_objectid,
11313f7de037SJosef Bacik 		  __entry->flags, __print_flags((unsigned long)__entry->flags,
11323f7de037SJosef Bacik 						"|", BTRFS_GROUP_FLAGS),
11333f7de037SJosef Bacik 		  __entry->start, __entry->len)
11343f7de037SJosef Bacik );
11353f7de037SJosef Bacik 
11363f7de037SJosef Bacik DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent,
11373f7de037SJosef Bacik 
11389a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
11399a35b637SJeff Mahoney 		 const struct btrfs_block_group_cache *block_group, u64 start,
11403f7de037SJosef Bacik 		 u64 len),
11413f7de037SJosef Bacik 
114271ff6437SJeff Mahoney 	TP_ARGS(fs_info, block_group, start, len)
11433f7de037SJosef Bacik );
11443f7de037SJosef Bacik 
11453f7de037SJosef Bacik DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
11463f7de037SJosef Bacik 
11479a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
11489a35b637SJeff Mahoney 		 const struct btrfs_block_group_cache *block_group, u64 start,
11493f7de037SJosef Bacik 		 u64 len),
11503f7de037SJosef Bacik 
115171ff6437SJeff Mahoney 	TP_ARGS(fs_info, block_group, start, len)
11523f7de037SJosef Bacik );
11533f7de037SJosef Bacik 
11543f7de037SJosef Bacik TRACE_EVENT(btrfs_find_cluster,
11553f7de037SJosef Bacik 
11569a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_block_group_cache *block_group, u64 start,
11573f7de037SJosef Bacik 		 u64 bytes, u64 empty_size, u64 min_bytes),
11583f7de037SJosef Bacik 
11593f7de037SJosef Bacik 	TP_ARGS(block_group, start, bytes, empty_size, min_bytes),
11603f7de037SJosef Bacik 
1161bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
11623f7de037SJosef Bacik 		__field(	u64,	bg_objectid		)
11633f7de037SJosef Bacik 		__field(	u64,	flags			)
11643f7de037SJosef Bacik 		__field(	u64,	start			)
11653f7de037SJosef Bacik 		__field(	u64,	bytes			)
11663f7de037SJosef Bacik 		__field(	u64,	empty_size		)
11673f7de037SJosef Bacik 		__field(	u64,	min_bytes		)
11683f7de037SJosef Bacik 	),
11693f7de037SJosef Bacik 
1170bc074524SJeff Mahoney 	TP_fast_assign_btrfs(block_group->fs_info,
11713f7de037SJosef Bacik 		__entry->bg_objectid	= block_group->key.objectid;
11723f7de037SJosef Bacik 		__entry->flags		= block_group->flags;
11733f7de037SJosef Bacik 		__entry->start		= start;
11743f7de037SJosef Bacik 		__entry->bytes		= bytes;
11753f7de037SJosef Bacik 		__entry->empty_size	= empty_size;
11763f7de037SJosef Bacik 		__entry->min_bytes	= min_bytes;
11773f7de037SJosef Bacik 	),
11783f7de037SJosef Bacik 
1179562a7a07SDavid Sterba 	TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) start=%Lu len=%Lu "
1180562a7a07SDavid Sterba 		  "empty_size=%Lu min_bytes=%Lu", __entry->bg_objectid,
11813f7de037SJosef Bacik 		  __entry->flags,
11823f7de037SJosef Bacik 		  __print_flags((unsigned long)__entry->flags, "|",
11833f7de037SJosef Bacik 				BTRFS_GROUP_FLAGS), __entry->start,
11843f7de037SJosef Bacik 		  __entry->bytes, __entry->empty_size,  __entry->min_bytes)
11853f7de037SJosef Bacik );
11863f7de037SJosef Bacik 
11873f7de037SJosef Bacik TRACE_EVENT(btrfs_failed_cluster_setup,
11883f7de037SJosef Bacik 
11899a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_block_group_cache *block_group),
11903f7de037SJosef Bacik 
11913f7de037SJosef Bacik 	TP_ARGS(block_group),
11923f7de037SJosef Bacik 
1193bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
11943f7de037SJosef Bacik 		__field(	u64,	bg_objectid		)
11953f7de037SJosef Bacik 	),
11963f7de037SJosef Bacik 
1197bc074524SJeff Mahoney 	TP_fast_assign_btrfs(block_group->fs_info,
11983f7de037SJosef Bacik 		__entry->bg_objectid	= block_group->key.objectid;
11993f7de037SJosef Bacik 	),
12003f7de037SJosef Bacik 
1201bc074524SJeff Mahoney 	TP_printk_btrfs("block_group=%Lu", __entry->bg_objectid)
12023f7de037SJosef Bacik );
12033f7de037SJosef Bacik 
12043f7de037SJosef Bacik TRACE_EVENT(btrfs_setup_cluster,
12053f7de037SJosef Bacik 
12069a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_block_group_cache *block_group,
12079a35b637SJeff Mahoney 		 const struct btrfs_free_cluster *cluster,
12089a35b637SJeff Mahoney 		 u64 size, int bitmap),
12093f7de037SJosef Bacik 
12103f7de037SJosef Bacik 	TP_ARGS(block_group, cluster, size, bitmap),
12113f7de037SJosef Bacik 
1212bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
12133f7de037SJosef Bacik 		__field(	u64,	bg_objectid		)
12143f7de037SJosef Bacik 		__field(	u64,	flags			)
12153f7de037SJosef Bacik 		__field(	u64,	start			)
12163f7de037SJosef Bacik 		__field(	u64,	max_size		)
12173f7de037SJosef Bacik 		__field(	u64,	size			)
12183f7de037SJosef Bacik 		__field(	int,	bitmap			)
12193f7de037SJosef Bacik 	),
12203f7de037SJosef Bacik 
1221bc074524SJeff Mahoney 	TP_fast_assign_btrfs(block_group->fs_info,
12223f7de037SJosef Bacik 		__entry->bg_objectid	= block_group->key.objectid;
12233f7de037SJosef Bacik 		__entry->flags		= block_group->flags;
12243f7de037SJosef Bacik 		__entry->start		= cluster->window_start;
12253f7de037SJosef Bacik 		__entry->max_size	= cluster->max_size;
12263f7de037SJosef Bacik 		__entry->size		= size;
12273f7de037SJosef Bacik 		__entry->bitmap		= bitmap;
12283f7de037SJosef Bacik 	),
12293f7de037SJosef Bacik 
1230562a7a07SDavid Sterba 	TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) window_start=%Lu "
1231562a7a07SDavid Sterba 		  "size=%Lu max_size=%Lu bitmap=%d",
12323f7de037SJosef Bacik 		  __entry->bg_objectid,
12333f7de037SJosef Bacik 		  __entry->flags,
12343f7de037SJosef Bacik 		  __print_flags((unsigned long)__entry->flags, "|",
12353f7de037SJosef Bacik 				BTRFS_GROUP_FLAGS), __entry->start,
12363f7de037SJosef Bacik 		  __entry->size, __entry->max_size, __entry->bitmap)
12373f7de037SJosef Bacik );
12383f7de037SJosef Bacik 
1239143bede5SJeff Mahoney struct extent_state;
1240143bede5SJeff Mahoney TRACE_EVENT(alloc_extent_state,
1241143bede5SJeff Mahoney 
12429a35b637SJeff Mahoney 	TP_PROTO(const struct extent_state *state,
12439a35b637SJeff Mahoney 		 gfp_t mask, unsigned long IP),
1244143bede5SJeff Mahoney 
1245143bede5SJeff Mahoney 	TP_ARGS(state, mask, IP),
1246143bede5SJeff Mahoney 
1247143bede5SJeff Mahoney 	TP_STRUCT__entry(
12489a35b637SJeff Mahoney 		__field(const struct extent_state *, state)
1249143bede5SJeff Mahoney 		__field(gfp_t, mask)
1250143bede5SJeff Mahoney 		__field(unsigned long, ip)
1251143bede5SJeff Mahoney 	),
1252143bede5SJeff Mahoney 
1253143bede5SJeff Mahoney 	TP_fast_assign(
1254143bede5SJeff Mahoney 		__entry->state	= state,
1255143bede5SJeff Mahoney 		__entry->mask	= mask,
1256143bede5SJeff Mahoney 		__entry->ip	= IP
1257143bede5SJeff Mahoney 	),
1258143bede5SJeff Mahoney 
1259562a7a07SDavid Sterba 	TP_printk("state=%p mask=%s caller=%pS", __entry->state,
12609a35b637SJeff Mahoney 		  show_gfp_flags(__entry->mask), (const void *)__entry->ip)
1261143bede5SJeff Mahoney );
1262143bede5SJeff Mahoney 
1263143bede5SJeff Mahoney TRACE_EVENT(free_extent_state,
1264143bede5SJeff Mahoney 
12659a35b637SJeff Mahoney 	TP_PROTO(const struct extent_state *state, unsigned long IP),
1266143bede5SJeff Mahoney 
1267143bede5SJeff Mahoney 	TP_ARGS(state, IP),
1268143bede5SJeff Mahoney 
1269143bede5SJeff Mahoney 	TP_STRUCT__entry(
12709a35b637SJeff Mahoney 		__field(const struct extent_state *, state)
1271143bede5SJeff Mahoney 		__field(unsigned long, ip)
1272143bede5SJeff Mahoney 	),
1273143bede5SJeff Mahoney 
1274143bede5SJeff Mahoney 	TP_fast_assign(
1275143bede5SJeff Mahoney 		__entry->state	= state,
1276143bede5SJeff Mahoney 		__entry->ip = IP
1277143bede5SJeff Mahoney 	),
1278143bede5SJeff Mahoney 
1279562a7a07SDavid Sterba 	TP_printk("state=%p caller=%pS", __entry->state,
12809a35b637SJeff Mahoney 		  (const void *)__entry->ip)
1281143bede5SJeff Mahoney );
1282143bede5SJeff Mahoney 
128352483bc2SQu Wenruo DECLARE_EVENT_CLASS(btrfs__work,
128452483bc2SQu Wenruo 
12859a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_work *work),
128652483bc2SQu Wenruo 
128752483bc2SQu Wenruo 	TP_ARGS(work),
128852483bc2SQu Wenruo 
1289bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
12909a35b637SJeff Mahoney 		__field(	const void *,	work			)
12919a35b637SJeff Mahoney 		__field(	const void *,	wq			)
12929a35b637SJeff Mahoney 		__field(	const void *,	func			)
12939a35b637SJeff Mahoney 		__field(	const void *,	ordered_func		)
12949a35b637SJeff Mahoney 		__field(	const void *,	ordered_free		)
12959a35b637SJeff Mahoney 		__field(	const void *,	normal_work		)
129652483bc2SQu Wenruo 	),
129752483bc2SQu Wenruo 
1298bc074524SJeff Mahoney 	TP_fast_assign_btrfs(btrfs_work_owner(work),
129952483bc2SQu Wenruo 		__entry->work		= work;
130052483bc2SQu Wenruo 		__entry->wq		= work->wq;
130152483bc2SQu Wenruo 		__entry->func		= work->func;
130252483bc2SQu Wenruo 		__entry->ordered_func	= work->ordered_func;
130352483bc2SQu Wenruo 		__entry->ordered_free	= work->ordered_free;
1304b38a6258SLiu Bo 		__entry->normal_work	= &work->normal_work;
130552483bc2SQu Wenruo 	),
130652483bc2SQu Wenruo 
1307562a7a07SDavid Sterba 	TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%pf ordered_func=%p "
1308b38a6258SLiu Bo 		  "ordered_free=%p",
1309b38a6258SLiu Bo 		  __entry->work, __entry->normal_work, __entry->wq,
1310b38a6258SLiu Bo 		   __entry->func, __entry->ordered_func, __entry->ordered_free)
131152483bc2SQu Wenruo );
131252483bc2SQu Wenruo 
1313ac0c7cf8SDavid Sterba /*
1314ac0c7cf8SDavid Sterba  * For situiations when the work is freed, we pass fs_info and a tag that that
1315ac0c7cf8SDavid Sterba  * matches address of the work structure so it can be paired with the
1316ac0c7cf8SDavid Sterba  * scheduling event.
1317ac0c7cf8SDavid Sterba  */
131852483bc2SQu Wenruo DECLARE_EVENT_CLASS(btrfs__work__done,
131952483bc2SQu Wenruo 
13209a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag),
132152483bc2SQu Wenruo 
1322ac0c7cf8SDavid Sterba 	TP_ARGS(fs_info, wtag),
132352483bc2SQu Wenruo 
1324bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
13259a35b637SJeff Mahoney 		__field(	const void *,	wtag			)
132652483bc2SQu Wenruo 	),
132752483bc2SQu Wenruo 
1328ac0c7cf8SDavid Sterba 	TP_fast_assign_btrfs(fs_info,
1329ac0c7cf8SDavid Sterba 		__entry->wtag		= wtag;
133052483bc2SQu Wenruo 	),
133152483bc2SQu Wenruo 
1332ac0c7cf8SDavid Sterba 	TP_printk_btrfs("work->%p", __entry->wtag)
133352483bc2SQu Wenruo );
133452483bc2SQu Wenruo 
133552483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_work_queued,
133652483bc2SQu Wenruo 
13379a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_work *work),
133852483bc2SQu Wenruo 
133952483bc2SQu Wenruo 	TP_ARGS(work)
134052483bc2SQu Wenruo );
134152483bc2SQu Wenruo 
134252483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_work_sched,
134352483bc2SQu Wenruo 
13449a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_work *work),
134552483bc2SQu Wenruo 
134652483bc2SQu Wenruo 	TP_ARGS(work)
134752483bc2SQu Wenruo );
134852483bc2SQu Wenruo 
134952483bc2SQu Wenruo DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done,
135052483bc2SQu Wenruo 
13519a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag),
135252483bc2SQu Wenruo 
1353ac0c7cf8SDavid Sterba 	TP_ARGS(fs_info, wtag)
135452483bc2SQu Wenruo );
135552483bc2SQu Wenruo 
135652483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_ordered_sched,
135752483bc2SQu Wenruo 
13589a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_work *work),
135952483bc2SQu Wenruo 
136052483bc2SQu Wenruo 	TP_ARGS(work)
136152483bc2SQu Wenruo );
136252483bc2SQu Wenruo 
1363c3a46891SQu Wenruo DECLARE_EVENT_CLASS(btrfs__workqueue,
1364c3a46891SQu Wenruo 
13659a35b637SJeff Mahoney 	TP_PROTO(const struct __btrfs_workqueue *wq,
13669a35b637SJeff Mahoney 		 const char *name, int high),
1367c3a46891SQu Wenruo 
1368c3a46891SQu Wenruo 	TP_ARGS(wq, name, high),
1369c3a46891SQu Wenruo 
1370bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
13719a35b637SJeff Mahoney 		__field(	const void *,	wq			)
1372c3a46891SQu Wenruo 		__string(	name,	name			)
1373c3a46891SQu Wenruo 		__field(	int ,	high			)
1374c3a46891SQu Wenruo 	),
1375c3a46891SQu Wenruo 
1376bc074524SJeff Mahoney 	TP_fast_assign_btrfs(btrfs_workqueue_owner(wq),
1377c3a46891SQu Wenruo 		__entry->wq		= wq;
1378c3a46891SQu Wenruo 		__assign_str(name, name);
1379c3a46891SQu Wenruo 		__entry->high		= high;
1380c3a46891SQu Wenruo 	),
1381c3a46891SQu Wenruo 
1382562a7a07SDavid Sterba 	TP_printk_btrfs("name=%s%s wq=%p", __get_str(name),
1383c3a46891SQu Wenruo 		  __print_flags(__entry->high, "",
1384c3a46891SQu Wenruo 				{(WQ_HIGHPRI),	"-high"}),
1385c3a46891SQu Wenruo 		  __entry->wq)
1386c3a46891SQu Wenruo );
1387c3a46891SQu Wenruo 
1388c3a46891SQu Wenruo DEFINE_EVENT(btrfs__workqueue, btrfs_workqueue_alloc,
1389c3a46891SQu Wenruo 
13909a35b637SJeff Mahoney 	TP_PROTO(const struct __btrfs_workqueue *wq,
13919a35b637SJeff Mahoney 		 const char *name, int high),
1392c3a46891SQu Wenruo 
1393c3a46891SQu Wenruo 	TP_ARGS(wq, name, high)
1394c3a46891SQu Wenruo );
1395c3a46891SQu Wenruo 
1396c3a46891SQu Wenruo DECLARE_EVENT_CLASS(btrfs__workqueue_done,
1397c3a46891SQu Wenruo 
13989a35b637SJeff Mahoney 	TP_PROTO(const struct __btrfs_workqueue *wq),
1399c3a46891SQu Wenruo 
1400c3a46891SQu Wenruo 	TP_ARGS(wq),
1401c3a46891SQu Wenruo 
1402bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
14039a35b637SJeff Mahoney 		__field(	const void *,	wq		)
1404c3a46891SQu Wenruo 	),
1405c3a46891SQu Wenruo 
1406bc074524SJeff Mahoney 	TP_fast_assign_btrfs(btrfs_workqueue_owner(wq),
1407c3a46891SQu Wenruo 		__entry->wq		= wq;
1408c3a46891SQu Wenruo 	),
1409c3a46891SQu Wenruo 
1410bc074524SJeff Mahoney 	TP_printk_btrfs("wq=%p", __entry->wq)
1411c3a46891SQu Wenruo );
1412c3a46891SQu Wenruo 
1413c3a46891SQu Wenruo DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy,
1414c3a46891SQu Wenruo 
14159a35b637SJeff Mahoney 	TP_PROTO(const struct __btrfs_workqueue *wq),
1416c3a46891SQu Wenruo 
1417c3a46891SQu Wenruo 	TP_ARGS(wq)
1418c3a46891SQu Wenruo );
141952483bc2SQu Wenruo 
142081fb6f77SQu Wenruo #define BTRFS_QGROUP_OPERATIONS				\
142181fb6f77SQu Wenruo 	{ QGROUP_RESERVE,	"reserve"	},	\
142281fb6f77SQu Wenruo 	{ QGROUP_RELEASE,	"release"	},	\
142381fb6f77SQu Wenruo 	{ QGROUP_FREE,		"free"		}
142481fb6f77SQu Wenruo 
142581fb6f77SQu Wenruo DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data,
142681fb6f77SQu Wenruo 
14279a35b637SJeff Mahoney 	TP_PROTO(const struct inode *inode, u64 start, u64 len,
14289a35b637SJeff Mahoney 		 u64 reserved, int op),
142981fb6f77SQu Wenruo 
143081fb6f77SQu Wenruo 	TP_ARGS(inode, start, len, reserved, op),
143181fb6f77SQu Wenruo 
1432bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
143381fb6f77SQu Wenruo 		__field(	u64,		rootid		)
143481fb6f77SQu Wenruo 		__field(	unsigned long,	ino		)
143581fb6f77SQu Wenruo 		__field(	u64,		start		)
143681fb6f77SQu Wenruo 		__field(	u64,		len		)
143781fb6f77SQu Wenruo 		__field(	u64,		reserved	)
143881fb6f77SQu Wenruo 		__field(	int,		op		)
143981fb6f77SQu Wenruo 	),
144081fb6f77SQu Wenruo 
1441bc074524SJeff Mahoney 	TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
144281fb6f77SQu Wenruo 		__entry->rootid		= BTRFS_I(inode)->root->objectid;
144381fb6f77SQu Wenruo 		__entry->ino		= inode->i_ino;
144481fb6f77SQu Wenruo 		__entry->start		= start;
144581fb6f77SQu Wenruo 		__entry->len		= len;
144681fb6f77SQu Wenruo 		__entry->reserved	= reserved;
144781fb6f77SQu Wenruo 		__entry->op		= op;
144881fb6f77SQu Wenruo 	),
144981fb6f77SQu Wenruo 
1450562a7a07SDavid Sterba 	TP_printk_btrfs("root=%llu ino=%lu start=%llu len=%llu reserved=%llu op=%s",
145181fb6f77SQu Wenruo 		  __entry->rootid, __entry->ino, __entry->start, __entry->len,
145281fb6f77SQu Wenruo 		  __entry->reserved,
145381fb6f77SQu Wenruo 		  __print_flags((unsigned long)__entry->op, "",
145481fb6f77SQu Wenruo 				BTRFS_QGROUP_OPERATIONS)
145581fb6f77SQu Wenruo 	)
145681fb6f77SQu Wenruo );
145781fb6f77SQu Wenruo 
145881fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_reserve_data,
145981fb6f77SQu Wenruo 
14609a35b637SJeff Mahoney 	TP_PROTO(const struct inode *inode, u64 start, u64 len,
14619a35b637SJeff Mahoney 		 u64 reserved, int op),
146281fb6f77SQu Wenruo 
146381fb6f77SQu Wenruo 	TP_ARGS(inode, start, len, reserved, op)
146481fb6f77SQu Wenruo );
146581fb6f77SQu Wenruo 
146681fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_release_data,
146781fb6f77SQu Wenruo 
14689a35b637SJeff Mahoney 	TP_PROTO(const struct inode *inode, u64 start, u64 len,
14699a35b637SJeff Mahoney 		 u64 reserved, int op),
147081fb6f77SQu Wenruo 
147181fb6f77SQu Wenruo 	TP_ARGS(inode, start, len, reserved, op)
147281fb6f77SQu Wenruo );
147381fb6f77SQu Wenruo 
147481fb6f77SQu Wenruo DECLARE_EVENT_CLASS(btrfs__qgroup_delayed_ref,
147581fb6f77SQu Wenruo 
14769a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
14779a35b637SJeff Mahoney 		 u64 ref_root, u64 reserved),
147881fb6f77SQu Wenruo 
1479bc074524SJeff Mahoney 	TP_ARGS(fs_info, ref_root, reserved),
148081fb6f77SQu Wenruo 
1481bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
148281fb6f77SQu Wenruo 		__field(	u64,		ref_root	)
148381fb6f77SQu Wenruo 		__field(	u64,		reserved	)
148481fb6f77SQu Wenruo 	),
148581fb6f77SQu Wenruo 
1486bc074524SJeff Mahoney 	TP_fast_assign_btrfs(fs_info,
148781fb6f77SQu Wenruo 		__entry->ref_root	= ref_root;
148881fb6f77SQu Wenruo 		__entry->reserved	= reserved;
148981fb6f77SQu Wenruo 	),
149081fb6f77SQu Wenruo 
1491562a7a07SDavid Sterba 	TP_printk_btrfs("root=%llu reserved=%llu op=free",
149281fb6f77SQu Wenruo 		  __entry->ref_root, __entry->reserved)
149381fb6f77SQu Wenruo );
149481fb6f77SQu Wenruo 
149581fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_delayed_ref, btrfs_qgroup_free_delayed_ref,
149681fb6f77SQu Wenruo 
14979a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
14989a35b637SJeff Mahoney 		 u64 ref_root, u64 reserved),
149981fb6f77SQu Wenruo 
1500bc074524SJeff Mahoney 	TP_ARGS(fs_info, ref_root, reserved)
150181fb6f77SQu Wenruo );
15020f5dcf8dSMark Fasheh 
15030f5dcf8dSMark Fasheh DECLARE_EVENT_CLASS(btrfs_qgroup_extent,
15049a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
15059a35b637SJeff Mahoney 		 const struct btrfs_qgroup_extent_record *rec),
15060f5dcf8dSMark Fasheh 
1507bc074524SJeff Mahoney 	TP_ARGS(fs_info, rec),
15080f5dcf8dSMark Fasheh 
1509bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
15100f5dcf8dSMark Fasheh 		__field(	u64,  bytenr		)
15110f5dcf8dSMark Fasheh 		__field(	u64,  num_bytes		)
15120f5dcf8dSMark Fasheh 	),
15130f5dcf8dSMark Fasheh 
1514bc074524SJeff Mahoney 	TP_fast_assign_btrfs(fs_info,
15150f5dcf8dSMark Fasheh 		__entry->bytenr		= rec->bytenr,
15160f5dcf8dSMark Fasheh 		__entry->num_bytes	= rec->num_bytes;
15170f5dcf8dSMark Fasheh 	),
15180f5dcf8dSMark Fasheh 
1519562a7a07SDavid Sterba 	TP_printk_btrfs("bytenr=%llu num_bytes=%llu",
15200f5dcf8dSMark Fasheh 		  (unsigned long long)__entry->bytenr,
15210f5dcf8dSMark Fasheh 		  (unsigned long long)__entry->num_bytes)
15220f5dcf8dSMark Fasheh );
15230f5dcf8dSMark Fasheh 
15240f5dcf8dSMark Fasheh DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents,
15250f5dcf8dSMark Fasheh 
15269a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
15279a35b637SJeff Mahoney 		 const struct btrfs_qgroup_extent_record *rec),
15280f5dcf8dSMark Fasheh 
1529bc074524SJeff Mahoney 	TP_ARGS(fs_info, rec)
15300f5dcf8dSMark Fasheh );
15310f5dcf8dSMark Fasheh 
153250b3e040SQu Wenruo DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_trace_extent,
15330f5dcf8dSMark Fasheh 
15349a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
15359a35b637SJeff Mahoney 		 const struct btrfs_qgroup_extent_record *rec),
15360f5dcf8dSMark Fasheh 
1537bc074524SJeff Mahoney 	TP_ARGS(fs_info, rec)
15380f5dcf8dSMark Fasheh );
15390f5dcf8dSMark Fasheh 
15400f5dcf8dSMark Fasheh TRACE_EVENT(btrfs_qgroup_account_extent,
15410f5dcf8dSMark Fasheh 
15429a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info, u64 bytenr,
1543bc074524SJeff Mahoney 		 u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots),
15440f5dcf8dSMark Fasheh 
1545bc074524SJeff Mahoney 	TP_ARGS(fs_info, bytenr, num_bytes, nr_old_roots, nr_new_roots),
15460f5dcf8dSMark Fasheh 
1547bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
15480f5dcf8dSMark Fasheh 		__field(	u64,  bytenr			)
15490f5dcf8dSMark Fasheh 		__field(	u64,  num_bytes			)
15500f5dcf8dSMark Fasheh 		__field(	u64,  nr_old_roots		)
15510f5dcf8dSMark Fasheh 		__field(	u64,  nr_new_roots		)
15520f5dcf8dSMark Fasheh 	),
15530f5dcf8dSMark Fasheh 
1554bc074524SJeff Mahoney 	TP_fast_assign_btrfs(fs_info,
15550f5dcf8dSMark Fasheh 		__entry->bytenr		= bytenr;
15560f5dcf8dSMark Fasheh 		__entry->num_bytes	= num_bytes;
15570f5dcf8dSMark Fasheh 		__entry->nr_old_roots	= nr_old_roots;
15580f5dcf8dSMark Fasheh 		__entry->nr_new_roots	= nr_new_roots;
15590f5dcf8dSMark Fasheh 	),
15600f5dcf8dSMark Fasheh 
1561562a7a07SDavid Sterba 	TP_printk_btrfs("bytenr=%llu num_bytes=%llu nr_old_roots=%llu "
15620f5dcf8dSMark Fasheh 		  "nr_new_roots=%llu",
15630f5dcf8dSMark Fasheh 		  __entry->bytenr,
15640f5dcf8dSMark Fasheh 		  __entry->num_bytes,
15650f5dcf8dSMark Fasheh 		  __entry->nr_old_roots,
15660f5dcf8dSMark Fasheh 		  __entry->nr_new_roots)
15670f5dcf8dSMark Fasheh );
15680f5dcf8dSMark Fasheh 
15690f5dcf8dSMark Fasheh TRACE_EVENT(qgroup_update_counters,
15700f5dcf8dSMark Fasheh 
15719a35b637SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info, u64 qgid,
1572bc074524SJeff Mahoney 		 u64 cur_old_count, u64 cur_new_count),
15730f5dcf8dSMark Fasheh 
1574bc074524SJeff Mahoney 	TP_ARGS(fs_info, qgid, cur_old_count, cur_new_count),
15750f5dcf8dSMark Fasheh 
1576bc074524SJeff Mahoney 	TP_STRUCT__entry_btrfs(
15770f5dcf8dSMark Fasheh 		__field(	u64,  qgid			)
15780f5dcf8dSMark Fasheh 		__field(	u64,  cur_old_count		)
15790f5dcf8dSMark Fasheh 		__field(	u64,  cur_new_count		)
15800f5dcf8dSMark Fasheh 	),
15810f5dcf8dSMark Fasheh 
1582bc074524SJeff Mahoney 	TP_fast_assign_btrfs(fs_info,
15830f5dcf8dSMark Fasheh 		__entry->qgid		= qgid;
15840f5dcf8dSMark Fasheh 		__entry->cur_old_count	= cur_old_count;
15850f5dcf8dSMark Fasheh 		__entry->cur_new_count	= cur_new_count;
15860f5dcf8dSMark Fasheh 	),
15870f5dcf8dSMark Fasheh 
1588562a7a07SDavid Sterba 	TP_printk_btrfs("qgid=%llu cur_old_count=%llu cur_new_count=%llu",
15890f5dcf8dSMark Fasheh 		  __entry->qgid,
15900f5dcf8dSMark Fasheh 		  __entry->cur_old_count,
15910f5dcf8dSMark Fasheh 		  __entry->cur_new_count)
15920f5dcf8dSMark Fasheh );
15930f5dcf8dSMark Fasheh 
15943159fe7bSQu Wenruo TRACE_EVENT(qgroup_update_reserve,
15953159fe7bSQu Wenruo 
15963159fe7bSQu Wenruo 	TP_PROTO(struct btrfs_fs_info *fs_info, struct btrfs_qgroup *qgroup,
15973159fe7bSQu Wenruo 		 s64 diff),
15983159fe7bSQu Wenruo 
15993159fe7bSQu Wenruo 	TP_ARGS(fs_info, qgroup, diff),
16003159fe7bSQu Wenruo 
16013159fe7bSQu Wenruo 	TP_STRUCT__entry_btrfs(
16023159fe7bSQu Wenruo 		__field(	u64,	qgid			)
16033159fe7bSQu Wenruo 		__field(	u64,	cur_reserved		)
16043159fe7bSQu Wenruo 		__field(	s64,	diff			)
16053159fe7bSQu Wenruo 	),
16063159fe7bSQu Wenruo 
16073159fe7bSQu Wenruo 	TP_fast_assign_btrfs(fs_info,
16083159fe7bSQu Wenruo 		__entry->qgid		= qgroup->qgroupid;
16093159fe7bSQu Wenruo 		__entry->cur_reserved	= qgroup->reserved;
16103159fe7bSQu Wenruo 		__entry->diff		= diff;
16113159fe7bSQu Wenruo 	),
16123159fe7bSQu Wenruo 
16133159fe7bSQu Wenruo 	TP_printk_btrfs("qgid=%llu cur_reserved=%llu diff=%lld",
16143159fe7bSQu Wenruo 		__entry->qgid, __entry->cur_reserved, __entry->diff)
16153159fe7bSQu Wenruo );
16163159fe7bSQu Wenruo 
16173159fe7bSQu Wenruo TRACE_EVENT(qgroup_meta_reserve,
16183159fe7bSQu Wenruo 
16193159fe7bSQu Wenruo 	TP_PROTO(struct btrfs_root *root, s64 diff),
16203159fe7bSQu Wenruo 
16213159fe7bSQu Wenruo 	TP_ARGS(root, diff),
16223159fe7bSQu Wenruo 
16233159fe7bSQu Wenruo 	TP_STRUCT__entry_btrfs(
16243159fe7bSQu Wenruo 		__field(	u64,	refroot			)
16253159fe7bSQu Wenruo 		__field(	s64,	diff			)
16263159fe7bSQu Wenruo 	),
16273159fe7bSQu Wenruo 
16283159fe7bSQu Wenruo 	TP_fast_assign_btrfs(root->fs_info,
16293159fe7bSQu Wenruo 		__entry->refroot	= root->objectid;
16303159fe7bSQu Wenruo 		__entry->diff		= diff;
16313159fe7bSQu Wenruo 	),
16323159fe7bSQu Wenruo 
16333159fe7bSQu Wenruo 	TP_printk_btrfs("refroot=%llu(%s) diff=%lld",
16343159fe7bSQu Wenruo 		show_root_type(__entry->refroot), __entry->diff)
16353159fe7bSQu Wenruo );
16363159fe7bSQu Wenruo 
163700142756SJeff Mahoney DECLARE_EVENT_CLASS(btrfs__prelim_ref,
163800142756SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
163900142756SJeff Mahoney 		 const struct prelim_ref *oldref,
164000142756SJeff Mahoney 		 const struct prelim_ref *newref, u64 tree_size),
164100142756SJeff Mahoney 	TP_ARGS(fs_info, newref, oldref, tree_size),
164200142756SJeff Mahoney 
164300142756SJeff Mahoney 	TP_STRUCT__entry_btrfs(
164400142756SJeff Mahoney 		__field(	u64,  root_id		)
164500142756SJeff Mahoney 		__field(	u64,  objectid		)
164600142756SJeff Mahoney 		__field(	 u8,  type		)
164700142756SJeff Mahoney 		__field(	u64,  offset		)
164800142756SJeff Mahoney 		__field(	int,  level		)
164900142756SJeff Mahoney 		__field(	int,  old_count		)
165000142756SJeff Mahoney 		__field(	u64,  parent		)
165100142756SJeff Mahoney 		__field(	u64,  bytenr		)
165200142756SJeff Mahoney 		__field(	int,  mod_count		)
165300142756SJeff Mahoney 		__field(	u64,  tree_size		)
165400142756SJeff Mahoney 	),
165500142756SJeff Mahoney 
165600142756SJeff Mahoney 	TP_fast_assign_btrfs(fs_info,
165700142756SJeff Mahoney 		__entry->root_id	= oldref->root_id;
165800142756SJeff Mahoney 		__entry->objectid	= oldref->key_for_search.objectid;
165900142756SJeff Mahoney 		__entry->type		= oldref->key_for_search.type;
166000142756SJeff Mahoney 		__entry->offset		= oldref->key_for_search.offset;
166100142756SJeff Mahoney 		__entry->level		= oldref->level;
166200142756SJeff Mahoney 		__entry->old_count	= oldref->count;
166300142756SJeff Mahoney 		__entry->parent		= oldref->parent;
166400142756SJeff Mahoney 		__entry->bytenr		= oldref->wanted_disk_byte;
166500142756SJeff Mahoney 		__entry->mod_count	= newref ? newref->count : 0;
166600142756SJeff Mahoney 		__entry->tree_size	= tree_size;
166700142756SJeff Mahoney 	),
166800142756SJeff Mahoney 
166900142756SJeff Mahoney 	TP_printk_btrfs("root_id=%llu key=[%llu,%u,%llu] level=%d count=[%d+%d=%d] parent=%llu wanted_disk_byte=%llu nodes=%llu",
167000142756SJeff Mahoney 			(unsigned long long)__entry->root_id,
167100142756SJeff Mahoney 			(unsigned long long)__entry->objectid, __entry->type,
167200142756SJeff Mahoney 			(unsigned long long)__entry->offset, __entry->level,
167300142756SJeff Mahoney 			__entry->old_count, __entry->mod_count,
167400142756SJeff Mahoney 			__entry->old_count + __entry->mod_count,
167500142756SJeff Mahoney 			(unsigned long long)__entry->parent,
167600142756SJeff Mahoney 			(unsigned long long)__entry->bytenr,
167700142756SJeff Mahoney 			(unsigned long long)__entry->tree_size)
167800142756SJeff Mahoney );
167900142756SJeff Mahoney 
168000142756SJeff Mahoney DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_merge,
168100142756SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
168200142756SJeff Mahoney 		 const struct prelim_ref *oldref,
168300142756SJeff Mahoney 		 const struct prelim_ref *newref, u64 tree_size),
168400142756SJeff Mahoney 	TP_ARGS(fs_info, oldref, newref, tree_size)
168500142756SJeff Mahoney );
168600142756SJeff Mahoney 
168700142756SJeff Mahoney DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_insert,
168800142756SJeff Mahoney 	TP_PROTO(const struct btrfs_fs_info *fs_info,
168900142756SJeff Mahoney 		 const struct prelim_ref *oldref,
169000142756SJeff Mahoney 		 const struct prelim_ref *newref, u64 tree_size),
169100142756SJeff Mahoney 	TP_ARGS(fs_info, oldref, newref, tree_size)
169200142756SJeff Mahoney );
169300142756SJeff Mahoney 
16941abe9b8aSliubo #endif /* _TRACE_BTRFS_H */
16951abe9b8aSliubo 
16961abe9b8aSliubo /* This part must be outside protection */
16971abe9b8aSliubo #include <trace/define_trace.h>
1698