1 From e13a7d262928984154fcf89feb14098e0cd1ad31 Mon Sep 17 00:00:00 2001
2 From: Michael Jeanson <mjeanson@efficios.com>
3 Date: Tue, 27 Oct 2020 11:42:23 -0400
4 Subject: [PATCH 04/11] fix: btrfs: tracepoints: output proper root owner for
5 trace_find_free_extent() (v5.10)
9 commit 437490fed3b0c9ae21af8f70e0f338d34560842b
10 Author: Qu Wenruo <wqu@suse.com>
11 Date: Tue Jul 28 09:42:49 2020 +0800
13 btrfs: tracepoints: output proper root owner for trace_find_free_extent()
15 The current trace event always output result like this:
17 find_free_extent: root=2(EXTENT_TREE) len=16384 empty_size=0 flags=4(METADATA)
18 find_free_extent: root=2(EXTENT_TREE) len=16384 empty_size=0 flags=4(METADATA)
19 find_free_extent: root=2(EXTENT_TREE) len=8192 empty_size=0 flags=1(DATA)
20 find_free_extent: root=2(EXTENT_TREE) len=8192 empty_size=0 flags=1(DATA)
21 find_free_extent: root=2(EXTENT_TREE) len=4096 empty_size=0 flags=1(DATA)
22 find_free_extent: root=2(EXTENT_TREE) len=4096 empty_size=0 flags=1(DATA)
24 T's saying we're allocating data extent for EXTENT tree, which is not
27 It's because we always use EXTENT tree as the owner for
28 trace_find_free_extent() without using the @root from
29 btrfs_reserve_extent().
31 This patch will change the parameter to use proper @root for
32 trace_find_free_extent():
34 Now it looks much better:
36 find_free_extent: root=5(FS_TREE) len=16384 empty_size=0 flags=36(METADATA|DUP)
37 find_free_extent: root=5(FS_TREE) len=8192 empty_size=0 flags=1(DATA)
38 find_free_extent: root=5(FS_TREE) len=16384 empty_size=0 flags=1(DATA)
39 find_free_extent: root=5(FS_TREE) len=4096 empty_size=0 flags=1(DATA)
40 find_free_extent: root=5(FS_TREE) len=8192 empty_size=0 flags=1(DATA)
41 find_free_extent: root=5(FS_TREE) len=16384 empty_size=0 flags=36(METADATA|DUP)
42 find_free_extent: root=7(CSUM_TREE) len=16384 empty_size=0 flags=36(METADATA|DUP)
43 find_free_extent: root=2(EXTENT_TREE) len=16384 empty_size=0 flags=36(METADATA|DUP)
44 find_free_extent: root=1(ROOT_TREE) len=16384 empty_size=0 flags=36(METADATA|DUP)
46 Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
47 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
48 Change-Id: I1d674064d29b31417e2acffdeb735f5052a87032
50 Upstream-Status: Backport
52 Signed-off-by: He Zhe <zhe.he@windriver.com>
54 instrumentation/events/lttng-module/btrfs.h | 206 ++++++++++++--------
55 1 file changed, 122 insertions(+), 84 deletions(-)
57 diff --git a/instrumentation/events/lttng-module/btrfs.h b/instrumentation/events/lttng-module/btrfs.h
58 index 7b29008..52fcfd0 100644
59 --- a/instrumentation/events/lttng-module/btrfs.h
60 +++ b/instrumentation/events/lttng-module/btrfs.h
61 @@ -1856,7 +1856,29 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserved_extent, btrfs_reserved_extent_f
63 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
65 -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
66 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0) || \
67 + LTTNG_KERNEL_RANGE(5,9,6, 5,10,0) || \
68 + LTTNG_KERNEL_RANGE(5,4,78, 5,5,0))
69 +LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
71 + btrfs_find_free_extent,
73 + TP_PROTO(const struct btrfs_root *root, u64 num_bytes, u64 empty_size,
76 + TP_ARGS(root, num_bytes, empty_size, data),
79 + ctf_array(u8, fsid, root->lttng_fs_info_fsid, BTRFS_UUID_SIZE)
80 + ctf_integer(u64, root_objectid, root->root_key.objectid)
81 + ctf_integer(u64, num_bytes, num_bytes)
82 + ctf_integer(u64, empty_size, empty_size)
83 + ctf_integer(u64, data, data)
87 +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
89 LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
91 btrfs_find_free_extent,
92 @@ -1874,6 +1896,105 @@ LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
96 +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0))
98 +LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
100 + btrfs_find_free_extent,
102 + TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
105 + TP_ARGS(fs_info, num_bytes, empty_size, data),
108 + ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
109 + ctf_integer(u64, num_bytes, num_bytes)
110 + ctf_integer(u64, empty_size, empty_size)
111 + ctf_integer(u64, data, data)
115 +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
117 +LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
119 + btrfs_find_free_extent,
121 + TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
124 + TP_ARGS(fs_info, num_bytes, empty_size, data),
127 + ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
128 + ctf_integer(u64, num_bytes, num_bytes)
129 + ctf_integer(u64, empty_size, empty_size)
130 + ctf_integer(u64, data, data)
134 +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
136 +LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
138 + btrfs_find_free_extent,
140 + TP_PROTO(struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
143 + TP_ARGS(fs_info, num_bytes, empty_size, data),
146 + ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
147 + ctf_integer(u64, num_bytes, num_bytes)
148 + ctf_integer(u64, empty_size, empty_size)
149 + ctf_integer(u64, data, data)
153 +#elif (LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
154 + LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
155 + LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
156 + LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
158 +LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
160 + btrfs_find_free_extent,
162 + TP_PROTO(const struct btrfs_root *root, u64 num_bytes, u64 empty_size,
165 + TP_ARGS(root, num_bytes, empty_size, data),
168 + ctf_integer(u64, root_objectid, root->root_key.objectid)
169 + ctf_integer(u64, num_bytes, num_bytes)
170 + ctf_integer(u64, empty_size, empty_size)
171 + ctf_integer(u64, data, data)
174 +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
176 +LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
178 + btrfs_find_free_extent,
180 + TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size,
183 + TP_ARGS(root, num_bytes, empty_size, data),
186 + ctf_integer(u64, root_objectid, root->root_key.objectid)
187 + ctf_integer(u64, num_bytes, num_bytes)
188 + ctf_integer(u64, empty_size, empty_size)
189 + ctf_integer(u64, data, data)
194 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
195 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
197 TP_PROTO(const struct btrfs_block_group *block_group, u64 start,
198 @@ -1907,22 +2028,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus
201 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0))
202 -LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
204 - btrfs_find_free_extent,
206 - TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
209 - TP_ARGS(fs_info, num_bytes, empty_size, data),
212 - ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
213 - ctf_integer(u64, num_bytes, num_bytes)
214 - ctf_integer(u64, empty_size, empty_size)
215 - ctf_integer(u64, data, data)
219 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
221 @@ -1957,22 +2062,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus
224 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
225 -LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
227 - btrfs_find_free_extent,
229 - TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
232 - TP_ARGS(fs_info, num_bytes, empty_size, data),
235 - ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
236 - ctf_integer(u64, num_bytes, num_bytes)
237 - ctf_integer(u64, empty_size, empty_size)
238 - ctf_integer(u64, data, data)
242 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
244 @@ -2011,23 +2100,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus
246 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
248 -LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
250 - btrfs_find_free_extent,
252 - TP_PROTO(struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
255 - TP_ARGS(fs_info, num_bytes, empty_size, data),
258 - ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
259 - ctf_integer(u64, num_bytes, num_bytes)
260 - ctf_integer(u64, empty_size, empty_size)
261 - ctf_integer(u64, data, data)
265 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
267 TP_PROTO(struct btrfs_fs_info *fs_info,
268 @@ -2066,23 +2138,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus
269 LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
270 LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
272 -LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
274 - btrfs_find_free_extent,
276 - TP_PROTO(const struct btrfs_root *root, u64 num_bytes, u64 empty_size,
279 - TP_ARGS(root, num_bytes, empty_size, data),
282 - ctf_integer(u64, root_objectid, root->root_key.objectid)
283 - ctf_integer(u64, num_bytes, num_bytes)
284 - ctf_integer(u64, empty_size, empty_size)
285 - ctf_integer(u64, data, data)
289 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
291 TP_PROTO(const struct btrfs_root *root,
292 @@ -2120,23 +2175,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus
294 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
296 -LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
298 - btrfs_find_free_extent,
300 - TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size,
303 - TP_ARGS(root, num_bytes, empty_size, data),
306 - ctf_integer(u64, root_objectid, root->root_key.objectid)
307 - ctf_integer(u64, num_bytes, num_bytes)
308 - ctf_integer(u64, empty_size, empty_size)
309 - ctf_integer(u64, data, data)
313 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
315 TP_PROTO(struct btrfs_root *root,