[sheepdog] [PATCH] dog: type cast miss at vdi_show_progress

Saeki Masaki saeki.masaki at po.ntts.co.jp
Tue Feb 10 07:03:56 CET 2015


The result of the multiplication of uint32 and uint64 are rounded to uint32
So, Progress of the command is displayed back to 0%,
when it exceeds the boundaries of 32bit.

This is only a display issue, command processing can be completed.

Signed-off-by: Masaki Saeki <saeki.masaki at po.ntts.co.jp>
---
 dog/vdi.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dog/vdi.c b/dog/vdi.c
index 58d4a12..0920936 100644
--- a/dog/vdi.c
+++ b/dog/vdi.c
@@ -532,7 +532,7 @@ static int vdi_create(int argc, char **argv)
 	max_idx = DIV_ROUND_UP(size, object_size);
 
 	for (idx = 0; idx < max_idx; idx++) {
-		vdi_show_progress(idx * object_size, inode->vdi_size);
+		vdi_show_progress((uint64_t)idx * object_size, inode->vdi_size);
 		oid = vid_to_data_oid(vid, idx);
 
 		ret = dog_write_object(oid, 0, NULL, 0, 0, 0, inode->nr_copies,
@@ -549,7 +549,7 @@ static int vdi_create(int argc, char **argv)
 			goto out;
 		}
 	}
-	vdi_show_progress(idx * object_size, inode->vdi_size);
+	vdi_show_progress((uint64_t)idx * object_size, inode->vdi_size);
 	ret = EXIT_SUCCESS;
 
 out:
@@ -790,7 +790,7 @@ static int vdi_clone(int argc, char **argv)
 	for (idx = 0; idx < max_idx; idx++) {
 		size_t size;
 
-		vdi_show_progress(idx * object_size, inode->vdi_size);
+		vdi_show_progress((uint64_t)idx * object_size, inode->vdi_size);
 		vdi_id = sd_inode_get_vid(inode, idx);
 		if (vdi_id) {
 			oid = vid_to_data_oid(vdi_id, idx);
@@ -824,7 +824,7 @@ static int vdi_clone(int argc, char **argv)
 			goto out;
 		}
 	}
-	vdi_show_progress(idx * object_size, inode->vdi_size);
+	vdi_show_progress((uint64_t)idx * object_size, inode->vdi_size);
 	ret = EXIT_SUCCESS;
 
 out:
-- 
1.7.1






More information about the sheepdog mailing list