From 4348a6af89085cbdb41963f828b88deee4a109f1 Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Garg Date: Mon, 23 Nov 2015 17:00:07 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/12720 Tested-by: NetBSD Build System Tested-by: Gluster Build System Reviewed-by: Atin Mukherjee --- xlators/features/bit-rot/src/bitd/bit-rot.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'xlators/features/bit-rot/src/bitd/bit-rot.c') 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 @@ -1546,6 +1546,21 @@ _br_qchild_event (xlator_t *this, br_child_t *child, br_child_handler *call) list_add_tail (&childev->list, &priv->bricks); } +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, ...) { @@ -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); -- cgit