[sheepdog] [PATCH 2/3] sheep: allow operating when nr_zones >= nr_data_strip

MORITA Kazutaka morita.kazutaka at gmail.com
Fri Oct 25 20:25:28 CEST 2013


At Wed, 23 Oct 2013 15:59:12 +0800,
Liu Yuan wrote:
> 
> For erasure coding with x:y scheme, we can still promise the data reliability
> with x nodes alive and provide services. There is no reason we don't do it in
> sheepdog.
> 
> Signed-off-by: Liu Yuan <namei.unix at gmail.com>
> ---
>  sheep/plain_store.c |   13 -------------
>  sheep/recovery.c    |   19 ++++++-------------
>  2 files changed, 6 insertions(+), 26 deletions(-)
> 
> diff --git a/sheep/plain_store.c b/sheep/plain_store.c
> index fde7c9f..02db25e 100644
> --- a/sheep/plain_store.c
> +++ b/sheep/plain_store.c
> @@ -463,19 +463,6 @@ static bool oid_stale(uint64_t oid)
>  	const struct sd_vnode *obj_vnodes[SD_MAX_COPIES];
>  	vinfo = get_vnode_info();
>  
> -	/*
> -	 * If vinfo->nr_zones < SD_EC_DP, we might not get the idx, so we don't
> -	 * know it is stale or not. In this case, we keep it stay in the working
> -	 * directory in order to recover it when we get enough zones
> -	 */
> -	if (is_erasure_oid(oid)) {
> -		uint8_t policy = get_vdi_copy_policy(oid_to_vid(oid));
> -		int edp = ec_policy_to_dp(policy, NULL, NULL);
> -
> -		if (unlikely(vinfo->nr_zones < edp))
> -			return false;
> -	}
> -
>  	nr_copies = get_obj_copy_number(oid, vinfo->nr_zones);
>  	oid_to_vnodes(oid, &vinfo->vroot, nr_copies, obj_vnodes);
>  	for (i = 0; i < nr_copies; i++) {
> diff --git a/sheep/recovery.c b/sheep/recovery.c
> index 39ca2b1..3c59756 100644
> --- a/sheep/recovery.c
> +++ b/sheep/recovery.c
> @@ -431,17 +431,15 @@ out:
>  	return lost;
>  }
>  
> -static uint8_t local_node_copy_index(struct rb_root *vroot, uint64_t oid)
> +static uint8_t local_node_copy_index(struct vnode_info *vinfo, uint64_t oid)

I think we can make vinfo a constant variable.

>  {
> -	const struct sd_node *target_nodes[SD_MAX_NODES];
> -	uint8_t policy = get_vdi_copy_policy(oid_to_vid(oid));
>  	uint8_t idx;
> -	int edp = ec_policy_to_dp(policy, NULL, NULL);
>  
> -	oid_to_nodes(oid, vroot, edp, target_nodes);
> -	for (idx = 0; idx < edp; idx++)
> -		if (node_is_local(target_nodes[idx]))
> +	for (idx = 0; idx < vinfo->nr_zones; idx++) {

I think idx should be declared here as int like as follows.

    for (int idx = 0; idx < vinfo->nr_zones; idx++) { 

Thanks,

Kazutaka



More information about the sheepdog mailing list