summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
authorGaurav Kumar Garg <garg.gaurav52@gmail.com>2015-11-23 17:00:07 +0530
committerAtin Mukherjee <amukherj@redhat.com>2015-11-23 22:25:47 -0800
commit4348a6af89085cbdb41963f828b88deee4a109f1 (patch)
tree0c50f31509a765df4b18d46c21c139c2ac30736f /xlators/mgmt/glusterd
parentc93e436527e9d2ceed46b939e18edc40b7018cee (diff)
glusterd/bitrot : Integration of bad files from bitd with scrub status command
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> Reviewed-on: http://review.gluster.org/12720 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.c41
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 c31c394f661..07b035d805a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -8245,6 +8245,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,};
@@ -8261,6 +8262,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;
@@ -8378,6 +8380,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);
@@ -8447,6 +8467,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;
@@ -8456,6 +8477,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;
@@ -8612,7 +8634,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);
@@ -8621,6 +8643,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;