diff options
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot-scrub.h | 2 | ||||
-rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot.c | 29 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 41 |
3 files changed, 61 insertions, 11 deletions
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.h b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.h index 427153c4bd7..e730582f1f8 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.h +++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.h @@ -25,4 +25,6 @@ int32_t br_scrubber_handle_options (xlator_t *, br_private_t *, dict_t *); int32_t br_scrubber_init (xlator_t *, br_private_t *); +int32_t br_collect_bad_objects_from_children (xlator_t *this, dict_t *dict); + #endif /* __BIT_ROT_SCRUB_H__ */ diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c index c4ed7dee718..b28bf2622af 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot.c @@ -1547,6 +1547,21 @@ _br_qchild_event (xlator_t *this, br_child_t *child, br_child_handler *call) } int +br_scrubber_status_get (xlator_t *this, dict_t **dict) +{ + + int ret = -1; + + ret = br_get_bad_objects_list (this, dict); + if (ret) { + gf_msg_debug (this->name, 0, "Failed to collect corrupt " + "files"); + } + + return ret; +} + +int notify (xlator_t *this, int32_t event, void *data, ...) { int idx = -1; @@ -1623,19 +1638,13 @@ notify (xlator_t *this, int32_t event, void *data, ...) break; case GF_EVENT_SCRUB_STATUS: - gf_log (this->name, GF_LOG_INFO, "BitRot scrub status " - "called"); + gf_msg_debug (this->name, GF_LOG_INFO, "BitRot scrub status " + "called"); va_start (ap, data); output = va_arg (ap, dict_t *); - /* As of now hardcoding last-scrub-time value. At the time of - * Final patch submission this option value along with other - * few option value will be calculate based on real time */ - ret = dict_set_uint64 (output, "last-scrub-time", 12); - if (ret) { - gf_log (this->name, GF_LOG_DEBUG, "Failed to set last " - "scrub time value"); - } + ret = br_scrubber_status_get (this, &output); + gf_msg_debug (this->name, 0, "returning %d", ret); break; default: default_notify (this, event, data); 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; |