For erasure coding with x:y scheme, we can still promise the data reliability with x nodes alive and provide services. There is no reason we don't do it in sheepdog.
Signed-off-by: Liu Yuan <[email protected]> --- sheep/plain_store.c | 13 ------------- sheep/recovery.c | 19 ++++++------------- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/sheep/plain_store.c b/sheep/plain_store.c index fde7c9f..02db25e 100644 --- a/sheep/plain_store.c +++ b/sheep/plain_store.c @@ -463,19 +463,6 @@ static bool oid_stale(uint64_t oid) const struct sd_vnode *obj_vnodes[SD_MAX_COPIES]; vinfo = get_vnode_info(); - /* - * If vinfo->nr_zones < SD_EC_DP, we might not get the idx, so we don't - * know it is stale or not. In this case, we keep it stay in the working - * directory in order to recover it when we get enough zones - */ - if (is_erasure_oid(oid)) { - uint8_t policy = get_vdi_copy_policy(oid_to_vid(oid)); - int edp = ec_policy_to_dp(policy, NULL, NULL); - - if (unlikely(vinfo->nr_zones < edp)) - return false; - } - nr_copies = get_obj_copy_number(oid, vinfo->nr_zones); oid_to_vnodes(oid, &vinfo->vroot, nr_copies, obj_vnodes); for (i = 0; i < nr_copies; i++) { diff --git a/sheep/recovery.c b/sheep/recovery.c index 39ca2b1..3c59756 100644 --- a/sheep/recovery.c +++ b/sheep/recovery.c @@ -431,17 +431,15 @@ out: return lost; } -static uint8_t local_node_copy_index(struct rb_root *vroot, uint64_t oid) +static uint8_t local_node_copy_index(struct vnode_info *vinfo, uint64_t oid) { - const struct sd_node *target_nodes[SD_MAX_NODES]; - uint8_t policy = get_vdi_copy_policy(oid_to_vid(oid)); uint8_t idx; - int edp = ec_policy_to_dp(policy, NULL, NULL); - oid_to_nodes(oid, vroot, edp, target_nodes); - for (idx = 0; idx < edp; idx++) - if (node_is_local(target_nodes[idx])) + for (idx = 0; idx < vinfo->nr_zones; idx++) { + const struct sd_node *n = oid_to_node(oid, &vinfo->vroot, idx); + if (node_is_local(n)) return idx; + } panic("can't get valid index for %"PRIx64, oid); } @@ -470,13 +468,8 @@ static int recover_erasure_object(struct recovery_obj_work *row) void *buf = NULL; uint8_t idx; int ret = -1; - uint8_t policy = get_vdi_copy_policy(oid_to_vid(oid)); - int edp = ec_policy_to_dp(policy, NULL, NULL); - - if (cur->nr_zones < edp) - return -1; - idx = local_node_copy_index(&cur->vroot, oid); + idx = local_node_copy_index(cur, oid); buf = read_erasure_object(oid, idx, rw); if (!buf) buf = rebuild_erasure_object(oid, idx, rw); -- 1.7.9.5 -- sheepdog mailing list [email protected] http://lists.wpkg.org/mailman/listinfo/sheepdog
