Linux-BTRFS Archive on
 help / color / Atom feed
From: Arnd Bergmann <>
To: Chris Mason <>, Josef Bacik <>,
	David Sterba <>
Cc: Arnd Bergmann <>,
	Changbin Du <>,
	Anand Jain <>,
	Nikolay Borisov <>,
	Misono Tomohiro <>,
	Qu Wenruo <>, Gu Jinxiang <>,,
Subject: [PATCH] btrfs: avoid link error with CONFIG_NO_AUTO_INLINE
Date: Sat,  3 Nov 2018 16:39:28 +0100
Message-ID: <> (raw)

On 32-bit ARM with gcc-8, I see a link error with the addition of the

fs/btrfs/super.o: In function `btrfs_statfs':
super.c:(.text+0x67b8): undefined reference to `__aeabi_uldivmod'
super.c:(.text+0x67fc): undefined reference to `__aeabi_uldivmod'
super.c:(.text+0x6858): undefined reference to `__aeabi_uldivmod'
super.c:(.text+0x6920): undefined reference to `__aeabi_uldivmod'
super.c:(.text+0x693c): undefined reference to `__aeabi_uldivmod'
fs/btrfs/super.o:super.c:(.text+0x6958): more undefined references to `__aeabi_uldivmod' follow

So far this is the only file that shows the behavior, so I'd propose
to just work around it by marking the functions as 'static inline'
that normally get inlined here.

The reference to __aeabi_uldivmod comes from a div_u64() which has an
optimization for a constant division that uses a straight '/' operator
when the result should be known to the compiler. My interpretation is
that as we turn off inlining, gcc still expects the result to be constant
but fails to use that constant value.

Cc: Changbin Du <>
Fixes: 943b8435c3bd ("kernel hacking: add a config option to disable compiler auto-inlining")
Signed-off-by: Arnd Bergmann <>
 fs/btrfs/super.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index c3c1e7bee49d..b7af0b8936ad 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1922,7 +1922,7 @@ static int btrfs_remount(struct super_block *sb, int *flags,
 /* Used to sort the devices by max_avail(descending sort) */
-static int btrfs_cmp_device_free_bytes(const void *dev_info1,
+static inline int btrfs_cmp_device_free_bytes(const void *dev_info1,
 				       const void *dev_info2)
 	if (((struct btrfs_device_info *)dev_info1)->max_avail >
@@ -1951,8 +1951,8 @@ 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.
-static int btrfs_calc_avail_data_space(struct btrfs_fs_info *fs_info,
-				       u64 *free_bytes)
+static inline int btrfs_calc_avail_data_space(struct btrfs_fs_info *fs_info,
+					      u64 *free_bytes)
 	struct btrfs_device_info *devices_info;
 	struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;

             reply index

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-03 15:39 Arnd Bergmann [this message]
2018-11-03 20:41 ` Nikolay Borisov
2018-11-03 21:25   ` Arnd Bergmann
2018-11-04  0:38 ` Qu Wenruo
2018-11-04 22:32   ` Arnd Bergmann
2018-11-05 16:51     ` David Sterba
2018-11-05 21:27       ` Arnd Bergmann
2018-11-06 15:04         ` David Sterba
2018-11-05  9:20 ` Nikolay Borisov
2018-11-05 14:37 ` Changbin Du

Reply instructions:

You may reply publically 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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-BTRFS Archive on

Archives are clonable:
	git clone --mirror linux-btrfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-btrfs linux-btrfs/ \
	public-inbox-index linux-btrfs

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone