]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: avoid linker error in btrfs_find_create_tree_block()
authorMark Harmstone <maharmstone@fb.com>
Thu, 6 Mar 2025 10:58:46 +0000 (10:58 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Jun 2025 12:40:04 +0000 (14:40 +0200)
commit2abb4bb79559639fdffac76a35ad8a50fd652690
tree0f7a63205c09bd376cec5fabdc2a3f886ecc99a1
parentdf4af023f6a209106e1ee72d7f3d21f15e8edc8a
btrfs: avoid linker error in btrfs_find_create_tree_block()

[ Upstream commit 7ef3cbf17d2734ca66c4ed8573be45f4e461e7ee ]

The inline function btrfs_is_testing() is hardcoded to return 0 if
CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set. Currently we're relying on
the compiler optimizing out the call to alloc_test_extent_buffer() in
btrfs_find_create_tree_block(), as it's not been defined (it's behind an
 #ifdef).

Add a stub version of alloc_test_extent_buffer() to avoid linker errors
on non-standard optimization levels. This problem was seen on GCC 14
with -O0 and is helps to see symbols that would be otherwise optimized
out.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Mark Harmstone <maharmstone@fb.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/extent_io.c