[sheepdog] [PATCH v2] object cache: fix a wrong conversion assignment
Robin Dong
robin.k.dong at gmail.com
Wed Dec 4 04:18:03 CET 2013
Reviewed-by: Robin Dong <sanbai at taobao.com>
2013/12/3 Liu Yuan <namei.unix at gmail.com>
> 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..10a051c 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;
>
> for (int i = 0; i < HASH_SIZE; i++) {
> struct hlist_head *head = cache_hashtable + i;
> --
> 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/c1267856/attachment-0004.html>
More information about the sheepdog
mailing list