Messages in this thread Patch in this message | | | From | Chunguang Xu <> | Subject | [PATCH 10/23] btrfs: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code | Date | Thu, 27 Aug 2020 18:14:15 +0800 |
| |
Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT() may be realized through them, thus reducing code redundancy and facilitating problem analysis.
Signed-off-by: Chunguang Xu <brookxu@tencent.com> --- fs/btrfs/ctree.h | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 9c7e466..9254dc6 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -3226,18 +3226,8 @@ void btrfs_no_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...) } while (0) #ifdef CONFIG_BTRFS_ASSERT -__cold __noreturn -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) \ - (likely(expr) ? (void)0 : assertfail(#expr, __FILE__, __LINE__)) - +#define ASSERT(expr) ASSERT_FAIL(expr) #else -static inline void assertfail(const char *expr, const char* file, int line) { } #define ASSERT(expr) (void)(expr) #endif -- 1.8.3.1
| |