[sheepdog] [PATCH] object cache: fix a wrong conversion assignment

Liu Yuan namei.unix at gmail.com
Tue Dec 3 07:38:19 CET 2013


On Tue, Dec 03, 2013 at 02:33:35PM +0800, Liu Yuan wrote:
> If we assign the integer to a wider one, the width of that integer isn't
> automatically converted and then we'll get a partial valume.
> 
> This fix following problem:
> 
> sheep -w size=1T # which will overflow a 32bit integer
> dog vdi cache info # will get a wrong value
> 
> Signed-off-by: Liu Yuan <namei.unix at gmail.com>
> ---
>  sheep/object_cache.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sheep/object_cache.c b/sheep/object_cache.c
> index 3df88fd..600ef13 100644
> --- a/sheep/object_cache.c
> +++ b/sheep/object_cache.c
> @@ -1372,8 +1372,8 @@ int object_cache_get_info(struct object_cache_info *info)
>  {
>  	int j = 0;
>  
> -	info->used = gcache.capacity * 1024 * 1024;
> -	info->size = sys->object_cache_size * 1024 * 1024;
> +	info->used = (uint64_t )gcache.capacity * 1024 * 1024;
> +	info->size = (uint64_t )sys->object_cache_size * 1024 * 1024;

A wrong style, I'll update it with v2

Thanks
Yuan
 



More information about the sheepdog mailing list