From 09678a68a323b3873c8f8fe24d42e14294e0034c Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Thu, 30 Jun 2016 14:49:51 +0530 Subject: features/bitrot: Option to set scrub interval to a minute Backport of http://review.gluster.org/14836/ Bitrot scrub-frequency supports "hourly|daily|weekly|biweekly|monthly". But it is painful for testing as minimum scrub-interval is an hour Hence introducing a scrub interval of minute to ease testing. It is intentionally not exposed in bitrot command help as it is only for testing. e.g., gluster vol bitrot scrub-frequency minute Change-Id: I155a65298d3fad5ae9e529d9c7d4b0d25fa297c0 BUG: 1354429 Signed-off-by: Kotresh HR Reviewed-on: http://review.gluster.org/14836 (cherry picked from commit 7df1174f7bed2a00631cf17201f5217a053afeb1) Reviewed-on: http://review.gluster.org/14890 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Jeff Darcy --- xlators/features/bit-rot/src/bitd/bit-rot-scrub.c | 7 +++++++ xlators/features/bit-rot/src/bitd/bit-rot.h | 1 + 2 files changed, 8 insertions(+) (limited to 'xlators/features/bit-rot/src/bitd') 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 8c88d62eceb..8b95f056a16 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c @@ -836,6 +836,7 @@ br_fsscan_calculate_delta (uint32_t times) return times; } +#define BR_SCRUB_MINUTE (60) #define BR_SCRUB_HOURLY (60 * 60) #define BR_SCRUB_DAILY (1 * 24 * 60 * 60) #define BR_SCRUB_WEEKLY (7 * 24 * 60 * 60) @@ -848,6 +849,9 @@ br_fsscan_calculate_timeout (scrub_freq_t freq) uint32_t timo = 0; switch (freq) { + case BR_FSSCRUB_FREQ_MINUTE: + timo = br_fsscan_calculate_delta (BR_SCRUB_MINUTE); + break; case BR_FSSCRUB_FREQ_HOURLY: timo = br_fsscan_calculate_delta (BR_SCRUB_HOURLY); break; @@ -1421,6 +1425,8 @@ br_scrubber_handle_freq (xlator_t *this, br_private_t *priv, frequency = BR_FSSCRUB_FREQ_BIWEEKLY; } else if (strcasecmp (tmp, "monthly") == 0) { frequency = BR_FSSCRUB_FREQ_MONTHLY; + } else if (strcasecmp (tmp, "minute") == 0) { + frequency = BR_FSSCRUB_FREQ_MINUTE; } else if (strcasecmp (tmp, BR_SCRUB_STALLED) == 0) { frequency = BR_FSSCRUB_FREQ_STALLED; } else @@ -1453,6 +1459,7 @@ static void br_scrubber_log_option (xlator_t *this, [BR_FSSCRUB_FREQ_WEEKLY] = "weekly", [BR_FSSCRUB_FREQ_BIWEEKLY] = "biweekly", [BR_FSSCRUB_FREQ_MONTHLY] = "monthly (30 days)", + [BR_FSSCRUB_FREQ_MINUTE] = "every minute", }; if (scrubstall) diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.h b/xlators/features/bit-rot/src/bitd/bit-rot.h index 4153d0e4724..8e9267048be 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot.h +++ b/xlators/features/bit-rot/src/bitd/bit-rot.h @@ -50,6 +50,7 @@ typedef enum scrub_freq { BR_FSSCRUB_FREQ_WEEKLY, BR_FSSCRUB_FREQ_BIWEEKLY, BR_FSSCRUB_FREQ_MONTHLY, + BR_FSSCRUB_FREQ_MINUTE, BR_FSSCRUB_FREQ_STALLED, } scrub_freq_t; -- cgit