From 9459766868a7be0971e9bb6d313d16c45c68926c Mon Sep 17 00:00:00 2001 From: Milind Changire Date: Mon, 31 Oct 2022 11:18:58 +0530 Subject: [PATCH] mds: dump scrub stats during scrub status Signed-off-by: Milind Changire --- src/mds/ScrubStack.cc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/mds/ScrubStack.cc b/src/mds/ScrubStack.cc index 63bf584b2bcf9..a4e7c4ee3758f 100644 --- a/src/mds/ScrubStack.cc +++ b/src/mds/ScrubStack.cc @@ -723,6 +723,34 @@ void ScrubStack::scrub_status(Formatter *f) { f->close_section(); // scrub id } f->close_section(); // scrubs + + if (mds_scrub_stats.size()) { + f->open_object_section("scrub_stats"); + for (auto& [tag, ctrs] : mds_scrub_stats[0].counters) { + uint64_t started = 0; + uint64_t passed = 0; + uint64_t failed = 0; + for (auto& stats : mds_scrub_stats) { + if (auto it = stats.counters.find(tag); it != stats.counters.end()) { + auto& [t, c] = *it; + started += c.uninline_started; + passed += c.uninline_passed; + failed += c.uninline_failed; + } + } + f->open_object_section(tag); + { + f->dump_stream("start_time") << ctrs.start_time; + f->dump_string("path", (ctrs.origin_path == "" ? "/"s : ctrs.origin_path)); + f->dump_int("uninline_started", started); + f->dump_int("uninline_passed", passed); + f->dump_int("uninline_failed", failed); + } + f->close_section(); // tag + } + f->close_section(); // scrub_stats + } + f->close_section(); // result } -- 2.39.5