From cf5cd222ce2bb78651c0ab8174d0db40a11dfd83 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 5 Dec 2017 21:34:58 -0600 Subject: [PATCH] osd: fast dispatch backfill and recovery reservation events Signed-off-by: Sage Weil --- src/osd/OSD.cc | 51 +++++++++++++++----------------------------------- src/osd/OSD.h | 5 ++--- 2 files changed, 17 insertions(+), 39 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 63201090808..d0b06a9d48b 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -105,6 +105,8 @@ #include "messages/MOSDPGUpdateLogMissing.h" #include "messages/MOSDPGUpdateLogMissingReply.h" +#include "messages/MOSDPeeringOp.h" + #include "messages/MOSDAlive.h" #include "messages/MOSDScrub.h" @@ -6548,6 +6550,19 @@ void OSD::ms_fast_dispatch(Message *m) m->put(); return; } + + // peering event? + switch (m->get_type()) { + case MSG_OSD_BACKFILL_RESERVE: + case MSG_OSD_RECOVERY_RESERVE: + { + MOSDPeeringOp *pm = static_cast(m); + return enqueue_peering_evt( + pm->get_spg(), + PGPeeringEventRef(pm->get_event())); + } + } + OpRequestRef op = op_tracker.create_request(m); { #ifdef WITH_LTTNG @@ -6753,12 +6768,6 @@ void OSD::dispatch_op(OpRequestRef op) case MSG_OSD_PG_TRIM: handle_pg_trim(op); break; - case MSG_OSD_BACKFILL_RESERVE: - handle_pg_backfill_reserve(op); - break; - case MSG_OSD_RECOVERY_RESERVE: - handle_pg_recovery_reserve(op); - break; } } @@ -8604,36 +8613,6 @@ void OSD::handle_pg_trim(OpRequestRef op) pg->unlock(); } -void OSD::handle_pg_backfill_reserve(OpRequestRef op) -{ - MBackfillReserve *m = static_cast(op->get_nonconst_req()); - assert(m->get_type() == MSG_OSD_BACKFILL_RESERVE); - - if (!require_osd_peer(op->get_req())) - return; - if (!require_same_or_newer_map(op, m->query_epoch, false)) - return; - - PGPeeringEventRef evt(m->get_event()); - - enqueue_peering_evt(m->pgid, evt); -} - -void OSD::handle_pg_recovery_reserve(OpRequestRef op) -{ - MRecoveryReserve *m = static_cast(op->get_nonconst_req()); - assert(m->get_type() == MSG_OSD_RECOVERY_RESERVE); - - if (!require_osd_peer(op->get_req())) - return; - if (!require_same_or_newer_map(op, m->query_epoch, false)) - return; - - PGPeeringEventRef evt(m->get_event()); - - enqueue_peering_evt(m->pgid, evt); -} - void OSD::handle_force_recovery(Message *m) { MOSDForceRecovery *msg = static_cast(m); diff --git a/src/osd/OSD.h b/src/osd/OSD.h index f8107a59355..7d074924dc9 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -2015,9 +2015,6 @@ protected: void handle_pg_info(OpRequestRef op); void handle_pg_trim(OpRequestRef op); - void handle_pg_backfill_reserve(OpRequestRef op); - void handle_pg_recovery_reserve(OpRequestRef op); - void handle_force_recovery(Message *m); void handle_pg_remove(OpRequestRef op); @@ -2100,6 +2097,8 @@ private: switch (m->get_type()) { case CEPH_MSG_OSD_OP: case CEPH_MSG_OSD_BACKOFF: + case MSG_OSD_BACKFILL_RESERVE: + case MSG_OSD_RECOVERY_RESERVE: case MSG_OSD_REPOP: case MSG_OSD_REPOPREPLY: case MSG_OSD_PG_PUSH: -- 2.39.5