From f7be82af335dd9e54b107b16d1beee63c05b428b Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Tue, 2 Apr 2019 16:43:31 -0700 Subject: [PATCH] PeeringState: rearrange and fix remaining pg->gen_prefix call Signed-off-by: Samuel Just --- src/osd/PeeringState.cc | 104 +++++++++++++++++++--------------------- 1 file changed, 50 insertions(+), 54 deletions(-) diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index f6bae3585a2..b466443d714 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -135,6 +135,55 @@ PeeringState::PeeringState( machine.initiate(); } +void PeeringState::start_handle(PeeringCtx *new_ctx) { + ceph_assert(!rctx); + ceph_assert(!orig_ctx); + orig_ctx = new_ctx; + if (new_ctx) { + if (messages_pending_flush) { + rctx = PeeringCtx(*messages_pending_flush, *new_ctx); + } else { + rctx = *new_ctx; + } + rctx->start_time = ceph_clock_now(); + } +} + +void PeeringState::begin_block_outgoing() { + ceph_assert(!messages_pending_flush); + ceph_assert(orig_ctx); + ceph_assert(rctx); + messages_pending_flush = BufferedRecoveryMessages(); + rctx = PeeringCtx(*messages_pending_flush, *orig_ctx); +} + +void PeeringState::clear_blocked_outgoing() { + ceph_assert(orig_ctx); + ceph_assert(rctx); + messages_pending_flush = boost::optional(); +} + +void PeeringState::end_block_outgoing() { + ceph_assert(messages_pending_flush); + ceph_assert(orig_ctx); + ceph_assert(rctx); + + rctx = PeeringCtx(*orig_ctx); + rctx->accept_buffered_messages(*messages_pending_flush); + messages_pending_flush = boost::optional(); +} + +void PeeringState::end_handle() { + if (rctx) { + utime_t dur = ceph_clock_now() - rctx->start_time; + machine.event_time += dur; + } + + machine.event_count++; + rctx = boost::optional(); + orig_ctx = NULL; +} + void PeeringState::check_recovery_sources(const OSDMapRef& osdmap) { /* @@ -5171,7 +5220,7 @@ void PeeringState::WaitUpThru::exit() /*----PeeringState::PeeringMachine Methods-----*/ #undef dout_prefix -#define dout_prefix pg->gen_prefix(*_dout) +#define dout_prefix dpp->gen_prefix(*_dout) void PeeringState::PeeringMachine::log_enter(const char *state_name) { @@ -5191,56 +5240,3 @@ void PeeringState::PeeringMachine::log_exit(const char *state_name, utime_t ente event_time = utime_t(); } - -/*---------------------------------------------------*/ -#undef dout_prefix -#define dout_prefix ((debug_pg ? debug_pg->gen_prefix(*_dout) : *_dout) << " PriorSet: ") - -void PeeringState::start_handle(PeeringCtx *new_ctx) { - ceph_assert(!rctx); - ceph_assert(!orig_ctx); - orig_ctx = new_ctx; - if (new_ctx) { - if (messages_pending_flush) { - rctx = PeeringCtx(*messages_pending_flush, *new_ctx); - } else { - rctx = *new_ctx; - } - rctx->start_time = ceph_clock_now(); - } -} - -void PeeringState::begin_block_outgoing() { - ceph_assert(!messages_pending_flush); - ceph_assert(orig_ctx); - ceph_assert(rctx); - messages_pending_flush = BufferedRecoveryMessages(); - rctx = PeeringCtx(*messages_pending_flush, *orig_ctx); -} - -void PeeringState::clear_blocked_outgoing() { - ceph_assert(orig_ctx); - ceph_assert(rctx); - messages_pending_flush = boost::optional(); -} - -void PeeringState::end_block_outgoing() { - ceph_assert(messages_pending_flush); - ceph_assert(orig_ctx); - ceph_assert(rctx); - - rctx = PeeringCtx(*orig_ctx); - rctx->accept_buffered_messages(*messages_pending_flush); - messages_pending_flush = boost::optional(); -} - -void PeeringState::end_handle() { - if (rctx) { - utime_t dur = ceph_clock_now() - rctx->start_time; - machine.event_time += dur; - } - - machine.event_count++; - rctx = boost::optional(); - orig_ctx = NULL; -}