Blob Blame History Raw
From 8ffb04d40cd838f0a498a4f0c1451a64fc64f65d Mon Sep 17 00:00:00 2001
From: Venky Shankar <vshankar@redhat.com>
Date: Thu, 11 Jun 2015 20:19:39 +0530
Subject: [PATCH 153/190] features/bitrot: log scrub frequency & throttle values

    Backport of http://review.gluster.org/11190

Change-Id: I56d5236c37a413046b5766320184047a908f2c8d
BUG: 1225747
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/51698
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Tested-by: Raghavendra Bhat <raghavendra@redhat.com>
---
 xlators/features/bit-rot/src/bitd/bit-rot-scrub.c |   28 +++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
index 26ad97a..2da4530 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
@@ -1141,6 +1141,32 @@ br_scrubber_handle_freq (xlator_t *this, br_private_t *priv, dict_t *options)
         return -1;
 }
 
+static void br_scrubber_log_option (xlator_t *this,
+                                    br_private_t *priv, gf_boolean_t scrubstall)
+{
+        struct br_scrubber *fsscrub = &priv->fsscrub;
+        char *scrub_throttle_str[] = {
+                [BR_SCRUB_THROTTLE_LAZY]       = "lazy",
+                [BR_SCRUB_THROTTLE_NORMAL]     = "normal",
+                [BR_SCRUB_THROTTLE_AGGRESSIVE] = "aggressive",
+        };
+
+        char *scrub_freq_str[] = {
+                [BR_FSSCRUB_FREQ_HOURLY]   = "hourly",
+                [BR_FSSCRUB_FREQ_DAILY]    = "daily",
+                [BR_FSSCRUB_FREQ_WEEKLY]   = "weekly",
+                [BR_FSSCRUB_FREQ_BIWEEKLY] = "biweekly",
+                [BR_FSSCRUB_FREQ_MONTHLY]  = "monthly (30 days)",
+        };
+
+        if (scrubstall)
+                return; /* logged as pause */
+
+        gf_log (this->name, GF_LOG_INFO, "SCRUB TUNABLES:: [Frequency: %s, "
+                "Throttle: %s]", scrub_freq_str[fsscrub->frequency],
+                scrub_throttle_str[fsscrub->throttle]);
+}
+
 int32_t
 br_scrubber_handle_options (xlator_t *this, br_private_t *priv, dict_t *options)
 {
@@ -1159,6 +1185,8 @@ br_scrubber_handle_options (xlator_t *this, br_private_t *priv, dict_t *options)
         if (ret)
                 goto error_return;
 
+        br_scrubber_log_option (this, priv, scrubstall);
+
         return 0;
 
  error_return:
-- 
1.7.1