diff options
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot-scrub.c | 24 | ||||
-rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot.h | 3 |
2 files changed, 22 insertions, 5 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 25bf884fd93..a311e2e6da8 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c @@ -832,6 +832,9 @@ br_fsscan_reschedule (xlator_t *this, br_child_t *child) fsscan = &child->fsscan; fsscrub = &priv->fsscrub; + if (!fsscrub->frequency_reconf) + return 0; + (void) gettimeofday (&now, NULL); timo = br_fsscan_calculate_timeout (fsscrub->frequency); if (timo == 0) { @@ -1187,6 +1190,7 @@ br_scrubber_handle_throttle (xlator_t *this, br_private_t *priv, scrub_throttle_t nthrottle = BR_SCRUB_THROTTLE_VOID; fsscrub = &priv->fsscrub; + fsscrub->throttle_reconf = _gf_false; ret = br_scrubber_fetch_option (this, "scrub-throttle", options, &tmp); if (ret) @@ -1211,6 +1215,9 @@ br_scrubber_handle_throttle (xlator_t *this, br_private_t *priv, if (ret) goto error_return; + if (fsscrub->throttle != nthrottle) + fsscrub->throttle_reconf = _gf_true; + fsscrub->throttle = nthrottle; return 0; @@ -1248,6 +1255,7 @@ br_scrubber_handle_freq (xlator_t *this, br_private_t *priv, struct br_scrubber *fsscrub = NULL; fsscrub = &priv->fsscrub; + fsscrub->frequency_reconf = _gf_true; ret = br_scrubber_fetch_option (this, "scrub-freq", options, &tmp); if (ret) @@ -1271,7 +1279,11 @@ br_scrubber_handle_freq (xlator_t *this, br_private_t *priv, } else goto error_return; - fsscrub->frequency = frequency; + if (fsscrub->frequency == frequency) + fsscrub->frequency_reconf = _gf_false; + else + fsscrub->frequency = frequency; + return 0; error_return: @@ -1299,10 +1311,12 @@ static void br_scrubber_log_option (xlator_t *this, if (scrubstall) return; /* logged as pause */ - gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_TUNABLE, "SCRUB " - "TUNABLES:: [Frequency: %s, Throttle: %s]", - scrub_freq_str[fsscrub->frequency], - scrub_throttle_str[fsscrub->throttle]); + if (fsscrub->frequency_reconf || fsscrub->throttle_reconf) { + gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_TUNABLE, + "SCRUB TUNABLES:: [Frequency: %s, Throttle: %s]", + scrub_freq_str[fsscrub->frequency], + scrub_throttle_str[fsscrub->throttle]); + } } int32_t diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.h b/xlators/features/bit-rot/src/bitd/bit-rot.h index 6cafd8be9f3..ebf847665f6 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot.h +++ b/xlators/features/bit-rot/src/bitd/bit-rot.h @@ -142,6 +142,9 @@ struct br_scrubber { */ scrub_freq_t frequency; + gf_boolean_t frequency_reconf; + gf_boolean_t throttle_reconf; + pthread_mutex_t mutex; pthread_cond_t cond; |