From c649c64e3a9e72703477c59fb1a80ab7a7d9c124 Mon Sep 17 00:00:00 2001 From: Yanhu Cao Date: Fri, 14 Aug 2020 16:38:18 +0800 Subject: [PATCH] client: dump frag's repmap if dir_replicated is true Signed-off-by: Yanhu Cao --- src/client/Inode.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/client/Inode.cc b/src/client/Inode.cc index ab27d1eb4f11..bf2a09991e26 100644 --- a/src/client/Inode.cc +++ b/src/client/Inode.cc @@ -451,6 +451,24 @@ void Inode::dump(Formatter *f) const if (is_dir()) { f->dump_int("dir_hashed", (int)dir_hashed); f->dump_int("dir_replicated", (int)dir_replicated); + if (dir_replicated) { + f->open_array_section("dirfrags"); + for (const auto &frag : frag_repmap) { + f->open_object_section("frags"); + CachedStackStringStream css; + *css << std::hex << frag.first.value() << "/" << std::dec << frag.first.bits(); + f->dump_string("frag", css->strv()); + + f->open_array_section("repmap"); + for (const auto &mds : frag.second) { + f->dump_int("mds", mds); + } + f->close_section(); + + f->close_section(); + } + f->close_section(); + } } f->open_array_section("caps"); -- 2.47.3