[sheepdog] [PATCH v7 09/10] sheep: support erasure code
Robin Dong
robin.k.dong at gmail.com
Sat Nov 16 15:57:38 CET 2013
Change is_erasure_obj(), is_erasure_oid() and get_store_objsize() in sheep and dog
to deal with erasure-code for hyper volume.
Signed-off-by: Robin Dong <sanbai at taobao.com>
---
dog/common.c | 4 ++++
include/sheepdog_proto.h | 3 +++
sheep/gateway.c | 6 +++++-
3 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/dog/common.c b/dog/common.c
index bc8cb79..86a1f30 100644
--- a/dog/common.c
+++ b/dog/common.c
@@ -333,6 +333,8 @@ size_t get_store_objsize(uint8_t copy_policy, uint64_t oid)
{
if (is_vdi_obj(oid))
return SD_INODE_SIZE;
+ if (is_vdi_btree_obj(oid))
+ return SD_INODE_DATA_INDEX_SIZE;
if (copy_policy != 0) {
int d;
@@ -346,6 +348,8 @@ bool is_erasure_oid(uint64_t oid, uint8_t policy)
{
if (is_vdi_obj(oid))
return false;
+ if (is_vdi_btree_obj(oid))
+ return false;
if (policy == 0)
return false;
return true;
diff --git a/include/sheepdog_proto.h b/include/sheepdog_proto.h
index beab3cd..cb47e3f 100644
--- a/include/sheepdog_proto.h
+++ b/include/sheepdog_proto.h
@@ -419,6 +419,9 @@ static inline size_t get_objsize(uint64_t oid)
if (is_vdi_attr_obj(oid))
return SD_ATTR_OBJ_SIZE;
+ if (is_vdi_btree_obj(oid))
+ return SD_INODE_DATA_INDEX_SIZE;
+
return SD_DATA_OBJ_SIZE;
}
diff --git a/sheep/gateway.c b/sheep/gateway.c
index e2e5a21..3565619 100644
--- a/sheep/gateway.c
+++ b/sheep/gateway.c
@@ -194,6 +194,9 @@ bool is_erasure_obj(uint64_t oid, uint8_t copy_policy)
if (is_vdi_obj(oid))
return false;
+ if (is_vdi_btree_obj(oid))
+ return false;
+
if (copy_policy > 0)
return true;
@@ -202,7 +205,8 @@ bool is_erasure_obj(uint64_t oid, uint8_t copy_policy)
bool is_erasure_oid(uint64_t oid)
{
- return !is_vdi_obj(oid) && get_vdi_copy_policy(oid_to_vid(oid)) > 0;
+ return !is_vdi_obj(oid) && !is_vdi_btree_obj(oid) &&
+ get_vdi_copy_policy(oid_to_vid(oid)) > 0;
}
/* Prepare request iterator and buffer for each replica */
--
1.7.1
More information about the sheepdog
mailing list