[sheepdog] [PATCH v2] collie/farm: fixed wrong way of calculating nr_vmstate_obejct
Kai Zhang
kyle at zelin.io
Tue Jun 25 09:34:41 CEST 2013
v2:
- use DIV_ROUND_UP to simplify code
Without this patch, tests/functional/030 will not pass.
Signed-off-by: Kai Zhang <kyle at zelin.io>
---
collie/cluster.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/collie/cluster.c b/collie/cluster.c
index 4e94ad2..c0b3c92 100644
--- a/collie/cluster.c
+++ b/collie/cluster.c
@@ -273,7 +273,7 @@ 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 = DIV_ROUND_UP(i->vm_state_size, SD_DATA_OBJ_SIZE);
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