Whamcloud - gitweb
LU-14935 tests: Use FAIL_CHECK_QUIET for fake i/o 51/44651/4
authorPatrick Farrell <pfarrell@whamcloud.com>
Thu, 12 Aug 2021 20:28:29 +0000 (16:28 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 31 Jan 2022 01:32:04 +0000 (01:32 +0000)
Logging to the console is relatively expensive and doing it
for fake i/o is very expensive in terms of CPU time.

If we use FAIL_CHECK_QUIET, a debug message is logged only once
to the console, and the rest at D_INFO level (probably not at all).

This should hugely reduce the CPU cost of the debugging.

Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: I46a5042efd116a4f5c80eaf0d5dae7fe132f6a79
Reviewed-on: https://review.whamcloud.com/44651
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Etienne AUJAMES <eaujames@ddn.com>
libcfs/include/libcfs/libcfs_fail.h
lustre/include/obd_support.h
lustre/ofd/ofd_io.c
lustre/osd-ldiskfs/osd_io.c

index 511db02..9e57506 100644 (file)
@@ -81,14 +81,14 @@ static inline bool CFS_FAIL_PRECHECK(__u32 id)
               (cfs_fail_loc & id & CFS_FAULT));
 }
 
-static inline int cfs_fail_check_set(__u32 id, __u32 value,
-                                    int set, int quiet)
+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 (quiet) {
+               if (quiet && failed_once) {
                        CDEBUG(D_INFO, "*** cfs_fail_loc=%x, val=%u***\n",
                               id, value);
                } else {
index 4322ae2..4385468 100644 (file)
@@ -737,6 +737,7 @@ extern char obd_jobid_var[];
 /* 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)
index 3b96d63..0bae6eb 100644 (file)
@@ -1276,7 +1276,7 @@ ofd_commitrw_write(const struct lu_env *env, struct obd_export *exp,
        la->la_valid &= LA_ATIME | LA_MTIME | LA_CTIME;
 
        /* do fake write, to simulate the write case for performance testing */
-       if (OBD_FAIL_CHECK(OBD_FAIL_OST_FAKE_RW)) {
+       if (OBD_FAIL_CHECK_QUIET(OBD_FAIL_OST_FAKE_RW)) {
                struct niobuf_local *last = &lnb[niocount - 1];
                __u64 file_size = last->lnb_file_offset + last->lnb_len;
                __u64 valid = la->la_valid;
index 95215d6..74b1d3f 100644 (file)
@@ -1698,7 +1698,7 @@ static int osd_read_prep(const struct lu_env *env, struct dt_object *dt,
                lnb[i].lnb_rc = lnb[i].lnb_len;
 
                /* Bypass disk read if fail_loc is set properly */
-               if (OBD_FAIL_CHECK(OBD_FAIL_OST_FAKE_RW))
+               if (OBD_FAIL_CHECK_QUIET(OBD_FAIL_OST_FAKE_RW))
                        SetPageUptodate(lnb[i].lnb_page);
 
                if (PageUptodate(lnb[i].lnb_page)) {