diff options
Diffstat (limited to 'meta/recipes-kernel/lttng/lttng-modules/0004-Fix-btrfs_chunk-tracepoints-changed-in-linux-6.8.0-r.patch')
| -rw-r--r-- | meta/recipes-kernel/lttng/lttng-modules/0004-Fix-btrfs_chunk-tracepoints-changed-in-linux-6.8.0-r.patch | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0004-Fix-btrfs_chunk-tracepoints-changed-in-linux-6.8.0-r.patch b/meta/recipes-kernel/lttng/lttng-modules/0004-Fix-btrfs_chunk-tracepoints-changed-in-linux-6.8.0-r.patch new file mode 100644 index 0000000000..c9b1af37c8 --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-modules/0004-Fix-btrfs_chunk-tracepoints-changed-in-linux-6.8.0-r.patch | |||
| @@ -0,0 +1,124 @@ | |||
| 1 | From c8198382fe1cede3e16aae9978642a113a217e4c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Kienan Stewart <kstewart@efficios.com> | ||
| 3 | Date: Mon, 22 Jan 2024 12:17:33 -0500 | ||
| 4 | Subject: [PATCH 4/5] Fix: btrfs_chunk tracepoints changed in linux 6.8.0-rc1 | ||
| 5 | |||
| 6 | See upstream commit: | ||
| 7 | |||
| 8 | commit 7dc66abb5a47778d7db327783a0ba172b8cff0b5 | ||
| 9 | Author: Filipe Manana <fdmanana@suse.com> | ||
| 10 | Date: Tue Nov 21 13:38:38 2023 +0000 | ||
| 11 | |||
| 12 | btrfs: use a dedicated data structure for chunk maps | ||
| 13 | |||
| 14 | Currently we abuse the extent_map structure for two purposes: | ||
| 15 | |||
| 16 | 1) To actually represent extents for inodes; | ||
| 17 | 2) To represent chunk mappings. | ||
| 18 | |||
| 19 | This is odd and has several disadvantages: | ||
| 20 | |||
| 21 | 1) To create a chunk map, we need to do two memory allocations: one for | ||
| 22 | an extent_map structure and another one for a map_lookup structure, so | ||
| 23 | more potential for an allocation failure and more complicated code to | ||
| 24 | manage and link two structures; | ||
| 25 | |||
| 26 | 2) For a chunk map we actually only use 3 fields (24 bytes) of the | ||
| 27 | respective extent map structure: the 'start' field to have the logical | ||
| 28 | start address of the chunk, the 'len' field to have the chunk's size, | ||
| 29 | and the 'orig_block_len' field to contain the chunk's stripe size. | ||
| 30 | |||
| 31 | Besides wasting a memory, it's also odd and not intuitive at all to | ||
| 32 | have the stripe size in a field named 'orig_block_len'. | ||
| 33 | |||
| 34 | We are also using 'block_len' of the extent_map structure to contain | ||
| 35 | the chunk size, so we have 2 fields for the same value, 'len' and | ||
| 36 | 'block_len', which is pointless; | ||
| 37 | |||
| 38 | 3) When an extent map is associated to a chunk mapping, we set the bit | ||
| 39 | EXTENT_FLAG_FS_MAPPING on its flags and then make its member named | ||
| 40 | 'map_lookup' point to the associated map_lookup structure. This means | ||
| 41 | that for an extent map associated to an inode extent, we are not using | ||
| 42 | this 'map_lookup' pointer, so wasting 8 bytes (on a 64 bits platform); | ||
| 43 | |||
| 44 | 4) Extent maps associated to a chunk mapping are never merged or split so | ||
| 45 | it's pointless to use the existing extent map infrastructure. | ||
| 46 | |||
| 47 | So add a dedicated data structure named 'btrfs_chunk_map' to represent | ||
| 48 | chunk mappings, this is basically the existing map_lookup structure with | ||
| 49 | some extra fields: | ||
| 50 | |||
| 51 | 1) 'start' to contain the chunk logical address; | ||
| 52 | 2) 'chunk_len' to contain the chunk's length; | ||
| 53 | 3) 'stripe_size' for the stripe size; | ||
| 54 | 4) 'rb_node' for insertion into a rb tree; | ||
| 55 | 5) 'refs' for reference counting. | ||
| 56 | |||
| 57 | This way we do a single memory allocation for chunk mappings and we don't | ||
| 58 | waste memory for them with unused/unnecessary fields from an extent_map. | ||
| 59 | |||
| 60 | We also save 8 bytes from the extent_map structure by removing the | ||
| 61 | 'map_lookup' pointer, so the size of struct extent_map is reduced from | ||
| 62 | 144 bytes down to 136 bytes, and we can now have 30 extents map per 4K | ||
| 63 | page instead of 28. | ||
| 64 | |||
| 65 | Upstream-Status: Backport [Uhttps://review.lttng.org/c/lttng-modules/+/11700] | ||
| 66 | |||
| 67 | Change-Id: Ie52b5ac83df4bc6abeb84d958c4f5d24ae0d8c75 | ||
| 68 | Signed-off-by: Kienan Stewart <kstewart@efficios.com> | ||
| 69 | Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
| 70 | --- | ||
| 71 | include/instrumentation/events/btrfs.h | 37 +++++++++++++++++++++++++- | ||
| 72 | 1 file changed, 36 insertions(+), 1 deletion(-) | ||
| 73 | |||
| 74 | diff --git a/include/instrumentation/events/btrfs.h b/include/instrumentation/events/btrfs.h | ||
| 75 | index 7c7b9b0..a2a412b 100644 | ||
| 76 | --- a/include/instrumentation/events/btrfs.h | ||
| 77 | +++ b/include/instrumentation/events/btrfs.h | ||
| 78 | @@ -1609,7 +1609,42 @@ LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head, | ||
| 79 | ) | ||
| 80 | #endif | ||
| 81 | |||
| 82 | -#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) | ||
| 83 | +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,8,0)) | ||
| 84 | + | ||
| 85 | +LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__chunk, | ||
| 86 | + | ||
| 87 | + TP_PROTO(const struct btrfs_fs_info *fs_info, const struct btrfs_chunk_map *map, | ||
| 88 | + u64 offset, u64 size), | ||
| 89 | + | ||
| 90 | + TP_ARGS(fs_info, map, offset, size), | ||
| 91 | + | ||
| 92 | + TP_FIELDS( | ||
| 93 | + ctf_integer(int, num_stripes, map->num_stripes) | ||
| 94 | + ctf_integer(u64, type, map->type) | ||
| 95 | + ctf_integer(int, sub_stripes, map->sub_stripes) | ||
| 96 | + ctf_integer(u64, offset, offset) | ||
| 97 | + ctf_integer(u64, size, size) | ||
| 98 | + ctf_integer(u64, root_objectid, fs_info->chunk_root->root_key.objectid) | ||
| 99 | + ) | ||
| 100 | +) | ||
| 101 | + | ||
| 102 | +LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__chunk, btrfs_chunk_alloc, | ||
| 103 | + | ||
| 104 | + TP_PROTO(const struct btrfs_fs_info *fs_info, const struct btrfs_chunk_map *map, | ||
| 105 | + u64 offset, u64 size), | ||
| 106 | + | ||
| 107 | + TP_ARGS(fs_info, map, offset, size) | ||
| 108 | +) | ||
| 109 | + | ||
| 110 | +LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__chunk, btrfs_chunk_free, | ||
| 111 | + | ||
| 112 | + TP_PROTO(const struct btrfs_fs_info *fs_info, const struct btrfs_chunk_map *map, | ||
| 113 | + u64 offset, u64 size), | ||
| 114 | + | ||
| 115 | + TP_ARGS(fs_info, map, offset, size) | ||
| 116 | +) | ||
| 117 | + | ||
| 118 | +#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) | ||
| 119 | |||
| 120 | LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__chunk, | ||
| 121 | |||
| 122 | -- | ||
| 123 | 2.39.2 | ||
| 124 | |||
