From: Arnd Bergmann <arnd@kernel.org>
To: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Johannes Thumshirn <johannes.thumshirn@wdc.com>,
Qu Wenruo <wqu@suse.com>, Anand Jain <anand.jain@oracle.com>,
Nikolay Borisov <nborisov@suse.com>,
Changbin Du <changbin.du@intel.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] btrfs: fix 64-bit division link failure
Date: Wed, 5 Jul 2023 16:01:09 +0200 [thread overview]
Message-ID: <20230705140117.795478-2-arnd@kernel.org> (raw)
In-Reply-To: <20230705140117.795478-1-arnd@kernel.org>
From: Arnd Bergmann <arnd@arndb.de>
Some of the recent refactoring of the statfs code apparently
brought back a link failure on older gcc versions that I had
fixed before:
arm-linux-gnueabi-ld: fs/btrfs/super.o: in function `btrfs_statfs':
super.c:(.text+0xec40): undefined reference to `__aeabi_uldivmod'
I think what happened is that gcc is free to not inline a function
despite the 'inline' annotation, and when this happens it can end
up partially inlining the div_u64() helper in a way that breaks the
__builtin_constant_p() based optimization.
I only see this behavior for gcc-9, but it's possible that the same
thing happens in later versions as well when the code changes again.
Change this to __always_inline to prevent it from happening again,
and add a comment about this.
Fixes: 7e17916b35797 ("btrfs: avoid link error with CONFIG_NO_AUTO_INLINE")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
fs/btrfs/super.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index f1dd172d8d5bd..7c8ee0da0f0d1 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1902,9 +1902,9 @@ static inline void btrfs_descending_sort_devices(
/*
* The helper to calc the free space on the devices that can be used to store
- * file data.
+ * file data, always inline to avoid a link failure with gcc-9 and earlier.
*/
-static inline int btrfs_calc_avail_data_space(struct btrfs_fs_info *fs_info,
+static __always_inline int btrfs_calc_avail_data_space(struct btrfs_fs_info *fs_info,
u64 *free_bytes)
{
struct btrfs_device_info *devices_info;
--
2.39.2
next prev parent reply other threads:[~2023-07-05 14:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-05 14:01 [PATCH 1/2] btrfs: avoid Wmaybe-uninitialized warnings Arnd Bergmann
2023-07-05 14:01 ` Arnd Bergmann [this message]
2023-07-10 17:06 ` [PATCH 2/2] btrfs: fix 64-bit division link failure David Sterba
2023-07-10 16:55 ` [PATCH 1/2] btrfs: avoid Wmaybe-uninitialized warnings David Sterba
2023-07-10 19:12 ` Arnd Bergmann
2023-07-10 19:25 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230705140117.795478-2-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=anand.jain@oracle.com \
--cc=arnd@arndb.de \
--cc=changbin.du@intel.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=johannes.thumshirn@wdc.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nborisov@suse.com \
--cc=wqu@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox