From 974837c3da9deb45cd2dc31afe56e5960268cf01 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 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 Change-Id: If09babafaf5d7cf158fa79119abbf5b986027748 BUG: 1283881 Signed-off-by: Gaurav Kumar Garg Reviewed-on: http://review.gluster.org/12725 Tested-by: NetBSD Build System Tested-by: Gluster Build System Reviewed-by: Atin Mukherjee --- xlators/features/bit-rot/src/bitd/bit-rot-scrub.h | 2 ++ xlators/features/bit-rot/src/bitd/bit-rot.c | 29 +++++++++++++++-------- 2 files changed, 21 insertions(+), 10 deletions(-) (limited to 'xlators/features/bit-rot') 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 c5a8a75f847..a88fa57662e 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot.c @@ -1561,6 +1561,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, ...) { @@ -1638,19 +1653,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