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 <[email protected]>
---
 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;
 
        for (int i = 0; i < HASH_SIZE; i++) {
                struct hlist_head *head = cache_hashtable + i;
-- 
1.7.9.5

-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to