[sheepdog] [PATCH v2 6/7] plain: refine init() interface

Liu Yuan namei.unix at gmail.com
Mon Mar 11 09:19:32 CET 2013


From: Liu Yuan <tailai.ly at taobao.com>

obj_path isn't a valid objects path for md mode, so we should not pass
obj_path to store.init(), then we'd better completely remove it since we don't
need it for now.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/farm/farm.c   |   10 +++++-----
 sheep/group.c       |    2 +-
 sheep/ops.c         |    2 +-
 sheep/plain_store.c |    2 +-
 sheep/sheep_priv.h  |    4 ++--
 sheep/store.c       |    2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/sheep/farm/farm.c b/sheep/farm/farm.c
index 6c5f6b8..7becdd1 100644
--- a/sheep/farm/farm.c
+++ b/sheep/farm/farm.c
@@ -98,21 +98,21 @@ out:
 	return ret;
 }
 
-static int farm_init(const char *p)
+static int farm_init(void)
 {
 	sd_dprintf("use farm store driver");
-	if (create_directory(p) < 0)
+	if (create_directory(obj_path) < 0)
 		goto err;
 
-	if (!is_xattr_enabled(p)) {
-		sd_eprintf("xattrs are not enabled on %s", p);
+	if (!is_xattr_enabled(obj_path)) {
+		sd_eprintf("xattrs are not enabled on %s", obj_path);
 		goto err;
 	}
 
 	if (snap_init() < 0)
 		goto err;
 
-	if (default_init(p) < 0)
+	if (default_init() < 0)
 		goto err;
 
 	return SD_RES_SUCCESS;
diff --git a/sheep/group.c b/sheep/group.c
index c646101..11f8b24 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -732,7 +732,7 @@ static void setup_backend_store(const char *store, bool need_purge)
 		if (!sd_store)
 			panic("backend store %s not supported", store);
 
-		ret = sd_store->init(obj_path);
+		ret = sd_store->init();
 		if (ret != SD_RES_SUCCESS)
 			panic("failed to initialize store");
 
diff --git a/sheep/ops.c b/sheep/ops.c
index ff3ebbe..b9634ae 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -255,7 +255,7 @@ static int cluster_make_fs(const struct sd_req *req, struct sd_rsp *rsp,
 	if (set_cluster_store(store_name) < 0)
 		return SD_RES_EIO;
 
-	ret = sd_store->init(obj_path);
+	ret = sd_store->init();
 	if (ret != SD_RES_SUCCESS)
 		return ret;
 
diff --git a/sheep/plain_store.c b/sheep/plain_store.c
index d5fe6e2..ad55e09 100644
--- a/sheep/plain_store.c
+++ b/sheep/plain_store.c
@@ -217,7 +217,7 @@ static int init_objlist_and_vdi_bitmap(uint64_t oid, char *wd, void *arg)
 	return SD_RES_SUCCESS;
 }
 
-int default_init(const char *p)
+int default_init(void)
 {
 	int ret;
 
diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h
index da1df8e..003f3c9 100644
--- a/sheep/sheep_priv.h
+++ b/sheep/sheep_priv.h
@@ -149,7 +149,7 @@ struct vdi_iocb {
 struct store_driver {
 	struct list_head list;
 	const char *name;
-	int (*init)(const char *path);
+	int (*init)(void);
 	bool (*exist)(uint64_t oid);
 	/* create_and_write must be an atomic operation*/
 	int (*create_and_write)(uint64_t oid, const struct siocb *);
@@ -170,7 +170,7 @@ struct store_driver {
 	int (*get_snap_file)(struct siocb *);
 };
 
-int default_init(const char *p);
+int default_init(void);
 bool default_exist(uint64_t oid);
 int default_create_and_write(uint64_t oid, const struct siocb *iocb);
 int default_write(uint64_t oid, const struct siocb *iocb);
diff --git a/sheep/store.c b/sheep/store.c
index 5cf6ec4..900bedf 100644
--- a/sheep/store.c
+++ b/sheep/store.c
@@ -315,7 +315,7 @@ int init_store_driver(bool is_gateway)
 	if (is_gateway)
 		return SD_RES_SUCCESS;
 
-	return sd_store->init(obj_path);
+	return sd_store->init();
 }
 
 int init_disk_space(const char *base_path)
-- 
1.7.9.5




More information about the sheepdog mailing list