]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osdc: Split the Objecter handle reply into more utilities
authorAlex Ainscow <aainscow@uk.ibm.com>
Thu, 5 Feb 2026 14:38:21 +0000 (14:38 +0000)
committerAlex Ainscow <aainscow@uk.ibm.com>
Fri, 6 Feb 2026 10:31:31 +0000 (10:31 +0000)
This was one big monolithic function which handled the entire reply message.

SplitOps needs to re-use parts of this function. The previous split ops
commit dealt with one split, but this adds another.

Also rename the functions to have a better name.

Signed-off-by: Alex Ainscow <aainscow@uk.ibm.com>
src/osdc/Objecter.cc
src/osdc/Objecter.h

index 15f6b74e9d2303be71340d7f7e3793313ce047a1..bb465f1b3f7b61a8e9f9c94da01cb7cd0a92b371 100644 (file)
@@ -3693,7 +3693,7 @@ int Objecter::take_linger_budget(LingerOp *info)
   return 1;
 }
 
-bs::error_code Objecter::handle_osd_op_reply2(Op *op, vector<OSDOp> &out_ops) {
+bs::error_code Objecter::process_op_reply_handlers(Op *op, vector<OSDOp> &out_ops) {
 
   ceph_assert(op->ops.size() == op->out_bl.size());
   ceph_assert(op->ops.size() == op->out_rval.size());
@@ -3846,8 +3846,6 @@ void Objecter::handle_osd_op_reply(MOSDOpReply *m)
     // have, but that is better than doing callbacks out of order.
   }
 
-  decltype(op->onfinish) onfinish;
-
   int rc = m->get_result();
 
   if (m->is_redirect_reply()) {
@@ -3943,24 +3941,31 @@ void Objecter::handle_osd_op_reply(MOSDOpReply *m)
                  << " != request ops " << op->ops
                  << " from " << m->get_source_inst() << dendl;
 
-  bs::error_code handler_error = handle_osd_op_reply2(op, out_ops);
+  bs::error_code handler_error = process_op_reply_handlers(op, out_ops);
+
+  logger->inc(l_osdc_op_reply);
+  logger->tinc(l_osdc_op_latency, ceph::coarse_mono_time::clock::now() - op->stamp);
+  logger->set(l_osdc_op_inflight, num_in_flight);
+
+  // This function unlocks sl.
+  complete_op_reply(op, handler_error, s, sl, rc);
+  m->put();
+}
+
+void Objecter::complete_op_reply(Op *op, bs::error_code handler_error, OSDSession *s, unique_lock<std::shared_mutex> &sl, int rc) {
 
   // NOTE: we assume that since we only request ONDISK ever we will
   // only ever get back one (type of) ack ever.
-
+  decltype(op->onfinish) onfinish;
   if (op->has_completion()) {
     num_in_flight--;
     onfinish = std::move(op->onfinish);
     op->onfinish = nullptr;
   }
-  logger->inc(l_osdc_op_reply);
-  logger->tinc(l_osdc_op_latency, ceph::coarse_mono_time::clock::now() - op->stamp);
-  logger->set(l_osdc_op_inflight, num_in_flight);
-
   /* get it before we call _finish_op() */
   auto completion_lock = s->get_lock(op->target.base_oid);
 
-  ldout(cct, 15) << "handle_osd_op_reply completed tid " << tid << dendl;
+  ldout(cct, 15) << "handle_osd_op_reply completed tid " << op->tid << dendl;
   _finish_op(op, 0);
 
   ldout(cct, 5) << num_in_flight << " in flight" << dendl;
@@ -3984,8 +3989,6 @@ void Objecter::handle_osd_op_reply(MOSDOpReply *m)
   if (completion_lock.mutex()) {
     completion_lock.unlock();
   }
-
-  m->put();
 }
 
 void Objecter::handle_osd_backoff(MOSDBackoff *m)
index 4b1d02cf9bce5d981ed16e7641a020159f1e6549..aa9e7abe3b97e9bb80526e05fcc37d9cf10d8304 100644 (file)
@@ -2578,6 +2578,8 @@ public:
   void _send_op_account(Op *op);
   void _cancel_linger_op(Op *op);
   void _finish_op(Op *op, int r);
+  boost::system::error_code process_op_reply_handlers(Op *op, std::vector<OSDOp> &out_ops);
+  void complete_op_reply(Op *op, boost::system::error_code handler_error, OSDSession *s, std::unique_lock<std::shared_mutex> &sl, int rc);
   static bool is_pg_changed(
     int oldprimary,
     const std::vector<int>& oldacting,
@@ -2783,7 +2785,6 @@ private:
   }
 
   void handle_osd_op_reply(class MOSDOpReply *m);
-  boost::system::error_code handle_osd_op_reply2(Op *op, std::vector<OSDOp> &out_ops);
   void handle_osd_backoff(class MOSDBackoff *m);
   void handle_watch_notify(class MWatchNotify *m);
   void handle_osd_map(class MOSDMap *m);