From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C7032AE9A; Mon, 2 Jun 2025 15:05:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748876717; cv=none; b=RMI0Nov99TVwJqt2UkywKSjgVnWCQNdcXIYKcVSy9w9MR40rXqaEmolmttoZm377zad/SFzeedcwZlz1J0RNQ+R7Raoj3PZsYBl/e9wrBGHY00TTJGgroaZ6vkYaGgE2F+czGXAhYqDWqa/BBXX20URJ7R2pmZPmG2Q2zSj5qSI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748876717; c=relaxed/simple; bh=YdpDOVuJLvgzzaSITlrsbNghUXwXe64O2mXyBMyXxqY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FlTSt4uyWYOvtFe1QBKCn/wjq/wwiNSdWBs14Gdmi9c3UDHXvfmVzRorXDvivEj6Qzzjz7vKP5G3TQI0EPKgKjKVHKS9qsHi0Pmf0XYlWw7ThiX/8Z9F2U2im771Fx4FAgCQQPL2r9m8Dv6CYftMML1r/SNTuHX1Js+oC4c+xL4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=tP+XS5GQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="tP+XS5GQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF60FC4CEEB; Mon, 2 Jun 2025 15:05:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748876717; bh=YdpDOVuJLvgzzaSITlrsbNghUXwXe64O2mXyBMyXxqY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tP+XS5GQjc3MRrjMN2z11jzXGRgm/nNvAZ6O1GpmpSzPzkvsjkIqMSYEtXAwj9vYh Va0rOgJjQv9bVZkqIR6PovBQP1qFFIu6WS2q3YqFAFY58Ux2/3Ja3kPiyJHBPLyXtB 1uZE6DAlRnmLubYqX5Q+QkdH/DIVR97nOZstDjs0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Qu Wenruo , Mark Harmstone , David Sterba , Sasha Levin Subject: [PATCH 6.1 052/325] btrfs: avoid linker error in btrfs_find_create_tree_block() Date: Mon, 2 Jun 2025 15:45:28 +0200 Message-ID: <20250602134321.877025177@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250602134319.723650984@linuxfoundation.org> References: <20250602134319.723650984@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mark Harmstone [ 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 Signed-off-by: Mark Harmstone Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/extent_io.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 72227c0b4b5a1..d5552875f872a 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -4459,10 +4459,10 @@ struct extent_buffer *find_extent_buffer(struct btrfs_fs_info *fs_info, return eb; } -#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info, u64 start) { +#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS struct extent_buffer *eb, *exists = NULL; int ret; @@ -4498,8 +4498,11 @@ struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info, free_eb: btrfs_release_extent_buffer(eb); return exists; -} +#else + /* Stub to avoid linker error when compiled with optimizations turned off. */ + return NULL; #endif +} static struct extent_buffer *grab_extent_buffer( struct btrfs_fs_info *fs_info, struct page *page) -- 2.39.5