[sheepdog] [PATCH] sheep: correct get_vdi_copy_policy()

Liu Yuan namei.unix at gmail.com
Tue Dec 3 07:42:30 CET 2013


Since cluster_info support copy_policy now, we can return system wide
copy_policy for get_vdi_copy_policy() if vdi is not found.

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 sheep/vdi.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sheep/vdi.c b/sheep/vdi.c
index 60bc52d..90f1c70 100644
--- a/sheep/vdi.c
+++ b/sheep/vdi.c
@@ -112,9 +112,11 @@ int get_vdi_copy_policy(uint32_t vid)
 	entry = vdi_state_search(&vdi_state_root, vid);
 	sd_unlock(&vdi_state_lock);
 
-	if (!entry)
-		/* If not found, it must be non-erasure object */
-		return 0;
+	if (!entry) {
+		sd_alert("copy policy for %" PRIx32 " not found, set %d", vid,
+			 sys->cinfo.copy_policy);
+		return sys->cinfo.copy_policy;
+	}
 
 	return entry->copy_policy;
 }
-- 
1.7.9.5




More information about the sheepdog mailing list