[sheepdog] [PATCH v2 6/6] store: remove get_store_dir()

Liu Yuan namei.unix at gmail.com
Sat May 19 17:11:25 CEST 2012


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

It is no longer used after simple is removed

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/ops.c |   17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/sheep/ops.c b/sheep/ops.c
index 4ce9fba..1b35552 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -64,14 +64,6 @@ struct flush_work {
 	struct work work;
 };
 
-static void get_store_dir(struct strbuf *buf, uint32_t epoch)
-{
-	if (!strcmp(sd_store->name, "simple"))
-		strbuf_addf(buf, "%s%08u/", obj_path, epoch);
-	else /* XXX assume other store doesn't need epoch/obj pattern */
-		strbuf_addf(buf, "%s", obj_path);
-}
-
 static int stat_sheep(uint64_t *store_size, uint64_t *store_free, uint32_t epoch)
 {
 	struct statvfs vs;
@@ -89,7 +81,7 @@ static int stat_sheep(uint64_t *store_size, uint64_t *store_free, uint32_t epoch
 		goto out;
 	}
 
-	get_store_dir(&store_dir, epoch);
+	strbuf_addf(&store_dir, "%s", obj_path);
 	dir = opendir(store_dir.buf);
 	if (!dir) {
 		ret = SD_RES_EIO;
@@ -704,13 +696,11 @@ out:
 
 static int store_remove_obj(struct request *req)
 {
-	uint32_t epoch = req->rq.epoch;
 	uint64_t oid = req->rq.obj.oid;
 	struct strbuf buf = STRBUF_INIT;
 	int ret = SD_RES_SUCCESS;
 
-	get_store_dir(&buf, epoch);
-	strbuf_addf(&buf, "%016" PRIx64, oid);
+	strbuf_addf(&buf, "%s%016" PRIx64, obj_path, oid);
 	if (unlink(buf.buf) < 0) {
 		if (errno == ENOENT) {
 			ret = SD_RES_NO_OBJ;
@@ -765,8 +755,7 @@ static int do_write_obj(struct siocb *iocb, struct sd_req *hdr, uint32_t epoch,
 	if (is_vdi_obj(oid)) {
 		struct strbuf buf = STRBUF_INIT;
 
-		get_store_dir(&buf, epoch);
-		strbuf_addf(&buf, "%016" PRIx64, oid);
+		strbuf_addf(&buf, "%s%016" PRIx64, obj_path, oid);
 		jd = jrnl_begin(data, hdr->data_length, hdr->obj.offset,
 				buf.buf, jrnl_path);
 		if (!jd) {
-- 
1.7.10.2




More information about the sheepdog mailing list