[sheepdog] [PATCH] collie/farm: fixed wrong way of calculating nr_vmstate_obejct

Liu Yuan namei.unix at gmail.com
Tue Jun 25 08:37:55 CEST 2013


On Mon, Jun 24, 2013 at 10:54:17PM -0700, Kai Zhang wrote:
> Without this patch, tests/functional/030 will not pass.
> 
> Signed-off-by: Kai Zhang <kyle at zelin.io>
> ---
>  collie/cluster.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/collie/cluster.c b/collie/cluster.c
> index 4e94ad2..21218dc 100644
> --- a/collie/cluster.c
> +++ b/collie/cluster.c
> @@ -273,7 +273,9 @@ static void fill_object_tree(uint32_t vid, const char *name, const char *tag,
>  	}
>  
>  	/* fill vmstate object id */
> -	nr_vmstate_object = (i->vm_state_size / SD_DATA_OBJ_SIZE) + 1;
> +	nr_vmstate_object = i->vm_state_size / SD_DATA_OBJ_SIZE;
> +	if (i->vm_state_size % SD_DATA_OBJ_SIZE != 0)
> +		nr_vmstate_object++;

How about following? 
	nr_vmstate_object = i->vm_state_size ?
	                    i->vm_state_size / SD_DATA_OBJ_SIZE + 1 : 0;

Thanks,
Yuan



More information about the sheepdog mailing list