diff options
author | sjust@redhat.com <sjust@redhat.com> | 2019-03-27 23:18:24 +0100 |
---|---|---|
committer | sjust@redhat.com <sjust@redhat.com> | 2019-05-01 20:22:20 +0200 |
commit | 74329bc8f3f8551e1a2afde73d87f2fde27b8855 (patch) | |
tree | 11ae342a148c2c13ca77744af77bb076506d0458 /src | |
parent | osd/: move io reservation machinery into PeeringState (diff) | |
download | ceph-74329bc8f3f8551e1a2afde73d87f2fde27b8855.tar.xz ceph-74329bc8f3f8551e1a2afde73d87f2fde27b8855.zip |
PeeringState: clean up references in Primary, Start, Reset
Signed-off-by: Samuel Just <sjust@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/osd/PeeringState.cc | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index 0571ffb8d73..8c67af3c97e 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -1112,16 +1112,15 @@ boost::statechart::result PeeringState::Reset::react(const AdvMap& advmap) boost::statechart::result PeeringState::Reset::react(const ActMap&) { PeeringState *ps = context< PeeringMachine >().state; - PG *pg = context< PeeringMachine >().pg; - if (pg->should_send_notify() && pg->get_primary().osd >= 0) { + if (ps->should_send_notify() && ps->get_primary().osd >= 0) { context< PeeringMachine >().send_notify( - pg->get_primary(), + ps->get_primary(), pg_notify_t( - pg->get_primary().shard, pg->pg_whoami.shard, - pg->get_osdmap_epoch(), - pg->get_osdmap_epoch(), - pg->info), - pg->past_intervals); + ps->get_primary().shard, ps->pg_whoami.shard, + ps->get_osdmap_epoch(), + ps->get_osdmap_epoch(), + ps->info), + ps->past_intervals); } ps->update_heartbeat_peers(); @@ -1153,8 +1152,8 @@ PeeringState::Start::Start(my_context ctx) { context< PeeringMachine >().log_enter(state_name); - PG *pg = context< PeeringMachine >().pg; - if (pg->is_primary()) { + PeeringState *ps = context< PeeringMachine >().state; + if (ps->is_primary()) { psdout(1) << "transitioning to Primary" << dendl; post_event(MakePrimary()); } else { //is_stray @@ -1177,26 +1176,26 @@ PeeringState::Primary::Primary(my_context ctx) NamedState(context< PeeringMachine >().state_history, "Started/Primary") { context< PeeringMachine >().log_enter(state_name); - PG *pg = context< PeeringMachine >().pg; - ceph_assert(pg->want_acting.empty()); + PeeringState *ps = context< PeeringMachine >().state; + ceph_assert(ps->want_acting.empty()); // set CREATING bit until we have peered for the first time. - if (pg->info.history.last_epoch_started == 0) { - pg->state_set(PG_STATE_CREATING); + if (ps->info.history.last_epoch_started == 0) { + ps->state_set(PG_STATE_CREATING); // use the history timestamp, which ultimately comes from the // monitor in the create case. - utime_t t = pg->info.history.last_scrub_stamp; - pg->info.stats.last_fresh = t; - pg->info.stats.last_active = t; - pg->info.stats.last_change = t; - pg->info.stats.last_peered = t; - pg->info.stats.last_clean = t; - pg->info.stats.last_unstale = t; - pg->info.stats.last_undegraded = t; - pg->info.stats.last_fullsized = t; - pg->info.stats.last_scrub_stamp = t; - pg->info.stats.last_deep_scrub_stamp = t; - pg->info.stats.last_clean_scrub_stamp = t; + utime_t t = ps->info.history.last_scrub_stamp; + ps->info.stats.last_fresh = t; + ps->info.stats.last_active = t; + ps->info.stats.last_change = t; + ps->info.stats.last_peered = t; + ps->info.stats.last_clean = t; + ps->info.stats.last_unstale = t; + ps->info.stats.last_undegraded = t; + ps->info.stats.last_fullsized = t; + ps->info.stats.last_scrub_stamp = t; + ps->info.stats.last_deep_scrub_stamp = t; + ps->info.stats.last_clean_scrub_stamp = t; } } @@ -1211,9 +1210,9 @@ boost::statechart::result PeeringState::Primary::react(const MNotifyRec& notevt) boost::statechart::result PeeringState::Primary::react(const ActMap&) { - PG *pg = context< PeeringMachine >().pg; + PeeringListener *pl = context< PeeringMachine >().pl; psdout(7) << "handle ActMap primary" << dendl; - pg->publish_stats_to_osd(); + pl->publish_stats_to_osd(); return discard_event(); } @@ -1264,13 +1263,13 @@ boost::statechart::result PeeringState::Primary::react( void PeeringState::Primary::exit() { context< PeeringMachine >().log_exit(state_name, enter_time); + PeeringState *ps = context< PeeringMachine >().state; PeeringListener *pl = context< PeeringMachine >().pl; - PG *pg = context< PeeringMachine >().pg; - pg->want_acting.clear(); + ps->want_acting.clear(); utime_t dur = ceph_clock_now() - enter_time; pl->get_peering_perf().tinc(rs_primary_latency, dur); pl->clear_primary_state(); - pg->state_clear(PG_STATE_CREATING); + ps->state_clear(PG_STATE_CREATING); } /*---------Peering--------*/ |