]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/: Move PeeringCtx out of PeeringState to permit forward declaration
authorSamuel Just <sjust@redhat.com>
Thu, 30 May 2019 00:31:35 +0000 (17:31 -0700)
committerSamuel Just <sjust@redhat.com>
Thu, 30 May 2019 17:53:42 +0000 (10:53 -0700)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/OSD.cc
src/osd/OSD.h
src/osd/PG.cc
src/osd/PG.h
src/osd/PeeringState.h

index 4590d432ea223e8a0c146a4d65a9e0b3f56a5b32..6e20299efcb78418a797ee714a6a01ffc6483ca4 100644 (file)
@@ -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<PGRef>& pgs)
   dout(10) << __func__ << " " << pgs << dendl;
   if (is_stopping())
     return;
-  PG::PeeringCtx rctx = create_context();
+  PeeringCtx rctx = create_context();
   for (set<PGRef>::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<spg_t> &childpgids, set<PGRef> *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;
index cb6f4b87bf93aa85612b5d40617ee985470af6a5..b2a9df58e8e4653e98d7f0b87356eec74a9786cb 100644 (file)
@@ -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<spg_t> &childpgids, set<PGRef> *out_pgs,
     OSDMapRef curmap,
     OSDMapRef nextmap,
-    PG::PeeringCtx &rctx);
+    PeeringCtx &rctx);
   void _finish_splits(set<PGRef>& 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<int,
                       vector<pair<pg_notify_t, PastIntervals> > >&
                       notify_list,
index a44766b98acea28afca1ca7fa96981b125f8a948..430362792f982b4564c3c3b0abcc30eb3ac02d3b 100644 (file)
@@ -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.
index 83ab6b7d98539e870303f95f0662e6d984308f3d..16a94d4048a976c59cb3e1cd80154fdfdb911b8f 100644 (file)
@@ -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;
index 9d9a27cf05c7fa74f4431843e6b420c06131f5d1..d4e3ede42c357367386adbadaedff307cc4e5639 100644 (file)
@@ -54,6 +54,59 @@ struct PGPool {
   void update(CephContext *cct, OSDMapRef map);
 };
 
+// [primary only] content recovery state
+struct BufferedRecoveryMessages {
+  map<int, map<spg_t, pg_query_t> > query_map;
+  map<int, vector<pair<pg_notify_t, PastIntervals> > > info_map;
+  map<int, vector<pair<pg_notify_t, PastIntervals> > > notify_list;
+};
+
+struct PeeringCtx {
+  map<int, map<spg_t, pg_query_t> > query_map;
+  map<int, vector<pair<pg_notify_t, PastIntervals> > > info_map;
+  map<int, vector<pair<pg_notify_t, PastIntervals> > > notify_list;
+  ObjectStore::Transaction transaction;
+  HBHandle* handle = nullptr;
+
+  PeeringCtx() = default;
+
+  void reset_transaction() {
+    transaction = ObjectStore::Transaction();
+  }
+
+  void accept_buffered_messages(BufferedRecoveryMessages &m) {
+    for (map<int, map<spg_t, pg_query_t> >::iterator i = m.query_map.begin();
+        i != m.query_map.end();
+        ++i) {
+      map<spg_t, pg_query_t> &omap = query_map[i->first];
+      for (map<spg_t, pg_query_t>::iterator j = i->second.begin();
+          j != i->second.end();
+          ++j) {
+       omap[j->first] = j->second;
+      }
+    }
+    for (map<int, vector<pair<pg_notify_t, PastIntervals> > >::iterator i
+          = m.info_map.begin();
+        i != m.info_map.end();
+        ++i) {
+      vector<pair<pg_notify_t, PastIntervals> > &ovec =
+       info_map[i->first];
+      ovec.reserve(ovec.size() + i->second.size());
+      ovec.insert(ovec.end(), i->second.begin(), i->second.end());
+    }
+    for (map<int, vector<pair<pg_notify_t, PastIntervals> > >::iterator i
+          = m.notify_list.begin();
+        i != m.notify_list.end();
+        ++i) {
+      vector<pair<pg_notify_t, PastIntervals> > &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<int, map<spg_t, pg_query_t> > query_map;
-    map<int, vector<pair<pg_notify_t, PastIntervals> > > info_map;
-    map<int, vector<pair<pg_notify_t, PastIntervals> > > notify_list;
-  };
-
-  struct PeeringCtx {
-    map<int, map<spg_t, pg_query_t> > query_map;
-    map<int, vector<pair<pg_notify_t, PastIntervals> > > info_map;
-    map<int, vector<pair<pg_notify_t, PastIntervals> > > notify_list;
-    ObjectStore::Transaction transaction;
-    HBHandle* handle = nullptr;
-
-    PeeringCtx() = default;
-
-    void reset_transaction() {
-      transaction = ObjectStore::Transaction();
-    }
-
-    void accept_buffered_messages(BufferedRecoveryMessages &m) {
-      for (map<int, map<spg_t, pg_query_t> >::iterator i = m.query_map.begin();
-          i != m.query_map.end();
-          ++i) {
-       map<spg_t, pg_query_t> &omap = query_map[i->first];
-       for (map<spg_t, pg_query_t>::iterator j = i->second.begin();
-            j != i->second.end();
-            ++j) {
-         omap[j->first] = j->second;
-       }
-      }
-      for (map<int, vector<pair<pg_notify_t, PastIntervals> > >::iterator i
-            = m.info_map.begin();
-          i != m.info_map.end();
-          ++i) {
-       vector<pair<pg_notify_t, PastIntervals> > &ovec =
-         info_map[i->first];
-       ovec.reserve(ovec.size() + i->second.size());
-       ovec.insert(ovec.end(), i->second.begin(), i->second.end());
-      }
-      for (map<int, vector<pair<pg_notify_t, PastIntervals> > >::iterator i
-            = m.notify_list.begin();
-          i != m.notify_list.end();
-          ++i) {
-       vector<pair<pg_notify_t, PastIntervals> > &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