From: David Zafman Date: Tue, 30 Jul 2019 20:43:05 +0000 (+0000) Subject: osd: Add dump_scrub_reservations to show scrub reserve tracking X-Git-Tag: v14.2.5~29^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=a8438a4b52fe1c914d5e74bf965fef1d6b66ea29;p=ceph.git osd: Add dump_scrub_reservations to show scrub reserve tracking Signed-off-by: David Zafman (cherry picked from commit 8dffd68365dcd093795de118642c822e66dc939b) --- diff --git a/PendingReleaseNotes b/PendingReleaseNotes index c60d9a07ceaa1..9b45056feb9be 100644 --- a/PendingReleaseNotes +++ b/PendingReleaseNotes @@ -43,3 +43,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 17d158b93e6ff..a9b29706fb37e 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1423,6 +1423,14 @@ void OSDService::dec_scrubs_active() sched_scrub_lock.Unlock(); } +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 { @@ -2632,6 +2640,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") { @@ -3461,6 +3473,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 a57a7943c53a6..d513df73f4103 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -514,6 +514,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);