[sheepdog] [PATCH v2] dog: type cast miss at vdi_show_progress
Saeki Masaki
saeki.masaki at po.ntts.co.jp
Tue Feb 10 12:34:44 CET 2015
The result of the multiplication of uint32 and uint64 are rounded to uint32
So, Progress of the command is displayed sometimes back to 0%
This is only a display issue, command processing can be completed.
necessary in show_progress of calculation, change type of idx to uint64_t.
However, idx in the current Sheepdog is within 32bit number,
so upper limit check idx, using the max_idx can help us avoid the side effect.
Signed-off-by: Masaki Saeki <saeki.masaki at po.ntts.co.jp>
---
dog/vdi.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/dog/vdi.c b/dog/vdi.c
index 6cb813e..db990b8 100644
--- a/dog/vdi.c
+++ b/dog/vdi.c
@@ -449,7 +449,8 @@ static int vdi_create(int argc, char **argv)
uint64_t size;
uint32_t vid;
uint64_t oid;
- uint32_t idx, max_idx;
+ uint64_t idx;
+ uint32_t max_idx;
uint32_t object_size;
uint64_t old_max_total_size = 0;
struct sd_inode *inode = NULL;
@@ -740,7 +741,8 @@ static int vdi_clone(int argc, char **argv)
const char *src_vdi = argv[optind++], *dst_vdi;
uint32_t base_vid, new_vid, vdi_id;
uint64_t oid;
- uint32_t idx, max_idx, ret;
+ uint64_t idx;
+ uint32_t max_idx, ret;
uint32_t object_size;
struct sd_inode *inode = NULL, *new_inode = NULL;
char *buf = NULL;
--
1.7.1
More information about the sheepdog
mailing list