Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 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) |
| 6 | |
| 7 | See upstream commit : |
| 8 | |
| 9 | commit 437490fed3b0c9ae21af8f70e0f338d34560842b |
| 10 | Author: Qu Wenruo <wqu@suse.com> |
| 11 | Date: Tue Jul 28 09:42:49 2020 +0800 |
| 12 | |
| 13 | btrfs: tracepoints: output proper root owner for trace_find_free_extent() |
| 14 | |
| 15 | The current trace event always output result like this: |
| 16 | |
| 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) |
| 23 | |
| 24 | T's saying we're allocating data extent for EXTENT tree, which is not |
| 25 | even possible. |
| 26 | |
| 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(). |
| 30 | |
| 31 | This patch will change the parameter to use proper @root for |
| 32 | trace_find_free_extent(): |
| 33 | |
| 34 | Now it looks much better: |
| 35 | |
| 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) |
| 45 | |
| 46 | Signed-off-by: Michael Jeanson <mjeanson@efficios.com> |
| 47 | Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 48 | Change-Id: I1d674064d29b31417e2acffdeb735f5052a87032 |
| 49 | |
| 50 | Upstream-Status: Backport |
| 51 | |
| 52 | Signed-off-by: He Zhe <zhe.he@windriver.com> |
| 53 | --- |
| 54 | instrumentation/events/lttng-module/btrfs.h | 206 ++++++++++++-------- |
| 55 | 1 file changed, 122 insertions(+), 84 deletions(-) |
| 56 | |
| 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 |
| 62 | |
| 63 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */ |
| 64 | |
| 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, |
| 70 | + |
| 71 | + btrfs_find_free_extent, |
| 72 | + |
| 73 | + TP_PROTO(const struct btrfs_root *root, u64 num_bytes, u64 empty_size, |
| 74 | + u64 data), |
| 75 | + |
| 76 | + TP_ARGS(root, num_bytes, empty_size, data), |
| 77 | + |
| 78 | + TP_FIELDS( |
| 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) |
| 84 | + ) |
| 85 | +) |
| 86 | + |
| 87 | +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0)) |
| 88 | + |
| 89 | LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, |
| 90 | |
| 91 | btrfs_find_free_extent, |
| 92 | @@ -1874,6 +1896,105 @@ LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, |
| 93 | ) |
| 94 | ) |
| 95 | |
| 96 | +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0)) |
| 97 | + |
| 98 | +LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, |
| 99 | + |
| 100 | + btrfs_find_free_extent, |
| 101 | + |
| 102 | + TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size, |
| 103 | + u64 data), |
| 104 | + |
| 105 | + TP_ARGS(fs_info, num_bytes, empty_size, data), |
| 106 | + |
| 107 | + TP_FIELDS( |
| 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) |
| 112 | + ) |
| 113 | +) |
| 114 | + |
| 115 | +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) |
| 116 | + |
| 117 | +LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, |
| 118 | + |
| 119 | + btrfs_find_free_extent, |
| 120 | + |
| 121 | + TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size, |
| 122 | + u64 data), |
| 123 | + |
| 124 | + TP_ARGS(fs_info, num_bytes, empty_size, data), |
| 125 | + |
| 126 | + TP_FIELDS( |
| 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) |
| 131 | + ) |
| 132 | +) |
| 133 | + |
| 134 | +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) |
| 135 | + |
| 136 | +LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, |
| 137 | + |
| 138 | + btrfs_find_free_extent, |
| 139 | + |
| 140 | + TP_PROTO(struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size, |
| 141 | + u64 data), |
| 142 | + |
| 143 | + TP_ARGS(fs_info, num_bytes, empty_size, data), |
| 144 | + |
| 145 | + TP_FIELDS( |
| 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) |
| 150 | + ) |
| 151 | +) |
| 152 | + |
| 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)) |
| 157 | + |
| 158 | +LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, |
| 159 | + |
| 160 | + btrfs_find_free_extent, |
| 161 | + |
| 162 | + TP_PROTO(const struct btrfs_root *root, u64 num_bytes, u64 empty_size, |
| 163 | + u64 data), |
| 164 | + |
| 165 | + TP_ARGS(root, num_bytes, empty_size, data), |
| 166 | + |
| 167 | + TP_FIELDS( |
| 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) |
| 172 | + ) |
| 173 | +) |
| 174 | +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) |
| 175 | + |
| 176 | +LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, |
| 177 | + |
| 178 | + btrfs_find_free_extent, |
| 179 | + |
| 180 | + TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size, |
| 181 | + u64 data), |
| 182 | + |
| 183 | + TP_ARGS(root, num_bytes, empty_size, data), |
| 184 | + |
| 185 | + TP_FIELDS( |
| 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) |
| 190 | + ) |
| 191 | +) |
| 192 | +#endif |
| 193 | + |
| 194 | +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0)) |
| 195 | LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent, |
| 196 | |
| 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 |
| 199 | ) |
| 200 | |
| 201 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0)) |
| 202 | -LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, |
| 203 | - |
| 204 | - btrfs_find_free_extent, |
| 205 | - |
| 206 | - TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size, |
| 207 | - u64 data), |
| 208 | - |
| 209 | - TP_ARGS(fs_info, num_bytes, empty_size, data), |
| 210 | - |
| 211 | - TP_FIELDS( |
| 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) |
| 216 | - ) |
| 217 | -) |
| 218 | |
| 219 | LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent, |
| 220 | |
| 221 | @@ -1957,22 +2062,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus |
| 222 | ) |
| 223 | |
| 224 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) |
| 225 | -LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, |
| 226 | - |
| 227 | - btrfs_find_free_extent, |
| 228 | - |
| 229 | - TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size, |
| 230 | - u64 data), |
| 231 | - |
| 232 | - TP_ARGS(fs_info, num_bytes, empty_size, data), |
| 233 | - |
| 234 | - TP_FIELDS( |
| 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) |
| 239 | - ) |
| 240 | -) |
| 241 | |
| 242 | LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent, |
| 243 | |
| 244 | @@ -2011,23 +2100,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus |
| 245 | |
| 246 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) |
| 247 | |
| 248 | -LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, |
| 249 | - |
| 250 | - btrfs_find_free_extent, |
| 251 | - |
| 252 | - TP_PROTO(struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size, |
| 253 | - u64 data), |
| 254 | - |
| 255 | - TP_ARGS(fs_info, num_bytes, empty_size, data), |
| 256 | - |
| 257 | - TP_FIELDS( |
| 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) |
| 262 | - ) |
| 263 | -) |
| 264 | - |
| 265 | LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent, |
| 266 | |
| 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)) |
| 271 | |
| 272 | -LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, |
| 273 | - |
| 274 | - btrfs_find_free_extent, |
| 275 | - |
| 276 | - TP_PROTO(const struct btrfs_root *root, u64 num_bytes, u64 empty_size, |
| 277 | - u64 data), |
| 278 | - |
| 279 | - TP_ARGS(root, num_bytes, empty_size, data), |
| 280 | - |
| 281 | - TP_FIELDS( |
| 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) |
| 286 | - ) |
| 287 | -) |
| 288 | - |
| 289 | LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent, |
| 290 | |
| 291 | TP_PROTO(const struct btrfs_root *root, |
| 292 | @@ -2120,23 +2175,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus |
| 293 | |
| 294 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) |
| 295 | |
| 296 | -LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, |
| 297 | - |
| 298 | - btrfs_find_free_extent, |
| 299 | - |
| 300 | - TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size, |
| 301 | - u64 data), |
| 302 | - |
| 303 | - TP_ARGS(root, num_bytes, empty_size, data), |
| 304 | - |
| 305 | - TP_FIELDS( |
| 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) |
| 310 | - ) |
| 311 | -) |
| 312 | - |
| 313 | LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent, |
| 314 | |
| 315 | TP_PROTO(struct btrfs_root *root, |
| 316 | -- |
| 317 | 2.17.1 |
| 318 | |