Whamcloud - gitweb
EX-4058 lamigo: don't generate useless noise
authorAlex Zhuravlev <bzzz@whamcloud.com>
Thu, 14 Oct 2021 11:06:05 +0000 (14:06 +0300)
committerJohn L. Hammond <jhammond@whamcloud.com>
Fri, 14 Jan 2022 21:36:13 +0000 (21:36 +0000)
stop to generate useless debugging messages with non-changing
statfs data and hot/cold periods.

Test-Parameters: trivial testlist=hot-pools
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I3e601e3395b1f49a9e6bd8ae94fc7da9987a02a3
Reviewed-on: https://review.whamcloud.com/45241
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Alexandre Ioffe <aioffe@ddn.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/46098

lipe/src/lamigo.c

index c2151e4..40f2b8a 100644 (file)
@@ -3304,9 +3304,9 @@ static void lamigo_check_hot(void)
        if (src_pools->pl_open) {
                /* get most recent hot files */
                ht = lamigo_get_hot(alr_hot_period, &nr);
-               LX_DEBUG("check hot in period %lu - %d\n",
-                        alr_hot_period, nr);
                if (ht) {
+                       LX_DEBUG("check hot in period %lu - %d\n",
+                                alr_hot_period, nr);
                        for (i = 0; i < nr; i++)
                                lamigo_check_hot_one(ht + i);
                        free(ht);
@@ -3319,11 +3319,11 @@ static void lamigo_check_hot(void)
        /* now check hot idling files - the files we found hot and
         * skipped replication. now it's time to try again */
        ht = lamigo_get_hot(alr_hot_period - opt.o_alr_hot_after_idle, &nr);
-       LX_DEBUG("check idle in period %lu - %d\n",
-                alr_hot_period - 3, nr);
        if (!ht)
                goto out;
 
+       LX_DEBUG("check idle in period %lu - %d\n",
+                alr_hot_period - 3, nr);
        for (i = 0; i < nr; i++) {
                struct alr_heat *ah = ht + i;
                LX_DEBUG("idle "DFID": P: %Lu/%Lu, live %d, idle %d\n",
@@ -3375,6 +3375,7 @@ static __u64 lamigo_read_osp_param(const int ostidx, const char *param)
 static void lamigo_refresh_pool_statfs(struct pool_list *pl, int threshold)
 {
        __u64 tavail = 0, ttotal = 0; /* sum for the pool */
+       bool old_status;
        int i;
 
        pthread_rwlock_rdlock(&pl->pl_lock);
@@ -3389,9 +3390,6 @@ static void lamigo_refresh_pool_statfs(struct pool_list *pl, int threshold)
                /* check OSP is active */
                active = lamigo_read_osp_param(ostidx, "active");
                status = lamigo_read_osp_param(ostidx, "prealloc_status");
-               LX_DEBUG("statfs for %d%s/%d: %llu from %llu\n",
-                        ostidx, active ? "(active)" : "(inactive)",
-                        (int)status, kbavail, kbtotal);
                if (!active || status)
                        continue;
                tavail += kbavail;
@@ -3400,15 +3398,17 @@ static void lamigo_refresh_pool_statfs(struct pool_list *pl, int threshold)
        pthread_rwlock_unlock(&pl->pl_lock);
        pl->pl_total = ttotal;
        pl->pl_avail = tavail;
+       old_status = pl->pl_open;
        if (ttotal == 0 || (tavail < ttotal * threshold / 100))
                pl->pl_open = false;
        else
                pl->pl_open = true;
 
        /* whether pool is good for replicas */
-       LX_DEBUG("statfs for %s %s pool: %llu from %llu, thresh %llu\n",
-                pl->pl_open ? "open" : "closed", pl->pl_pool, tavail,
-                ttotal, ttotal * threshold / 100);
+       if (old_status != pl->pl_open)
+               LX_DEBUG("statfs for %s %s pool: %llu from %llu, thresh %llu\n",
+                        pl->pl_open ? "open" : "closed", pl->pl_pool, tavail,
+                        ttotal, ttotal * threshold / 100);
 }
 
 static void lamigo_refresh_statfs(void)