[sheepdog] [PATCH] sheep: correct get_vdi_copy_policy()

Robin Dong robin.k.dong at gmail.com
Wed Dec 4 04:15:52 CET 2013


Reviewed-by: Robin Dong <sanbai at taobao.com>


2013/12/3 Liu Yuan <namei.unix at gmail.com>

> Since cluster_info support copy_policy now, we can return system wide
> copy_policy for get_vdi_copy_policy() if vdi is not found.
>
> Signed-off-by: Liu Yuan <namei.unix at gmail.com>
> ---
>  sheep/vdi.c |    8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/sheep/vdi.c b/sheep/vdi.c
> index 60bc52d..90f1c70 100644
> --- a/sheep/vdi.c
> +++ b/sheep/vdi.c
> @@ -112,9 +112,11 @@ int get_vdi_copy_policy(uint32_t vid)
>         entry = vdi_state_search(&vdi_state_root, vid);
>         sd_unlock(&vdi_state_lock);
>
> -       if (!entry)
> -               /* If not found, it must be non-erasure object */
> -               return 0;
> +       if (!entry) {
> +               sd_alert("copy policy for %" PRIx32 " not found, set %d",
> vid,
> +                        sys->cinfo.copy_policy);
> +               return sys->cinfo.copy_policy;
> +       }
>
>         return entry->copy_policy;
>  }
> --
> 1.7.9.5
>
> --
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog
>



-- 
--
Best Regard
Robin Dong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wpkg.org/pipermail/sheepdog/attachments/20131204/49ae12db/attachment-0004.html>


More information about the sheepdog mailing list