diff options
author | Venky Shankar <vshankar@redhat.com> | 2015-06-09 10:02:11 +0530 |
---|---|---|
committer | Raghavendra Bhat <raghavendra@redhat.com> | 2015-07-09 03:29:01 -0700 |
commit | a90b7c5d640bc7bf1bd648c69127fd1953e27421 (patch) | |
tree | 462c6fa36a9bed62d513f127520a2667df2905d4 /xlators/features/bit-rot/src/bitd/bit-rot.h | |
parent | 2874ee4d65185a607f1f646fc88ba8eb400aaa9a (diff) |
features/bitrot: handle scrub states via state machine
Backport of http://review.gluster.org/11149
A bunch of command line options for scrubber tempted the use of
state machine to track current state of scrubber under various
circumstances where the options could be in effect.
Change-Id: Id614bb2e6af30a90d2391ea31ae0a3edeb4e0d69
BUG: 1226666
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Reviewed-on: http://review.gluster.org/11541
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/features/bit-rot/src/bitd/bit-rot.h')
-rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.h b/xlators/features/bit-rot/src/bitd/bit-rot.h index 9a55773cc87..6cafd8be9f3 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot.h +++ b/xlators/features/bit-rot/src/bitd/bit-rot.h @@ -7,6 +7,7 @@ later), or the GNU General Public License, version 2 (GPLv2), in all cases as published by the Free Software Foundation. */ + #ifndef __BIT_ROT_H__ #define __BIT_ROT_H__ @@ -26,6 +27,7 @@ #include "timer-wheel.h" #include "bit-rot-tbf.h" +#include "bit-rot-ssm.h" #include "bit-rot-common.h" #include "bit-rot-stub-mem-types.h" @@ -52,6 +54,7 @@ typedef enum scrub_freq { BR_FSSCRUB_FREQ_WEEKLY, BR_FSSCRUB_FREQ_BIWEEKLY, BR_FSSCRUB_FREQ_MONTHLY, + BR_FSSCRUB_FREQ_STALLED, } scrub_freq_t; #define signature_size(hl) (sizeof (br_isignature_t) + hl + 1) @@ -69,6 +72,9 @@ struct br_scanfs { /* scheduler */ uint32_t boot; gf_boolean_t kick; + gf_boolean_t over; + + br_scrub_state_t state; /* current scrub state */ pthread_mutex_t wakelock; pthread_cond_t wakecond; @@ -203,6 +209,7 @@ struct br_object { }; typedef struct br_object br_object_t; +typedef int32_t (br_scrub_ssm_call) (xlator_t *, br_child_t *); void br_log_object (xlator_t *, char *, uuid_t, int32_t); @@ -244,4 +251,19 @@ _br_child_witnessed_connection (br_child_t *child) return (child->witnessed == 1); } +/* scrub state */ +static inline void +_br_child_set_scrub_state (br_child_t *child, br_scrub_state_t state) +{ + struct br_scanfs *fsscan = &child->fsscan; + fsscan->state = state; +} + +static inline br_scrub_event_t +_br_child_get_scrub_event (struct br_scrubber *fsscrub) +{ + return (fsscrub->frequency == BR_FSSCRUB_FREQ_STALLED) + ? BR_SCRUB_EVENT_PAUSE : BR_SCRUB_EVENT_SCHEDULE; +} + #endif /* __BIT_ROT_H__ */ |