Whamcloud - gitweb
LU-12610 obd: delete OBD_ -> CFS_ redefinitions 40/35640/7
authorTimothy Day <timday@amazon.com>
Mon, 23 Oct 2023 15:50:23 +0000 (11:50 -0400)
committerOleg Drokin <green@whamcloud.com>
Fri, 3 Nov 2023 04:04:38 +0000 (04:04 +0000)
With all consumers of the OBD macros fixed, finally
remove OBD macros that are simply redefinitions of CFS
macros.

Remove:
OBD_FAIL_PRECHECK(id)
OBD_FAIL_CHECK(id)
OBD_FAIL_CHECK_VALUE(id, value)
OBD_FAIL_CHECK_ORSET(id, value)
OBD_FAIL_CHECK_RESET(id, value)
OBD_FAIL_RETURN(id, ret)
OBD_FAIL_TIMEOUT(id, secs)
OBD_FAIL_TIMEOUT_MS(id, ms)
OBD_FAIL_TIMEOUT_ORSET(id, value, secs)
OBD_RACE(id)
OBD_FAIL_ONCE
OBD_FAILED

Avoid losing the unlikely optimization with OBD_FAIL_PRECHECK by
adding unlikely to CFS_FAIL_PRECHECK. For libcfs_private.h not
all callers of CFS_FAIL_PRECHECK had unlikely so this is fixed
as well.

Test-Parameters: trivial
Signed-off-by: Timothy Day <timday@amazon.com>
Signed-off-by: Ben Evans <beevans@whamcloud.com>
Change-Id: I6620bae389a9e29da2c0258b07f0ca2a7f67c14a
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/35640
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/include/libcfs/libcfs_fail.h
lustre/include/obd_support.h

index 71b5900..d185770 100644 (file)
@@ -79,9 +79,9 @@ enum {
 
 static inline bool CFS_FAIL_PRECHECK(__u32 id)
 {
-       return cfs_fail_loc != 0 &&
+       return unlikely(cfs_fail_loc != 0 &&
              ((cfs_fail_loc & CFS_FAIL_MASK_LOC) == (id & CFS_FAIL_MASK_LOC) ||
-              (cfs_fail_loc & id & CFS_FAULT));
+              (cfs_fail_loc & id & CFS_FAULT)));
 }
 
 #define UNLIKELY_CHECK_SET(id, value, set, quiet) \
@@ -92,8 +92,8 @@ static inline int cfs_fail_check_set(__u32 id, __u32 value, int set, int quiet)
        unsigned long failed_once = cfs_fail_loc & CFS_FAILED; /* ok if racy */
        int ret = 0;
 
-       if (unlikely(CFS_FAIL_PRECHECK(id) &&
-                    (ret = __cfs_fail_check_set(id, value, set)))) {
+       if (CFS_FAIL_PRECHECK(id) &&
+           (ret = __cfs_fail_check_set(id, value, set))) {
                if (quiet && failed_once) {
                        CDEBUG(D_INFO, "*** cfs_fail_loc=%x, val=%u***\n",
                               id, value);
@@ -146,7 +146,7 @@ static inline int cfs_fail_check_set(__u32 id, __u32 value, int set, int quiet)
 
 static inline int cfs_fail_timeout_set(__u32 id, __u32 value, int ms, int set)
 {
-       if (unlikely(CFS_FAIL_PRECHECK(id)))
+       if (CFS_FAIL_PRECHECK(id))
                return __cfs_fail_timeout_set(id, value, ms, set);
        else
                return 0;
index ebb4809..d91eea8 100644 (file)
@@ -764,22 +764,6 @@ extern char obd_jobid_var[];
 
 /* PLEASE, KEEP NUMBERS UP TO 0x3000 RESERVED FOR OBD_FAIL_MDS_* */
 
-/* LNet is allocated failure locations 0xe000 to 0xffff */
-/* Assign references to moved code to reduce code changes */
-#define OBD_FAIL_PRECHECK(id)                   (unlikely(CFS_FAIL_PRECHECK(id)))
-#define OBD_FAIL_CHECK(id)                      CFS_FAIL_CHECK(id)
-#define OBD_FAIL_CHECK_QUIET(id)                CFS_FAIL_CHECK_QUIET(id)
-#define OBD_FAIL_CHECK_VALUE(id, value)         CFS_FAIL_CHECK_VALUE(id, value)
-#define OBD_FAIL_CHECK_ORSET(id, value)         CFS_FAIL_CHECK_ORSET(id, value)
-#define OBD_FAIL_CHECK_RESET(id, value)         CFS_FAIL_CHECK_RESET(id, value)
-#define OBD_FAIL_RETURN(id, ret)                CFS_FAIL_RETURN(id, ret)
-#define OBD_FAIL_TIMEOUT(id, secs)              CFS_FAIL_TIMEOUT(id, secs)
-#define OBD_FAIL_TIMEOUT_MS(id, ms)             CFS_FAIL_TIMEOUT_MS(id, ms)
-#define OBD_FAIL_TIMEOUT_ORSET(id, value, secs) CFS_FAIL_TIMEOUT_ORSET(id, value, secs)
-#define OBD_RACE(id)                            CFS_RACE(id)
-#define OBD_FAIL_ONCE                           CFS_FAIL_ONCE
-#define OBD_FAILED                              CFS_FAILED
-
 #define LUT_FAIL_CLASS(fail_id)                        (((fail_id) >> 8) << 16)
 #define LUT_FAIL_MGT                           LUT_FAIL_CLASS(OBD_FAIL_MGS)
 #define LUT_FAIL_MDT                           LUT_FAIL_CLASS(OBD_FAIL_MDS)