From: Yingxin Cheng Date: Mon, 8 Jan 2024 06:25:20 +0000 (+0800) Subject: crimson/osd/osd_operations/client_request: cleanup shard_services X-Git-Tag: v19.1.0~438^2~3 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=c5157bb670c4c55d089dd1fb953a5faabd3480d2;p=ceph.git crimson/osd/osd_operations/client_request: cleanup shard_services Signed-off-by: Yingxin Cheng --- diff --git a/src/crimson/osd/osd_operations/client_request.cc b/src/crimson/osd/osd_operations/client_request.cc index 0936889e37e30..1611531fcd0b9 100644 --- a/src/crimson/osd/osd_operations/client_request.cc +++ b/src/crimson/osd/osd_operations/client_request.cc @@ -19,14 +19,13 @@ SET_SUBSYS(osd); namespace crimson::osd { -void ClientRequest::Orderer::requeue( - ShardServices &shard_services, Ref pg) +void ClientRequest::Orderer::requeue(Ref pg) { LOG_PREFIX(ClientRequest::Orderer::requeue); for (auto &req: list) { DEBUGDPP("requeueing {}", *pg, req); req.reset_instance_handle(); - std::ignore = req.with_pg_int(shard_services, pg); + std::ignore = req.with_pg_int(pg); } } @@ -47,9 +46,9 @@ void ClientRequest::complete_request() } ClientRequest::ClientRequest( - ShardServices &shard_services, crimson::net::ConnectionRef conn, + ShardServices &_shard_services, crimson::net::ConnectionRef conn, Ref &&m) - : put_historic_shard_services(&shard_services), + : shard_services(&_shard_services), conn(std::move(conn)), m(std::move(m)), instance_handle(new instance_handle_t) @@ -98,9 +97,10 @@ bool ClientRequest::is_pg_op() const [](auto& op) { return ceph_osd_op_type_pg(op.op.op); }); } -seastar::future<> ClientRequest::with_pg_int( - ShardServices &shard_services, Ref pgref) +seastar::future<> ClientRequest::with_pg_int(Ref pgref) { + ceph_assert_always(shard_services); + LOG_PREFIX(ClientRequest::with_pg_int); epoch_t same_interval_since = pgref->get_interval_start_epoch(); DEBUGDPP("{}: same_interval_since: {}", *pgref, *this, same_interval_since); @@ -112,11 +112,11 @@ seastar::future<> ClientRequest::with_pg_int( auto instance_handle = get_instance_handle(); auto &ihref = *instance_handle; return interruptor::with_interruption( - [FNAME, this, pgref, this_instance_id, &ihref, &shard_services]() mutable { + [FNAME, this, pgref, this_instance_id, &ihref]() mutable { DEBUGDPP("{} start", *pgref, *this); PG &pg = *pgref; if (pg.can_discard_op(*m)) { - return shard_services.send_incremental_map( + return shard_services->send_incremental_map( std::ref(*conn), m->get_map_epoch() ).then([FNAME, this, this_instance_id, pgref] { DEBUGDPP("{}: discarding {}", *pgref, *this, this_instance_id); @@ -179,14 +179,12 @@ seastar::future<> ClientRequest::with_pg_int( } seastar::future<> ClientRequest::with_pg( - ShardServices &shard_services, Ref pgref) + ShardServices &_shard_services, Ref pgref) { - put_historic_shard_services = &shard_services; + shard_services = &_shard_services; pgref->client_request_orderer.add_request(*this); auto ret = on_complete.get_future(); - std::ignore = with_pg_int( - shard_services, std::move(pgref) - ); + std::ignore = with_pg_int(std::move(pgref)); return ret; } @@ -417,8 +415,8 @@ bool ClientRequest::is_misdirected(const PG& pg) const void ClientRequest::put_historic() const { - ceph_assert_always(put_historic_shard_services); - put_historic_shard_services->get_registry().put_historic(*this); + ceph_assert_always(shard_services); + shard_services->get_registry().put_historic(*this); } const SnapContext ClientRequest::get_snapc( diff --git a/src/crimson/osd/osd_operations/client_request.h b/src/crimson/osd/osd_operations/client_request.h index 80645885a1412..b374aacbbe940 100644 --- a/src/crimson/osd/osd_operations/client_request.h +++ b/src/crimson/osd/osd_operations/client_request.h @@ -29,9 +29,8 @@ class ShardServices; class ClientRequest final : public PhasedOperationT, private CommonClientRequest { - // Initially set to primary core, updated to pg core after move, - // used by put_historic - ShardServices *put_historic_shard_services = nullptr; + // Initially set to primary core, updated to pg core after with_pg() + ShardServices *shard_services = nullptr; crimson::net::ConnectionRef conn; // must be after conn due to ConnectionPipeline's life-time @@ -199,7 +198,7 @@ public: list.erase(list_t::s_iterator_to(request)); intrusive_ptr_release(&request); } - void requeue(ShardServices &shard_services, Ref pg); + void requeue(Ref pg); void clear_and_cancel(PG &pg); }; void complete_request(); @@ -243,8 +242,7 @@ public: conn = make_local_shared_foreign(std::move(_conn)); } - seastar::future<> with_pg_int( - ShardServices &shard_services, Ref pg); + seastar::future<> with_pg_int(Ref pg); public: seastar::future<> with_pg( diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 0e16f6f118ba7..7638b2fcdbeb2 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -1523,7 +1523,7 @@ void PG::on_change(ceph::os::Transaction &t) { wait_for_active_blocker.unblock(); if (is_primary()) { logger().debug("{} {}: requeueing", *this, __func__); - client_request_orderer.requeue(shard_services, this); + client_request_orderer.requeue(this); } else { logger().debug("{} {}: dropping requests", *this, __func__); client_request_orderer.clear_and_cancel(*this);