From 6fc12a43f3e20ea24969e5a3c949f7c27d9c1893 Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Thu, 21 May 2015 19:55:02 +0530 Subject: features/bitrot: reimplement scrubbing frequency This patch reimplments existing scrub-frequency mechanism used to schedule scrubber runs. Existing mechanism uses periodic sleeps (waking up periodically on minimum granularity) and performing a number of tracking checks based on counters and sleep times. This patch does away with all the nifty counters and uses timer-wheel to schedule scrub runs. Scheduling changes are peformed by merely calculating the new expiry time and calling mod_timer() [mod_timer_pending() in some cases] making the code more debuggable and easier to follow. This also introduces "hourly" scrubbing tunable as an aid for testing scrubbing during development/testing cycle. One could also implement on-demand scrubbing with ease: by invoking mod_timer() with an expiry of one (1) second, thereby scheduling a scrub run the very next second. Change-Id: I6c7c5f0c6c9f886bf574d88c04cde14b76e60a8b BUG: 1224596 Signed-off-by: Venky Shankar Reviewed-on: http://review.gluster.org/10893 Reviewed-by: Gaurav Kumar Garg Tested-by: NetBSD Build System Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-scrub-svc.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-scrub-svc.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-scrub-svc.c b/xlators/mgmt/glusterd/src/glusterd-scrub-svc.c index 987acb60955..8d1133f9f55 100644 --- a/xlators/mgmt/glusterd/src/glusterd-scrub-svc.c +++ b/xlators/mgmt/glusterd/src/glusterd-scrub-svc.c @@ -88,7 +88,23 @@ out: int glusterd_scrubsvc_start (glusterd_svc_t *svc, int flags) { - return glusterd_svc_start (svc, flags, NULL); + int ret = -1; + dict_t *cmdict = NULL; + + cmdict = dict_new (); + if (!cmdict) + goto error_return; + + ret = dict_set_str (cmdict, "cmdarg0", "--global-timer-wheel"); + if (ret) + goto dealloc_dict; + + ret = glusterd_svc_start (svc, flags, cmdict); + + dealloc_dict: + dict_unref (cmdict); + error_return: + return ret; } int -- cgit