[sheepdog] [PATCH] object cache: fix a wrong conversion assignment
Liu Yuan
namei.unix at gmail.com
Tue Dec 3 07:33:35 CET 2013
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;
for (int i = 0; i < HASH_SIZE; i++) {
struct hlist_head *head = cache_hashtable + i;
--
1.7.9.5
More information about the sheepdog
mailing list