[sheepdog] [PATCH] sheep: fix vdi clone operation

Hitoshi Mitake mitake.hitoshi at gmail.com
Thu Feb 6 06:34:35 CET 2014


At Wed,  5 Feb 2014 21:17:28 +0800,
Liu Yuan wrote:
> 
> - pass correct array size
> - return FULL_VDI instead of wrong NO_BASE_VDI
> 
> Signed-off-by: Liu Yuan <namei.unix at gmail.com>
> ---
>  sheep/vdi.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Looks good to me.
Reviewed-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>

Thanks,
Hitoshi

> 
> diff --git a/sheep/vdi.c b/sheep/vdi.c
> index 080bc82..1ae31ca 100644
> --- a/sheep/vdi.c
> +++ b/sheep/vdi.c
> @@ -315,9 +315,9 @@ static int clone_vdi(const struct vdi_iocb *iocb, uint32_t new_snapid,
>  		goto out;
>  	}
>  
> -	idx = find_free_idx(base->child_vdi_id, sizeof(base->child_vdi_id));
> +	idx = find_free_idx(base->child_vdi_id, ARRAY_SIZE(base->child_vdi_id));
>  	if (idx < 0) {
> -		ret = SD_RES_NO_BASE_VDI;
> +		ret = SD_RES_FULL_VDI;
>  		goto out;
>  	}
>  
> @@ -379,9 +379,9 @@ static int snapshot_vdi(const struct vdi_iocb *iocb, uint32_t new_snapid,
>  		goto out;
>  	}
>  
> -	idx = find_free_idx(base->child_vdi_id, sizeof(base->child_vdi_id));
> +	idx = find_free_idx(base->child_vdi_id, ARRAY_SIZE(base->child_vdi_id));
>  	if (idx < 0) {
> -		ret = SD_RES_NO_BASE_VDI;
> +		ret = SD_RES_FULL_VDI;
>  		goto out;
>  	}
>  
> @@ -448,9 +448,9 @@ static int rebase_vdi(const struct vdi_iocb *iocb, uint32_t new_snapid,
>  		goto out;
>  	}
>  
> -	idx = find_free_idx(base->child_vdi_id, sizeof(base->child_vdi_id));
> +	idx = find_free_idx(base->child_vdi_id, ARRAY_SIZE(base->child_vdi_id));
>  	if (idx < 0) {
> -		ret = SD_RES_NO_BASE_VDI;
> +		ret = SD_RES_FULL_VDI;
>  		goto out;
>  	}
>  
> -- 
> 1.8.1.2
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list