Skip to content

Commit 7e17916

Browse files
arndbkdave
authored andcommitted
btrfs: avoid link error with CONFIG_NO_AUTO_INLINE
Note: this patch fixes a problem in a feature outside of btrfs ("kernel hacking: add a config option to disable compiler auto-inlining") and is applied ahead of time due to cross-subsystem dependencies. On 32-bit ARM with gcc-8, I see a link error with the addition of the CONFIG_NO_AUTO_INLINE option: 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. Link: https://lkml.kernel.org/r/20181103153941.1881966-1-arnd@arndb.de Reviewed-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Changbin Du <changbin.du@gmail.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de> [ add the note ] Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 761333f commit 7e17916

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/btrfs/super.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,7 +1916,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
19161916
}
19171917

19181918
/* Used to sort the devices by max_avail(descending sort) */
1919-
static int btrfs_cmp_device_free_bytes(const void *dev_info1,
1919+
static inline int btrfs_cmp_device_free_bytes(const void *dev_info1,
19201920
const void *dev_info2)
19211921
{
19221922
if (((struct btrfs_device_info *)dev_info1)->max_avail >
@@ -1945,8 +1945,8 @@ static inline void btrfs_descending_sort_devices(
19451945
* The helper to calc the free space on the devices that can be used to store
19461946
* file data.
19471947
*/
1948-
static int btrfs_calc_avail_data_space(struct btrfs_fs_info *fs_info,
1949-
u64 *free_bytes)
1948+
static inline int btrfs_calc_avail_data_space(struct btrfs_fs_info *fs_info,
1949+
u64 *free_bytes)
19501950
{
19511951
struct btrfs_device_info *devices_info;
19521952
struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;

0 commit comments

Comments
 (0)