diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2015-03-26 16:06:36 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-03-30 23:38:49 -0700 |
commit | f9ee09abd29002d8612bcdcbeaf4cf3e404b4cc6 (patch) | |
tree | fb2c18a76cc9fe90ebc9b96949fad71d8bc2538b /heal | |
parent | 3feaf1648528ff39e23748ac9004a77595460c9d (diff) |
cluster/ec: Implement heal info for ec
This also lists the files that are on-going I/O, which
will be fixed later.
Change-Id: Ib3f60a8b7e8798d068658cf38eaef2a904f9e327
BUG: 1203581
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/10020
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'heal')
-rw-r--r-- | heal/src/glfs-heal.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/heal/src/glfs-heal.c b/heal/src/glfs-heal.c index 06dea1fff74..c014b826620 100644 --- a/heal/src/glfs-heal.c +++ b/heal/src/glfs-heal.c @@ -94,8 +94,18 @@ out: } static xlator_t* -_get_afr_ancestor (xlator_t *xl) +_get_ancestor (xlator_t *xl, gf_xl_afr_op_t heal_op) { + static char *replica_xl[] = {"cluster/replicate", NULL}; + static char *heal_xls[] = {"cluster/replicate", "cluster/disperse", + NULL}; + char **ancestors = NULL; + + if (heal_op == GF_SHD_OP_INDEX_SUMMARY) + ancestors = heal_xls; + else + ancestors = replica_xl; + if (!xl || !xl->parents) return NULL; @@ -103,7 +113,7 @@ _get_afr_ancestor (xlator_t *xl) xl = xl->parents->xlator; if (!xl) break; - if (strcmp (xl->type, "cluster/replicate") == 0) + if (gf_get_index_by_elem (ancestors, xl->type) != -1) return xl; } @@ -234,8 +244,7 @@ glfsh_process_entries (xlator_t *xl, fd_t *fd, gf_dirent_t *entries, uuid_parse (entry->d_name, gfid); uuid_copy (loc.gfid, gfid); - ret = syncop_getxattr (this, &loc, &dict, GF_AFR_HEAL_INFO, - NULL); + ret = syncop_getxattr (this, &loc, &dict, GF_HEAL_INFO, NULL); if (ret) continue; @@ -434,9 +443,9 @@ out: } static int -glfsh_validate_replicate_volume (xlator_t *xl) +glfsh_validate_volume (xlator_t *xl, gf_xl_afr_op_t heal_op) { - xlator_t *afr_xl = NULL; + xlator_t *heal_xl = NULL; int ret = -1; while (xl->next) @@ -444,8 +453,8 @@ glfsh_validate_replicate_volume (xlator_t *xl) while (xl) { if (strcmp (xl->type, "protocol/client") == 0) { - afr_xl = _get_afr_ancestor (xl); - if (afr_xl) { + heal_xl = _get_ancestor (xl, heal_op); + if (heal_xl) { ret = 0; break; } @@ -498,7 +507,7 @@ glfsh_gather_heal_info (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc, gf_xl_afr_op_t heal_op) { xlator_t *xl = NULL; - xlator_t *afr_xl = NULL; + xlator_t *heal_xl = NULL; xlator_t *old_THIS = NULL; xl = top_subvol; @@ -506,10 +515,10 @@ glfsh_gather_heal_info (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc, xl = xl->next; while (xl) { if (strcmp (xl->type, "protocol/client") == 0) { - afr_xl = _get_afr_ancestor (xl); - if (afr_xl) { + heal_xl = _get_ancestor (xl, heal_op); + if (heal_xl) { old_THIS = THIS; - THIS = afr_xl; + THIS = heal_xl; glfsh_print_pending_heals (fs, top_subvol, rootloc, xl, heal_op); @@ -778,9 +787,11 @@ main (int argc, char **argv) goto out; } - ret = glfsh_validate_replicate_volume (top_subvol); + ret = glfsh_validate_volume (top_subvol, heal_op); if (ret < 0) { - printf ("Volume %s is not of type replicate\n", volname); + printf ("Volume %s is not of type %s\n", volname, + (heal_op == GF_SHD_OP_INDEX_SUMMARY) ? + "replicate/disperse":"replicate"); goto out; } rootloc.inode = inode_ref (top_subvol->itable->root); |