diff options
author | Gaurav Kumar Garg <garg.gaurav52@gmail.com> | 2015-11-23 17:00:07 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2015-11-23 23:40:53 -0800 |
commit | 974837c3da9deb45cd2dc31afe56e5960268cf01 (patch) | |
tree | f865d9aa710159ce81e5abcb4a368e7c18171eff /xlators/mgmt/glusterd | |
parent | 99657b970855d9735a195e8ac19c8f1011d0d713 (diff) |
glusterd/bitrot : Integration of bad files from bitd with scrub status command
This patch is backport of: http://review.gluster.org/#/c/12720/
Currently scrub status command is not displaying list of all the bad files. All
the bad files are avaliable in the bitd daemon.
With this patch it will dispaly list of all the bad file's in the scrub
status command.
>> Change-Id: If09babafaf5d7cf158fa79119abbf5b986027748
>> BUG: 1207627
>> Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com>
Change-Id: If09babafaf5d7cf158fa79119abbf5b986027748
BUG: 1283881
Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com>
Reviewed-on: http://review.gluster.org/12725
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 9adae10346b..ca07660b638 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -8166,6 +8166,7 @@ int glusterd_volume_bitrot_scrub_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict) { int ret = -1; + int j = 0; uint64_t value = 0; int32_t count = 0; char key[256] = {0,}; @@ -8182,6 +8183,7 @@ glusterd_volume_bitrot_scrub_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict) char *scrub_freq = NULL; char *scrub_state = NULL; char *scrub_impact = NULL; + char *bad_gfid_str = NULL; xlator_t *this = NULL; glusterd_conf_t *priv = NULL; glusterd_volinfo_t *volinfo = NULL; @@ -8299,6 +8301,24 @@ glusterd_volume_bitrot_scrub_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict) gf_msg_debug (this->name, 0, "Failed to set error " "count value"); } + + /* Storing all the bad files in the dictionary */ + for (j = 0; j < value; j++) { + memset (key, 0, 256); + snprintf (key, 256, "quarantine-%d-%d", j, src_count); + ret = dict_get_str (rsp_dict, key, &bad_gfid_str); + if (!ret) { + memset (key, 0, 256); + snprintf (key, 256, "quarantine-%d-%d", j, + src_count+dst_count); + ret = dict_set_dynstr_with_alloc (aggr, key, + bad_gfid_str); + if (ret) { + gf_msg_debug (this->name, 0, "Failed to" + "bad file gfid "); + } + } + } } ret = dict_get_str (rsp_dict, "bitrot_log_file", &bitd_log); @@ -8368,6 +8388,7 @@ glusterd_bitrot_volume_node_rsp (dict_t *aggr, dict_t *rsp_dict) char buf[1024] = {0,}; uint64_t error_count = 0; int32_t i = 0; + int32_t j = 0; uint64_t scrubbed_files = 0; uint64_t unsigned_files = 0; uint64_t scrub_duration = 0; @@ -8377,6 +8398,7 @@ glusterd_bitrot_volume_node_rsp (dict_t *aggr, dict_t *rsp_dict) char *scrub_freq = NULL; char *scrub_state = NULL; char *scrub_impact = NULL; + char *bad_gfid_str = NULL; xlator_t *this = NULL; glusterd_conf_t *priv = NULL; glusterd_volinfo_t *volinfo = NULL; @@ -8533,7 +8555,7 @@ glusterd_bitrot_volume_node_rsp (dict_t *aggr, dict_t *rsp_dict) } } - ret = dict_get_uint64 (rsp_dict, "error-count", &value); + ret = dict_get_uint64 (rsp_dict, "total-count", &value); if (!ret) { memset (key, 0, 256); snprintf (key, 256, "error-count-%d", i); @@ -8542,6 +8564,23 @@ glusterd_bitrot_volume_node_rsp (dict_t *aggr, dict_t *rsp_dict) gf_msg_debug (this->name, 0, "Failed to set error " "count value"); } + + /* Storing all the bad files in the dictionary */ + for (j = 0; j < value; j++) { + memset (key, 0, 256); + snprintf (key, 256, "quarantine-%d", j); + ret = dict_get_str (rsp_dict, key, &bad_gfid_str); + if (!ret) { + memset (key, 0, 256); + snprintf (key, 256, "quarantine-%d-%d", j, i); + ret = dict_set_dynstr_with_alloc (aggr, key, + bad_gfid_str); + if (ret) { + gf_msg_debug (this->name, 0, "Failed to" + "bad file gfid "); + } + } + } } ret = 0; |