]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Add dump_scrub_reservations to show scrub reserve tracking
authorDavid Zafman <dzafman@redhat.com>
Tue, 30 Jul 2019 20:43:05 +0000 (20:43 +0000)
committerDavid Zafman <dzafman@redhat.com>
Wed, 13 Nov 2019 23:01:56 +0000 (15:01 -0800)
Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit 8dffd68365dcd093795de118642c822e66dc939b)

PendingReleaseNotes
src/osd/OSD.cc
src/osd/OSD.h

index c60d9a07ceaa1167aa76e99bfd448d19c712ea3c..9b45056feb9bef6983486da3bc6919f30500d2a1 100644 (file)
@@ -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.
index 17d158b93e6ff94b0e62cef39eca92b7afe881b0..a9b29706fb37e4771fdfd229912218461bfb2e27 100644 (file)
@@ -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 "
index a57a7943c53a6099de64637ffe657d3dd34b4b4e..d513df73f4103e0997be084d475267cebf8f8e1a 100644 (file)
@@ -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);