summaryrefslogtreecommitdiffstats
path: root/xlators/features/bit-rot
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2016-06-30 14:49:51 +0530
committerJeff Darcy <jdarcy@redhat.com>2016-07-15 06:42:43 -0700
commit452d0d9c58bb59c869a97a70e97ff0bee43f4298 (patch)
tree2d42f431a6a0f1a922efd5611dc2e45c27e045d6 /xlators/features/bit-rot
parent8c6700bc7bc78ed4754bf2e59fd28a40530d4e76 (diff)
features/bitrot: Option to set scrub interval to a minute
Backport of http://review.gluster.org/#/c/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 <volname> scrub-frequency minute Change-Id: I155a65298d3fad5ae9e529d9c7d4b0d25fa297c0 BUG: 1354425 Signed-off-by: Kotresh HR <khiremat@redhat.com> (cherry picked from commit 7df1174f7bed2a00631cf17201f5217a053afeb1) Reviewed-on: http://review.gluster.org/14887 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/features/bit-rot')
-rw-r--r--xlators/features/bit-rot/src/bitd/bit-rot-scrub.c7
-rw-r--r--xlators/features/bit-rot/src/bitd/bit-rot.h1
2 files changed, 8 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 2f5729f..e76bfcb 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
@@ -840,6 +840,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)
@@ -852,6 +853,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;
@@ -1425,6 +1429,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
@@ -1457,6 +1463,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 835b9ca..6569369 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot.h
+++ b/xlators/features/bit-rot/src/bitd/bit-rot.h
@@ -55,6 +55,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;