diff options
| author | Kotresh HR <khiremat@redhat.com> | 2016-07-04 17:25:57 +0530 | 
|---|---|---|
| committer | Jeff Darcy <jdarcy@redhat.com> | 2016-07-15 06:42:25 -0700 | 
| commit | 8c6700bc7bc78ed4754bf2e59fd28a40530d4e76 (patch) | |
| tree | 5e7bd9a78cda87397e255f8582c95d38cf09d998 /xlators/features/bit-rot/src/bitd/bit-rot.c | |
| parent | 49e26b6967b4b6aac67d75a81b0d697b2d8e7e6b (diff) | |
feature/bitrot: Show whether scrub is in progress/idle
Backport of http://review.gluster.org/14864/
Bitrot scrub status shows whether the scrub is paused
or active. It doesn't show whether the scrubber is
actually scrubbing or waiting in the timer wheel
for the next schedule. This patch shows this status
with "In Progress" and "Idle" respectively.
Change-Id: I995d8553d1ff166503ae1e7b46282fc3ba961f0b
BUG: 1355635
Signed-off-by: Kotresh HR <khiremat@redhat.com>
(cherry picked from commit f4757d256e3e00132ef204c01ed61f78f705ad6b)
Reviewed-on: http://review.gluster.org/14900
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/features/bit-rot/src/bitd/bit-rot.c')
| -rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot.c | 27 | 
1 files changed, 14 insertions, 13 deletions
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c index 45f8d1d624c..46bef085404 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot.c @@ -1541,7 +1541,6 @@ br_scrubber_status_get (xlator_t *this, dict_t **dict)  {          int                    ret          = -1; -        char                   key[256]     = {0,};          br_private_t          *priv         = NULL;          struct br_scrub_stats *scrub_stats  = NULL; @@ -1557,33 +1556,35 @@ br_scrubber_status_get (xlator_t *this, dict_t **dict)                                "files");          } -        memset (key, 0, 256); -        snprintf (key, 256, "scrubbed-files"); -        ret = dict_set_uint64 (*dict, key, scrub_stats->scrubbed_files); +        ret = dict_set_int8 (*dict, "scrub-running", +                             scrub_stats->scrub_running); +        if (ret) { +                gf_msg_debug (this->name, 0, "Failed setting scrub_running " +                              "entry to the dictionary"); +        } + +        ret = dict_set_uint64 (*dict, "scrubbed-files", +                               scrub_stats->scrubbed_files);          if (ret) {                  gf_msg_debug (this->name, 0, "Failed to setting scrubbed file "                                "entry to the dictionary");          } -        memset (key, 0, 256); -        snprintf (key, 256, "unsigned-files"); -        ret = dict_set_uint64 (*dict, key, scrub_stats->unsigned_files); +        ret = dict_set_uint64 (*dict, "unsigned-files", +                               scrub_stats->unsigned_files);          if (ret) {                  gf_msg_debug (this->name, 0, "Failed to set unsigned file count"                                " entry to the dictionary");          } -        memset (key, 0, 256); -        snprintf (key, 256, "scrub-duration"); -        ret = dict_set_uint64 (*dict, key, scrub_stats->scrub_duration); +        ret = dict_set_uint64 (*dict, "scrub-duration", +                               scrub_stats->scrub_duration);          if (ret) {                  gf_msg_debug (this->name, 0, "Failed to set scrub duration"                                " entry to the dictionary");          } -        memset (key, 0, 256); -        snprintf (key, 256, "last-scrub-time"); -        ret = dict_set_dynstr_with_alloc (*dict, key, +        ret = dict_set_dynstr_with_alloc (*dict, "last-scrub-time",                                            scrub_stats->last_scrub_time);          if (ret) {                  gf_msg_debug (this->name, 0, "Failed to set "  | 
