diff options
author | Venky Shankar <vshankar@redhat.com> | 2015-05-21 19:55:02 +0530 |
---|---|---|
committer | Venky Shankar <vshankar@redhat.com> | 2015-05-30 21:14:10 -0700 |
commit | 85173e43faba9bbedd287a4103c129e289829e1f (patch) | |
tree | d1e5b7bc971eb97e88b53ad75ea56b628da12a09 /xlators/features/bit-rot/src/bitd/bit-rot.h | |
parent | 5f6876918e9c353bf0ebcd35707fb5cd8876c956 (diff) |
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: 1224647
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Reviewed-on: http://review.gluster.org/10902
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/features/bit-rot/src/bitd/bit-rot.h')
-rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot.h | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.h b/xlators/features/bit-rot/src/bitd/bit-rot.h index 6543be763d6..ec943e9131f 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot.h +++ b/xlators/features/bit-rot/src/bitd/bit-rot.h @@ -46,6 +46,14 @@ typedef enum scrub_throttle { BR_SCRUB_THROTTLE_STALLED = 3, } scrub_throttle_t; +typedef enum scrub_freq { + BR_FSSCRUB_FREQ_HOURLY = 1, + BR_FSSCRUB_FREQ_DAILY, + BR_FSSCRUB_FREQ_WEEKLY, + BR_FSSCRUB_FREQ_BIWEEKLY, + BR_FSSCRUB_FREQ_MONTHLY, +} scrub_freq_t; + #define signature_size(hl) (sizeof (br_isignature_t) + hl + 1) struct br_scanfs { @@ -57,6 +65,15 @@ struct br_scanfs { unsigned int entries; struct list_head queued; struct list_head ready; + + /* scheduler */ + uint32_t boot; + gf_boolean_t kick; + + pthread_mutex_t wakelock; + pthread_cond_t wakecond; + + struct gf_tw_timer_list *timer; }; struct br_child { @@ -98,13 +115,21 @@ struct br_scrubber { scrub_throttle_t throttle; + /** + * frequency of scanning for this subvolume. this should + * normally be per-child, but since all childs follow the + * same frequency for a volume, this option ends up here + * instead of br_child_t. + */ + scrub_freq_t frequency; + pthread_mutex_t mutex; pthread_cond_t cond; unsigned int nr_scrubbers; struct list_head scrubbers; - /* + /** * list of "rotatable" subvolume(s) undergoing scrubbing */ struct list_head scrublist; @@ -139,11 +164,6 @@ struct br_private { gf_boolean_t iamscrubber; /* function as a fs scrubber */ struct br_scrubber fsscrub; /* scrubbers for this subvolume */ - - char *scrub_freq; /* Scrubber frequency*/ - - struct timeval tv_before_scrub; /* time before starting scrubbing*/ - struct timeval tv_after_scrub; /* time after scrubbing completion*/ }; typedef struct br_private br_private_t; |