[sheepdog] [PATCH 1/2] sheep: save store driver name outside storage driver
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Fri Aug 31 09:34:41 CEST 2012
Storage drivers shouldn't care about config file.
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
sheep/ops.c | 5 ++++-
sheep/plain_store.c | 5 +----
sheep/sheep_priv.h | 4 ++--
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/sheep/ops.c b/sheep/ops.c
index 6e1936a..74504a8 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -221,6 +221,7 @@ static int cluster_make_fs(const struct sd_req *req, struct sd_rsp *rsp,
uint64_t created_time;
struct siocb iocb = { 0 };
struct store_driver *driver;
+ char *store_name = data;
driver = find_store_driver(data);
if (!driver)
@@ -230,9 +231,11 @@ static int cluster_make_fs(const struct sd_req *req, struct sd_rsp *rsp,
latest_epoch = get_latest_epoch();
iocb.epoch = latest_epoch;
- ret = sd_store->format(data);
+ ret = sd_store->format();
if (ret != SD_RES_SUCCESS)
return ret;
+ if (set_cluster_store(store_name) < 0)
+ return SD_RES_EIO;
ret = sd_store->init(obj_path);
if (ret != SD_RES_SUCCESS)
diff --git a/sheep/plain_store.c b/sheep/plain_store.c
index 30566ab..cd1c41b 100644
--- a/sheep/plain_store.c
+++ b/sheep/plain_store.c
@@ -382,7 +382,7 @@ int default_end_recover(uint32_t old_epoch, struct vnode_info *old_vnode_info)
return for_each_object_in_wd(check_stale_objects, &old_epoch);
}
-int default_format(char *name)
+int default_format(void)
{
unsigned ret;
@@ -397,9 +397,6 @@ int default_format(char *name)
return SD_RES_EIO;
}
- if (set_cluster_store(name) < 0)
- return SD_RES_EIO;
-
return SD_RES_SUCCESS;
}
diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h
index c2286ab..5969c26 100644
--- a/sheep/sheep_priv.h
+++ b/sheep/sheep_priv.h
@@ -145,7 +145,7 @@ struct store_driver {
int (*exist)(uint64_t oid);
int (*write)(uint64_t oid, struct siocb *, int create);
int (*read)(uint64_t oid, struct siocb *);
- int (*format)(char *name);
+ int (*format)(void);
int (*remove_object)(uint64_t oid);
/* Operations in recovery */
int (*link)(uint64_t oid, struct siocb *, uint32_t tgt_epoch);
@@ -168,7 +168,7 @@ int default_link(uint64_t oid, struct siocb *iocb, uint32_t tgt_epoch);
int default_atomic_put(uint64_t oid, struct siocb *iocb);
int default_end_recover(uint32_t old_epoch, struct vnode_info *old_vnode_info);
int default_cleanup(void);
-int default_format(char *name);
+int default_format(void);
int default_remove_object(uint64_t oid);
int default_purge_obj(void);
int for_each_object_in_wd(int (*func)(uint64_t oid, void *arg), void *arg);
--
1.7.2.5
More information about the sheepdog
mailing list