Commit e118578a authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: move assert helpers out of ctree.h

These call functions that aren't defined in, or will be moved out of,
ctree.h  Move them to super.c where the other assert/error message code
is defined. Drop the __noreturn attribute for btrfs_assertfail as
objtool does not like it and fails with warnings like

  fs/btrfs/dir-item.o: warning: objtool: .text.unlikely: unexpected end of section
  fs/btrfs/xattr.o: warning: objtool: btrfs_setxattr() falls through to next function btrfs_setxattr_trans.cold()
  fs/btrfs/xattr.o: warning: objtool: .text.unlikely: unexpected end of section
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent c7f13d42
...@@ -3333,18 +3333,11 @@ do { \ ...@@ -3333,18 +3333,11 @@ do { \
} while (0) } while (0)
#ifdef CONFIG_BTRFS_ASSERT #ifdef CONFIG_BTRFS_ASSERT
__cold __noreturn void __cold btrfs_assertfail(const char *expr, const char *file, int line);
static inline void assertfail(const char *expr, const char *file, int line)
{
pr_err("assertion failed: %s, in %s:%d\n", expr, file, line);
BUG();
}
#define ASSERT(expr) \ #define ASSERT(expr) \
(likely(expr) ? (void)0 : assertfail(#expr, __FILE__, __LINE__)) (likely(expr) ? (void)0 : btrfs_assertfail(#expr, __FILE__, __LINE__))
#else #else
static inline void assertfail(const char *expr, const char* file, int line) { }
#define ASSERT(expr) (void)(expr) #define ASSERT(expr) (void)(expr)
#endif #endif
...@@ -3404,12 +3397,7 @@ static inline unsigned long get_eb_page_index(unsigned long offset) ...@@ -3404,12 +3397,7 @@ static inline unsigned long get_eb_page_index(unsigned long offset)
#define EXPORT_FOR_TESTS #define EXPORT_FOR_TESTS
#endif #endif
__cold void __cold btrfs_print_v0_err(struct btrfs_fs_info *fs_info);
static inline void btrfs_print_v0_err(struct btrfs_fs_info *fs_info)
{
btrfs_err(fs_info,
"Unsupported V0 extent filesystem detected. Aborting. Please re-create your filesystem with a newer kernel");
}
__printf(5, 6) __printf(5, 6)
__cold __cold
......
...@@ -305,6 +305,20 @@ void __cold _btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...@@ -305,6 +305,20 @@ void __cold _btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt,
} }
#endif #endif
#ifdef CONFIG_BTRFS_ASSERT
void __cold btrfs_assertfail(const char *expr, const char *file, int line)
{
pr_err("assertion failed: %s, in %s:%d\n", expr, file, line);
BUG();
}
#endif
void __cold btrfs_print_v0_err(struct btrfs_fs_info *fs_info)
{
btrfs_err(fs_info,
"Unsupported V0 extent filesystem detected. Aborting. Please re-create your filesystem with a newer kernel");
}
#if BITS_PER_LONG == 32 #if BITS_PER_LONG == 32
void __cold btrfs_warn_32bit_limit(struct btrfs_fs_info *fs_info) void __cold btrfs_warn_32bit_limit(struct btrfs_fs_info *fs_info)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment