[sheepdog] [PATCH 3/7] recovery: mark last gathered epoch

MORITA Kazutaka morita.kazutaka at gmail.com
Tue Oct 15 19:52:15 CEST 2013


At Sun, 13 Oct 2013 19:43:08 +0800,
Liu Yuan wrote:
> 
> The last gathered epoch is the epoch at which all the nodes complete the
> recovery and purge the stale objects. So this means we don't need to go
> the epoch history below last_gathered_epoch.
> 
> This is a preparation patch.
> 
> Signed-off-by: Liu Yuan <namei.unix at gmail.com>
> ---
>  sheep/ops.c        |    3 +++
>  sheep/sheep_priv.h |    2 ++
>  2 files changed, 5 insertions(+)
> 
> diff --git a/sheep/ops.c b/sheep/ops.c
> index d46d10e..428f09e 100644
> --- a/sheep/ops.c
> +++ b/sheep/ops.c
> @@ -46,6 +46,8 @@ struct sd_op_template {
>  	int (*process_main)(const struct sd_req *req, struct sd_rsp *rsp, void *data);
>  };
>  
> +uint32_t last_gathered_epoch = 1;
> +
>  static int stat_sheep(uint64_t *store_size, uint64_t *store_free,
>  		      uint32_t epoch)
>  {
> @@ -668,6 +670,7 @@ static int cluster_recovery_completion(const struct sd_req *req,
>  		}
>  		if (i == nr_recovereds) {
>  			sd_debug("all nodes are recovered, epoch %d", epoch);
> +			last_gathered_epoch = epoch;
>  			/* sd_store can be NULL if this node is a gateway */
>  			if (sd_store && sd_store->cleanup)
>  				sd_store->cleanup();
> diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h
> index 99bf676..1568091 100644
> --- a/sheep/sheep_priv.h
> +++ b/sheep/sheep_priv.h
> @@ -391,6 +391,8 @@ int do_process_main(const struct sd_op_template *op, const struct sd_req *req,
>  int sheep_do_op_work(const struct sd_op_template *op, struct request *req);
>  int gateway_to_peer_opcode(int opcode);
>  
> +uint32_t last_gathered_epoch;
> +

"extern" should be added.

Thanks,

Kazutaka



More information about the sheepdog mailing list