]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osdc: use cref for messages to helpers
authorPatrick Donnelly <pdonnell@ibm.com>
Mon, 18 May 2026 14:59:33 +0000 (10:59 -0400)
committerPatrick Donnelly <pdonnell@ibm.com>
Mon, 18 May 2026 18:25:40 +0000 (14:25 -0400)
These methods already expect a cref_t and this avoids another cast /
message reference bump.

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

index 788a084213924c48c70b66bb856eb0c297439066..287174694a5b55f18177f6ced73e2e37cfbe5978 100644 (file)
@@ -21,6 +21,14 @@ template<class T, class U>
 cref_t<T> ref_cast(const cref_t<U>& r) noexcept {
   return static_cast<const T*>(r.get());
 }
+template<class T, class U>
+cref_t<T> cref_cast(const ref_t<U>& r) noexcept {
+  return static_cast<const T*>(r.get());
+}
+template<class T, class U>
+cref_t<T> cref_cast(const cref_t<U>& r) noexcept {
+  return static_cast<const T*>(r.get());
+}
 template<class T, typename... Args>
 ceph::ref_t<T> make_ref(Args&&... args) {
   return {new T(std::forward<Args>(args)...), false};
index 03ab1ec433581b42ee7a3da4b1cbb2ac13204310..c751ff879cbd4832686106f9d58ce0c2189e4bb9 100644 (file)
@@ -1059,12 +1059,11 @@ void Objecter::ms_fast_dispatch2(const MessageRef& m)
     auto s = static_cast<OSDSession*>(priv.get());
     if (s) {
       s->track_enqueue(m, [this, priv, s, m]() {
-        cref_t<MOSDOpReply> msg = ref_cast<MOSDOpReply>(m);
         s->track_dequeue(m);
-        handle_osd_op_reply(std::move(msg));
+        handle_osd_op_reply(cref_cast<MOSDOpReply>(m));
       });
     } else {
-      handle_osd_op_reply(ref_cast<MOSDOpReply>(m));
+      handle_osd_op_reply(cref_cast<MOSDOpReply>(m));
     }
     return;
   }
@@ -1074,12 +1073,11 @@ void Objecter::ms_fast_dispatch2(const MessageRef& m)
     auto s = static_cast<OSDSession*>(priv.get());
     if (s) {
       s->track_enqueue(m, [this, priv, s, m]() {
-        cref_t<MWatchNotify> msg = ref_cast<MWatchNotify>(m);
         s->track_dequeue(m);
-        handle_watch_notify(std::move(msg));
+        handle_watch_notify(cref_cast<MWatchNotify>(m));
       });
     } else {
-      handle_watch_notify(ref_cast<MWatchNotify>(m));
+      handle_watch_notify(cref_cast<MWatchNotify>(m));
     }
     return;
   }
@@ -1098,12 +1096,11 @@ Dispatcher::dispatch_result_t Objecter::ms_dispatch2(const MessageRef& m)
     auto s = static_cast<OSDSession*>(priv.get());
     if (s) {
       s->track_enqueue(m, [this, priv, s, m]() {
-        cref_t<MOSDBackoff> msg = ref_cast<MOSDBackoff>(m);
         s->track_dequeue(m);
-        handle_osd_backoff(std::move(msg));
+        handle_osd_backoff(cref_cast<MOSDBackoff>(m));
       });
     } else {
-      handle_osd_backoff(ref_cast<MOSDBackoff>(m));
+      handle_osd_backoff(cref_cast<MOSDBackoff>(m));
     }
     return Dispatcher::HANDLED();
   }
@@ -1116,12 +1113,11 @@ Dispatcher::dispatch_result_t Objecter::ms_dispatch2(const MessageRef& m)
       auto s = static_cast<OSDSession*>(priv.get());
       if (s) {
         s->track_enqueue(m, [this, priv, s, m]() {
-          cref_t<MCommandReply> msg = ref_cast<MCommandReply>(m);
           s->track_dequeue(m);
-          handle_command_reply(std::move(msg));
+          handle_command_reply(cref_cast<MCommandReply>(m));
         });
       } else {
-        handle_command_reply(ref_cast<MCommandReply>(m));
+        handle_command_reply(cref_cast<MCommandReply>(m));
       }
       return Dispatcher::HANDLED();
     } else {