[sheepdog] [PATCH] collie/farm: fixed wrong way of calculating nr_vmstate_obejct

Kai Zhang kyle at zelin.io
Tue Jun 25 07:54:17 CEST 2013


Without this patch, tests/functional/030 will not pass.

Signed-off-by: Kai Zhang <kyle at zelin.io>
---
 collie/cluster.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/collie/cluster.c b/collie/cluster.c
index 4e94ad2..21218dc 100644
--- a/collie/cluster.c
+++ b/collie/cluster.c
@@ -273,7 +273,9 @@ static void fill_object_tree(uint32_t vid, const char *name, const char *tag,
 	}
 
 	/* fill vmstate object id */
-	nr_vmstate_object = (i->vm_state_size / SD_DATA_OBJ_SIZE) + 1;
+	nr_vmstate_object = i->vm_state_size / SD_DATA_OBJ_SIZE;
+	if (i->vm_state_size % SD_DATA_OBJ_SIZE != 0)
+		nr_vmstate_object++;
 	for (int idx = 0; idx < nr_vmstate_object; idx++) {
 		vmstate_oid = vid_to_vmstate_oid(vid, idx);
 		object_tree_insert(vmstate_oid, i->nr_copies);
-- 
1.7.9.5




More information about the sheepdog mailing list