diff options
| author | Gaurav Kumar Garg <garg.gaurav52@gmail.com> | 2015-11-25 17:38:43 +0530 |
|---|---|---|
| committer | Venky Shankar <vshankar@redhat.com> | 2015-12-17 19:29:00 -0800 |
| commit | 530533fe44f08f30d1230c65db0054be7c6d3281 (patch) | |
| tree | f28c4122cb9a18d8fb55df6a91495987bbbda146 /xlators/features/bit-rot/src/bitd/bit-rot.c | |
| parent | 459314829691e3cb0c31f4971111d7dadfb199d8 (diff) | |
bitrot: getting correct value of scrub stat's
This patch is backport of: http://review.gluster.org/#/c/12776/
When user execute bitrot scrub status command then gluster
is not giving correct value of Number of Scrubbed files,
Number of Unsigned files, Last completed scrub time,
Duration of last scrub.
With this patch scrub status will give correct value for
all the above fields.
>> Change-Id: Ic966f76d22db5b0c889e6386a1c2219afbda1f49
>> BUG: 1285989
>> Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com>
>> Signed-off-by: Kotresh HR <khiremat@redhat.com>
>> Reviewed-on: http://review.gluster.org/12776
>> Tested-by: NetBSD Build System <jenkins@build.gluster.org>
>> Tested-by: Gluster Build System <jenkins@build.gluster.com>
>> Reviewed-by: Venky Shankar <vshankar@redhat.com>
Change-Id: Ic966f76d22db5b0c889e6386a1c2219afbda1f49
BUG: 1291546
Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com>
(cherry picked from commit 22827d51c232c44a8f5ac003529d907d93baf7b0)
Change-Id: Icef24cce35c8d54ffdfa5282491338318e78780b
Reviewed-on: http://review.gluster.org/12966
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Venky Shankar <vshankar@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 | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c index a88fa57662e..9ec2e42bbf6 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot.c @@ -1565,7 +1565,16 @@ int br_scrubber_status_get (xlator_t *this, dict_t **dict) { - int ret = -1; + int ret = -1; + char key[256] = {0,}; + br_private_t *priv = NULL; + struct br_scrub_stats *scrub_stats = NULL; + + priv = this->private; + + GF_VALIDATE_OR_GOTO ("bit-rot", priv, out); + + scrub_stats = &priv->scrub_stat; ret = br_get_bad_objects_list (this, dict); if (ret) { @@ -1573,6 +1582,40 @@ br_scrubber_status_get (xlator_t *this, dict_t **dict) "files"); } + memset (key, 0, 256); + snprintf (key, 256, "scrubbed-files"); + ret = dict_set_uint32 (*dict, key, 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_uint32 (*dict, key, 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_uint32 (*dict, key, 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, + scrub_stats->last_scrub_time); + if (ret) { + gf_msg_debug (this->name, 0, "Failed to set " + "last scrub time value"); + } + +out: return ret; } |
