bcachefs: Use unlikely() in err_on() macros
authorKent Overstreet <kent.overstreet@gmail.com>
Sat, 19 Feb 2022 08:56:44 +0000 (03:56 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:25 +0000 (17:09 -0400)
Should be obviously a good thing.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/error.h

index 986938298adc4d4e8e5e35c2a7555e2f338741c6..4ab3cfe1292c744ec77a11d48793336300197f46 100644 (file)
@@ -39,7 +39,7 @@ void bch2_topology_error(struct bch_fs *);
 
 #define bch2_fs_inconsistent_on(cond, c, ...)                          \
 ({                                                                     \
-       int _ret = !!(cond);                                            \
+       bool _ret = unlikely(!!(cond));                                 \
                                                                        \
        if (_ret)                                                       \
                bch2_fs_inconsistent(c, __VA_ARGS__);                   \
@@ -59,7 +59,7 @@ do {                                                                  \
 
 #define bch2_dev_inconsistent_on(cond, ca, ...)                                \
 ({                                                                     \
-       int _ret = !!(cond);                                            \
+       bool _ret = unlikely(!!(cond));                                 \
                                                                        \
        if (_ret)                                                       \
                bch2_dev_inconsistent(ca, __VA_ARGS__);                 \
@@ -129,7 +129,7 @@ void bch2_flush_fsck_errs(struct bch_fs *);
 /* XXX: mark in superblock that filesystem contains errors, if we ignore: */
 
 #define __fsck_err_on(cond, c, _flags, ...)                            \
-       ((cond) ? __fsck_err(c, _flags, ##__VA_ARGS__) : false)
+       (unlikely(cond) ? __fsck_err(c, _flags, ##__VA_ARGS__) : false)
 
 #define need_fsck_err_on(cond, c, ...)                                 \
        __fsck_err_on(cond, c, FSCK_CAN_IGNORE|FSCK_NEED_FSCK, ##__VA_ARGS__)
@@ -164,7 +164,7 @@ do {                                                                        \
 
 #define bch2_fs_fatal_err_on(cond, c, ...)                             \
 ({                                                                     \
-       int _ret = !!(cond);                                            \
+       bool _ret = unlikely(!!(cond));                                 \
                                                                        \
        if (_ret)                                                       \
                bch2_fs_fatal_error(c, __VA_ARGS__);                    \