From: Samuel Just Date: Thu, 30 May 2019 00:31:35 +0000 (-0700) Subject: osd/: Move PeeringCtx out of PeeringState to permit forward declaration X-Git-Tag: v15.1.0~2580^2~23 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=3e776b524bb38bfcc82bb5f29f148ae1e21e9e8f;p=ceph-ci.git osd/: Move PeeringCtx out of PeeringState to permit forward declaration Signed-off-by: Samuel Just --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 4590d432ea2..6e20299efcb 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -4049,7 +4049,7 @@ PGRef OSD::handle_pg_create_info(const OSDMapRef& osdmap, return nullptr; } - PG::PeeringCtx rctx = create_context(); + PeeringCtx rctx = create_context(); OSDMapRef startmap = get_map(info->epoch); @@ -8008,7 +8008,7 @@ void OSD::_finish_splits(set& pgs) dout(10) << __func__ << " " << pgs << dendl; if (is_stopping()) return; - PG::PeeringCtx rctx = create_context(); + PeeringCtx rctx = create_context(); for (set::iterator i = pgs.begin(); i != pgs.end(); ++i) { @@ -8045,7 +8045,7 @@ bool OSD::advance_pg( epoch_t osd_epoch, PG *pg, ThreadPool::TPHandle &handle, - PG::PeeringCtx &rctx) + PeeringCtx &rctx) { if (osd_epoch <= pg->get_osdmap_epoch()) { return true; @@ -8481,7 +8481,7 @@ void OSD::split_pgs( const set &childpgids, set *out_pgs, OSDMapRef curmap, OSDMapRef nextmap, - PG::PeeringCtx &rctx) + PeeringCtx &rctx) { unsigned pg_num = nextmap->get_pg_num(parent->pg_id.pool()); parent->update_snap_mapper_bits(parent->get_pgid().get_split_bits(pg_num)); @@ -8629,12 +8629,12 @@ void OSD::handle_pg_create(OpRequestRef op) // ---------------------------------------- // peering and recovery -PG::PeeringCtx OSD::create_context() +PeeringCtx OSD::create_context() { - return PG::PeeringCtx(); + return PeeringCtx(); } -void OSD::dispatch_context_transaction(PG::PeeringCtx &ctx, PG *pg, +void OSD::dispatch_context_transaction(PeeringCtx &ctx, PG *pg, ThreadPool::TPHandle *handle) { if (!ctx.transaction.empty() || ctx.transaction.has_contexts()) { @@ -8646,7 +8646,7 @@ void OSD::dispatch_context_transaction(PG::PeeringCtx &ctx, PG *pg, } } -void OSD::dispatch_context(PG::PeeringCtx &ctx, PG *pg, OSDMapRef curmap, +void OSD::dispatch_context(PeeringCtx &ctx, PG *pg, OSDMapRef curmap, ThreadPool::TPHandle *handle) { if (!service.get_osdmap()->is_up(whoami)) { @@ -9132,7 +9132,7 @@ void OSD::do_recovery( << " on " << *pg << dendl; if (do_unfound) { - PG::PeeringCtx rctx = create_context(); + PeeringCtx rctx = create_context(); rctx.handle = &handle; pg->find_unfound(queued, rctx); dispatch_context(rctx, pg, pg->get_osdmap()); @@ -9308,7 +9308,7 @@ void OSD::dequeue_peering_evt( PGPeeringEventRef evt, ThreadPool::TPHandle& handle) { - PG::PeeringCtx rctx = create_context(); + PeeringCtx rctx = create_context(); auto curmap = sdata->get_osdmap(); bool need_up_thru = false; epoch_t same_interval_since = 0; diff --git a/src/osd/OSD.h b/src/osd/OSD.h index cb6f4b87bf9..b2a9df58e8e 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1700,7 +1700,7 @@ protected: epoch_t advance_to, PG *pg, ThreadPool::TPHandle &handle, - PG::PeeringCtx &rctx); + PeeringCtx &rctx); void consume_map(); void activate_map(); @@ -1793,7 +1793,7 @@ protected: const set &childpgids, set *out_pgs, OSDMapRef curmap, OSDMapRef nextmap, - PG::PeeringCtx &rctx); + PeeringCtx &rctx); void _finish_splits(set& pgs); // == monitor interaction == @@ -1855,12 +1855,12 @@ protected: } // -- generic pg peering -- - PG::PeeringCtx create_context(); - void dispatch_context(PG::PeeringCtx &ctx, PG *pg, OSDMapRef curmap, + PeeringCtx create_context(); + void dispatch_context(PeeringCtx &ctx, PG *pg, OSDMapRef curmap, ThreadPool::TPHandle *handle = NULL); - void dispatch_context_transaction(PG::PeeringCtx &ctx, PG *pg, + void dispatch_context_transaction(PeeringCtx &ctx, PG *pg, ThreadPool::TPHandle *handle = NULL); - void discard_context(PG::PeeringCtx &ctx); + void discard_context(PeeringCtx &ctx); void do_notifies(map > >& notify_list, diff --git a/src/osd/PG.cc b/src/osd/PG.cc index a44766b98ac..430362792f9 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1162,7 +1162,7 @@ void PG::read_state(ObjectStore *store) recovery_state.set_role(-1); } - PG::PeeringCtx rctx; + PeeringCtx rctx; handle_initialize(rctx); // note: we don't activate here because we know the OSD will advance maps // during boot. diff --git a/src/osd/PG.h b/src/osd/PG.h index 83ab6b7d985..16a94d4048a 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -176,8 +176,6 @@ public: const pg_shard_t pg_whoami; const spg_t pg_id; - using PeeringCtx = PeeringState::PeeringCtx; - public: // -- members -- const coll_t coll; diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index 9d9a27cf05c..d4e3ede42c3 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -54,6 +54,59 @@ struct PGPool { void update(CephContext *cct, OSDMapRef map); }; +// [primary only] content recovery state +struct BufferedRecoveryMessages { + map > query_map; + map > > info_map; + map > > notify_list; +}; + +struct PeeringCtx { + map > query_map; + map > > info_map; + map > > notify_list; + ObjectStore::Transaction transaction; + HBHandle* handle = nullptr; + + PeeringCtx() = default; + + void reset_transaction() { + transaction = ObjectStore::Transaction(); + } + + void accept_buffered_messages(BufferedRecoveryMessages &m) { + for (map >::iterator i = m.query_map.begin(); + i != m.query_map.end(); + ++i) { + map &omap = query_map[i->first]; + for (map::iterator j = i->second.begin(); + j != i->second.end(); + ++j) { + omap[j->first] = j->second; + } + } + for (map > >::iterator i + = m.info_map.begin(); + i != m.info_map.end(); + ++i) { + vector > &ovec = + info_map[i->first]; + ovec.reserve(ovec.size() + i->second.size()); + ovec.insert(ovec.end(), i->second.begin(), i->second.end()); + } + for (map > >::iterator i + = m.notify_list.begin(); + i != m.notify_list.end(); + ++i) { + vector > &ovec = + notify_list[i->first]; + ovec.reserve(ovec.size() + i->second.size()); + ovec.insert(ovec.end(), i->second.begin(), i->second.end()); + } + } +}; + + /* Encapsulates PG recovery process */ class PeeringState : public MissingLoc::MappingInfo { public: @@ -226,58 +279,6 @@ public: virtual ~PeeringListener() {} }; - // [primary only] content recovery state - struct BufferedRecoveryMessages { - map > query_map; - map > > info_map; - map > > notify_list; - }; - - struct PeeringCtx { - map > query_map; - map > > info_map; - map > > notify_list; - ObjectStore::Transaction transaction; - HBHandle* handle = nullptr; - - PeeringCtx() = default; - - void reset_transaction() { - transaction = ObjectStore::Transaction(); - } - - void accept_buffered_messages(BufferedRecoveryMessages &m) { - for (map >::iterator i = m.query_map.begin(); - i != m.query_map.end(); - ++i) { - map &omap = query_map[i->first]; - for (map::iterator j = i->second.begin(); - j != i->second.end(); - ++j) { - omap[j->first] = j->second; - } - } - for (map > >::iterator i - = m.info_map.begin(); - i != m.info_map.end(); - ++i) { - vector > &ovec = - info_map[i->first]; - ovec.reserve(ovec.size() + i->second.size()); - ovec.insert(ovec.end(), i->second.begin(), i->second.end()); - } - for (map > >::iterator i - = m.notify_list.begin(); - i != m.notify_list.end(); - ++i) { - vector > &ovec = - notify_list[i->first]; - ovec.reserve(ovec.size() + i->second.size()); - ovec.insert(ovec.end(), i->second.begin(), i->second.end()); - } - } - }; - private: /** * Wraps PeeringCtx to hide the difference between buffering messages to