[sheepdog] [PATCH v2 2/5] sheep: don't call heavy md_get_info init_obj_path()

Liu Yuan namei.unix at gmail.com
Fri Feb 28 08:52:16 CET 2014


This will iterate all the objects of the MD before vdi states setup, causing
data inconsistency problems.

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 sheep/store.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/sheep/store.c b/sheep/store.c
index c20b381..2d5aa32 100644
--- a/sheep/store.c
+++ b/sheep/store.c
@@ -203,8 +203,7 @@ static int is_meta_store(const char *path)
 static int init_obj_path(const char *base_path, char *argp)
 {
 	char *p;
-	int len, ret;
-	struct sd_md_info mdi;
+	int len;
 
 	if (check_path_len(base_path) < 0)
 		return -1;
@@ -234,13 +233,7 @@ static int init_obj_path(const char *base_path, char *argp)
 		} while ((p = strtok(NULL, ",")));
 	}
 
-	ret = md_get_info(&mdi);
-	if (ret != sizeof(mdi)) {
-		sd_err("Can't get md info");
-		return -1;
-	}
-
-	if (mdi.nr <= 0) {
+	if (md_nr_disks() <= 0) {
 		sd_err("There isn't any available disk!");
 		return -1;
 	}
-- 
1.8.1.2




More information about the sheepdog mailing list