[sheepdog] [PATCH v2 19/21] dog/farm: fix copy_policy for cluster snapshot operation

Liu Yuan namei.unix at gmail.com
Wed Oct 16 07:50:45 CEST 2013


Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 dog/cluster.c   |    2 +-
 dog/farm/farm.c |    7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/dog/cluster.c b/dog/cluster.c
index 485133b..c2f97ad 100644
--- a/dog/cluster.c
+++ b/dog/cluster.c
@@ -253,7 +253,7 @@ static void fill_object_tree(uint32_t vid, const char *name, const char *tag,
 		return;
 
 	/* fill vdi object id */
-	object_tree_insert(vdi_oid, i->nr_copies, 0);
+	object_tree_insert(vdi_oid, i->nr_copies, i->copy_policy);
 
 	/* fill data object id */
 	nr_objs = count_data_objs(i);
diff --git a/dog/farm/farm.c b/dog/farm/farm.c
index bf01eff..990d26b 100644
--- a/dog/farm/farm.c
+++ b/dog/farm/farm.c
@@ -184,7 +184,8 @@ out:
 	return ret;
 }
 
-static int notify_vdi_add(uint32_t vdi_id, uint32_t nr_copies)
+static int notify_vdi_add(uint32_t vdi_id, uint8_t nr_copies,
+			  uint8_t copy_policy)
 {
 	int ret = -1;
 	struct sd_req hdr;
@@ -194,6 +195,7 @@ static int notify_vdi_add(uint32_t vdi_id, uint32_t nr_copies)
 	sd_init_req(&hdr, SD_OP_NOTIFY_VDI_ADD);
 	hdr.vdi_state.new_vid = vdi_id;
 	hdr.vdi_state.copies = nr_copies;
+	hdr.vdi_state.copy_policy = copy_policy;
 	hdr.vdi_state.set_bitmap = true;
 
 	ret = dog_exec_req(&sd_nid, &hdr, buf);
@@ -363,7 +365,8 @@ static void do_load_object(struct work *work)
 
 	if (is_vdi_obj(sw->entry.oid)) {
 		if (notify_vdi_add(oid_to_vid(sw->entry.oid),
-				   sw->entry.nr_copies) < 0)
+				   sw->entry.nr_copies,
+				   sw->entry.copy_policy) < 0)
 			goto error;
 
 		sd_write_lock(&vdi_list_lock);
-- 
1.7.9.5




More information about the sheepdog mailing list