From 8dffd68365dcd093795de118642c822e66dc939b Mon Sep 17 00:00:00 2001 From: David Zafman Date: Tue, 30 Jul 2019 20:43:05 +0000 Subject: [PATCH] osd: Add dump_scrub_reservations to show scrub reserve tracking Signed-off-by: David Zafman --- PendingReleaseNotes | 3 +++ src/osd/OSD.cc | 16 ++++++++++++++++ src/osd/OSD.h | 1 + 3 files changed, 20 insertions(+) diff --git a/PendingReleaseNotes b/PendingReleaseNotes index 5e2660d52dc72..d793483a08d1c 100644 --- a/PendingReleaseNotes +++ b/PendingReleaseNotes @@ -132,3 +132,6 @@ * New OSD daemon command dump_recovery_reservations which reveals the recovery locks held (in_progress) and waiting in priority queues. + +* New OSD daemon command dump_scrub_reservations which reveals the + scrub reservations that are active and pending. diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 74d84654c3f3c..14e2c064816ce 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1263,6 +1263,14 @@ void OSDService::dec_scrubs_active() ceph_assert(scrubs_active >= 0); } +void OSDService::dump_scrub_reservations(Formatter *f) +{ + std::lock_guard l{sched_scrub_lock}; + f->dump_int("scrubs_active", scrubs_active); + f->dump_int("scrubs_pending", scrubs_pending); + f->dump_int("osd_max_scrubs", cct->_conf->osd_max_scrubs); +} + void OSDService::retrieve_epochs(epoch_t *_boot_epoch, epoch_t *_up_epoch, epoch_t *_bind_epoch) const { @@ -2459,6 +2467,10 @@ will start to track new ops received afterwards."; service.remote_reserver.dump(f); f->close_section(); f->close_section(); + } else if (admin_command == "dump_scrub_reservations") { + f->open_object_section("scrub_reservations"); + service.dump_scrub_reservations(f); + f->close_section(); } else if (admin_command == "get_latest_osdmap") { get_latest_osdmap(); } else if (admin_command == "heap") { @@ -3324,6 +3336,10 @@ void OSD::final_init() asok_hook, "show recovery reservations"); ceph_assert(r == 0); + r = admin_socket->register_command("dump_scrub_reservations", "dump_scrub_reservations", + asok_hook, + "show scrub reservations"); + ceph_assert(r == 0); r = admin_socket->register_command("get_latest_osdmap", "get_latest_osdmap", asok_hook, "force osd to update the latest map from " diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 73455e91bd8e6..770087970b34a 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -354,6 +354,7 @@ public: void inc_scrubs_active(bool reserved); void dec_scrubs_pending(); void dec_scrubs_active(); + void dump_scrub_reservations(Formatter *f); void reply_op_error(OpRequestRef op, int err); void reply_op_error(OpRequestRef op, int err, eversion_t v, version_t uv); -- 2.39.5