From: Alex Ainscow Date: Thu, 5 Feb 2026 14:38:21 +0000 (+0000) Subject: osdc: Split the Objecter handle reply into more utilities X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d70e8b09826371a13ddbb3f25802c76b41df9d3b;p=ceph-ci.git osdc: Split the Objecter handle reply into more utilities 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 --- diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 15f6b74e9d2..bb465f1b3f7 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -3693,7 +3693,7 @@ int Objecter::take_linger_budget(LingerOp *info) return 1; } -bs::error_code Objecter::handle_osd_op_reply2(Op *op, vector &out_ops) { +bs::error_code Objecter::process_op_reply_handlers(Op *op, vector &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 &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) diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index 4b1d02cf9bc..aa9e7abe3b9 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -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 &out_ops); + void complete_op_reply(Op *op, boost::system::error_code handler_error, OSDSession *s, std::unique_lock &sl, int rc); static bool is_pg_changed( int oldprimary, const std::vector& 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 &out_ops); void handle_osd_backoff(class MOSDBackoff *m); void handle_watch_notify(class MWatchNotify *m); void handle_osd_map(class MOSDMap *m);