From: Igor Fedotov Date: Mon, 19 Aug 2019 12:51:51 +0000 (+0300) Subject: os/bluestore: implement original allocator fragmentation inspection. X-Git-Tag: v14.2.11~31^2~12 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=e35f0879d8b5051a3ece9eb3873fef3586d31f82;p=ceph.git os/bluestore: implement original allocator fragmentation inspection. Using admin socket interface: bluestore allocator fragmentation [block|bluefs-db|bluefs-wal|bluefs-slow] Signed-off-by: Igor Fedotov (cherry picked from commit 11b5feb01d273365c32ec6419faead629fb8c20b) --- diff --git a/src/os/bluestore/Allocator.cc b/src/os/bluestore/Allocator.cc index 507203f0e7f63..25cb331880a53 100644 --- a/src/os/bluestore/Allocator.cc +++ b/src/os/bluestore/Allocator.cc @@ -35,6 +35,11 @@ public: this, "give score on allocator fragmentation (0-no fragmentation, 1-absolute fragmentation)"); ceph_assert(r == 0); + r = admin_socket->register_command(("bluestore allocator fragmentation " + name).c_str(), + ("bluestore allocator fragmentation " + name).c_str(), + this, + "give allocator fragmentation (0-no fragmentation, 1-absolute fragmentation)"); + ceph_assert(r == 0); } } } @@ -46,6 +51,8 @@ public: ceph_assert(r == 0); r = admin_socket->unregister_command(("bluestore allocator score " + name).c_str()); ceph_assert(r == 0); + r = admin_socket->unregister_command(("bluestore allocator fragmentation " + name).c_str()); + ceph_assert(r == 0); } } @@ -79,6 +86,13 @@ public: f->close_section(); f->flush(ss); delete f; + } else if (command == "bluestore allocator fragmentation " + name) { + Formatter* f = Formatter::create(format, "json-pretty", "json-pretty"); + f->open_object_section("fragmentation"); + f->dump_float("fragmentation_rating", alloc->get_fragmentation()); + f->close_section(); + f->flush(ss); + delete f; } else { ss << "Invalid command" << std::endl; r = false;