]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osdc: create explicit ms_fast_dispatch2 method
authorPatrick Donnelly <pdonnell@ibm.com>
Mon, 18 May 2026 13:59:58 +0000 (09:59 -0400)
committerPatrick Donnelly <pdonnell@ibm.com>
Mon, 18 May 2026 18:22:58 +0000 (14:22 -0400)
This extracts the fast dispatch logic into its own explicit method so
the code no longer misleads the reader into thinking fast dispatch is
not in use.

Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
src/osdc/Objecter.cc
src/osdc/Objecter.h

index 98acd1a49700ead7f91408b35f78b56d692725a1..a4675ee23486bd5d446e00caef05689ff03df3fb 100644 (file)
@@ -1050,7 +1050,7 @@ void Objecter::_do_watch_notify(boost::intrusive_ptr<LingerOp> info,
   info->finished_async();
 }
 
-Dispatcher::dispatch_result_t Objecter::ms_dispatch2(const MessageRef& m)
+void Objecter::ms_fast_dispatch2(const MessageRef& m)
 {
   ldout(cct, 10) << __func__ << " " << cct << " " << *m << dendl;
   switch (m->get_type()) {
@@ -1067,41 +1067,52 @@ Dispatcher::dispatch_result_t Objecter::ms_dispatch2(const MessageRef& m)
     } else {
       handle_osd_op_reply(ref_cast<MOSDOpReply>(m));
     }
-    return Dispatcher::HANDLED();
+    return;
   }
 
-  case CEPH_MSG_OSD_BACKOFF: {
+  case CEPH_MSG_WATCH_NOTIFY: {
     auto priv = m->get_connection()->get_priv();
     auto s = static_cast<OSDSession*>(priv.get());
     if (s) {
       s->track_enqueue(m);
       boost::asio::dispatch(s->strand, [this, priv, s, m]() {
-        cref_t<MOSDBackoff> msg = ref_cast<MOSDBackoff>(m);
+        cref_t<MWatchNotify> msg = ref_cast<MWatchNotify>(m);
         s->track_dequeue(m);
-        handle_osd_backoff(std::move(msg));
+        handle_watch_notify(std::move(msg));
       });
     } else {
-      handle_osd_backoff(ref_cast<MOSDBackoff>(m));
+      handle_watch_notify(ref_cast<MWatchNotify>(m));
     }
-    return Dispatcher::HANDLED();
+    return;
+  }
+  default: ceph_abort("should be unreachable"); break;
   }
+}
 
-  case CEPH_MSG_WATCH_NOTIFY: {
+Dispatcher::dispatch_result_t Objecter::ms_dispatch2(const MessageRef& m)
+{
+  ldout(cct, 10) << __func__ << " " << cct << " " << *m << dendl;
+  switch (m->get_type()) {
+  case CEPH_MSG_OSD_OPREPLY: ceph_abort("should be fast dispatched"); break;
+
+  case CEPH_MSG_OSD_BACKOFF: {
     auto priv = m->get_connection()->get_priv();
     auto s = static_cast<OSDSession*>(priv.get());
     if (s) {
       s->track_enqueue(m);
       boost::asio::dispatch(s->strand, [this, priv, s, m]() {
-        cref_t<MWatchNotify> msg = ref_cast<MWatchNotify>(m);
+        cref_t<MOSDBackoff> msg = ref_cast<MOSDBackoff>(m);
         s->track_dequeue(m);
-        handle_watch_notify(std::move(msg));
+        handle_osd_backoff(std::move(msg));
       });
     } else {
-      handle_watch_notify(ref_cast<MWatchNotify>(m));
+      handle_osd_backoff(ref_cast<MOSDBackoff>(m));
     }
     return Dispatcher::HANDLED();
   }
 
+  case CEPH_MSG_WATCH_NOTIFY: ceph_abort("should be fast dispatched"); break;
+
   case MSG_COMMAND_REPLY:
     if (m->get_source().type() == CEPH_ENTITY_TYPE_OSD) {
       auto priv = m->get_connection()->get_priv();
@@ -1145,8 +1156,9 @@ Dispatcher::dispatch_result_t Objecter::ms_dispatch2(const MessageRef& m)
     return Dispatcher::ACKNOWLEDGED();
 
   default:
-    return Dispatcher::UNHANDLED();
+    break;
   }
+  return Dispatcher::UNHANDLED();
 }
 
 void Objecter::_scan_requests(
index 6b26262cf16802e3813bde137d78d276ecde1a42..9f87e4ad0ef0b4b059b2ce8fbdb6d0c1480506a2 100644 (file)
@@ -2792,9 +2792,7 @@ private:
       return false;
     }
   }
-  void ms_fast_dispatch2(const MessageRef& m) override {
-    [[maybe_unused]] auto s = ms_dispatch2(m);
-  }
+  void ms_fast_dispatch2(const MessageRef& m) override;
 
   void handle_osd_op_reply(cref_t<MOSDOpReply> m);
   boost::system::error_code handle_osd_op_reply2(Op *op, const std::vector<OSDOp> &out_ops);