]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/: move check_full_transition to PeeringState
authorsjust@redhat.com <sjust@redhat.com>
Wed, 27 Mar 2019 18:24:41 +0000 (11:24 -0700)
committersjust@redhat.com <sjust@redhat.com>
Wed, 1 May 2019 18:22:13 +0000 (11:22 -0700)
Signed-off-by: sjust@redhat.com <sjust@redhat.com>
src/osd/PG.cc
src/osd/PG.h
src/osd/PeeringState.cc
src/osd/PeeringState.h

index dee66fd2d4d1ccb7947e6059cfc3d69ea4bf9bfa..4c30caead3a1b64b5ad266447c352019e1ba7c25 100644 (file)
@@ -5735,31 +5735,6 @@ void PG::fulfill_query(const MQuery& query, PeeringCtx *rctx)
   }
 }
 
-void PG::check_full_transition(OSDMapRef lastmap, OSDMapRef osdmap)
-{
-  bool changed = false;
-  if (osdmap->test_flag(CEPH_OSDMAP_FULL) &&
-      !lastmap->test_flag(CEPH_OSDMAP_FULL)) {
-    dout(10) << " cluster was marked full in " << osdmap->get_epoch() << dendl;
-    changed = true;
-  }
-  const pg_pool_t *pi = osdmap->get_pg_pool(info.pgid.pool());
-  if (!pi) {
-    return; // pool deleted
-  }
-  if (pi->has_flag(pg_pool_t::FLAG_FULL)) {
-    const pg_pool_t *opi = lastmap->get_pg_pool(info.pgid.pool());
-    if (!opi || !opi->has_flag(pg_pool_t::FLAG_FULL)) {
-      dout(10) << " pool was marked full in " << osdmap->get_epoch() << dendl;
-      changed = true;
-    }
-  }
-  if (changed) {
-    info.history.last_epoch_marked_full = osdmap->get_epoch();
-    dirty_info = true;
-  }
-}
-
 bool PG::should_restart_peering(
   int newupprimary,
   int newactingprimary,
index c89d6094746b970b6dd6e28d2fccd2adc9dc877d..a47d3db8ecd57f1a4a8156ca49cf4df7845d051e 100644 (file)
@@ -1678,7 +1678,6 @@ protected:
                    pair<pg_shard_t, pg_info_t> &notify_info);
   void fulfill_log(pg_shard_t from, const pg_query_t &query, epoch_t query_epoch);
   void fulfill_query(const MQuery& q, PeeringCtx *rctx);
-  void check_full_transition(OSDMapRef lastmap, OSDMapRef osdmap);
 
   bool should_restart_peering(
     int newupprimary,
index 564ae421b58be991cdcbe0d954cc601055be9d06..9ee0924e90c3faa761820f9f26b2569a612bb49e 100644 (file)
@@ -395,6 +395,33 @@ void PeeringState::complete_flush()
   }
 }
 
+void PeeringState::check_full_transition(OSDMapRef lastmap, OSDMapRef osdmap)
+{
+  bool changed = false;
+  if (osdmap->test_flag(CEPH_OSDMAP_FULL) &&
+      !lastmap->test_flag(CEPH_OSDMAP_FULL)) {
+    psdout(10) << " cluster was marked full in "
+              << osdmap->get_epoch() << dendl;
+    changed = true;
+  }
+  const pg_pool_t *pi = osdmap->get_pg_pool(info.pgid.pool());
+  if (!pi) {
+    return; // pool deleted
+  }
+  if (pi->has_flag(pg_pool_t::FLAG_FULL)) {
+    const pg_pool_t *opi = lastmap->get_pg_pool(info.pgid.pool());
+    if (!opi || !opi->has_flag(pg_pool_t::FLAG_FULL)) {
+      psdout(10) << " pool was marked full in " << osdmap->get_epoch() << dendl;
+      changed = true;
+    }
+  }
+  if (changed) {
+    info.history.last_epoch_marked_full = osdmap->get_epoch();
+    dirty_info = true;
+  }
+}
+
+
 /*------------ Peering State Machine----------------*/
 #undef dout_prefix
 #define dout_prefix (context< PeeringMachine >().dpp->gen_prefix(*_dout) \
@@ -474,7 +501,7 @@ boost::statechart::result PeeringState::Started::react(const AdvMap& advmap)
   PeeringState *ps = context< PeeringMachine >().state;
   PG *pg = context< PeeringMachine >().pg;
   psdout(10) << "Started advmap" << dendl;
-  pg->check_full_transition(advmap.lastmap, advmap.osdmap);
+  ps->check_full_transition(advmap.lastmap, advmap.osdmap);
   if (pg->should_restart_peering(
        advmap.up_primary,
        advmap.acting_primary,
@@ -534,7 +561,7 @@ boost::statechart::result PeeringState::Reset::react(const AdvMap& advmap)
   PG *pg = context< PeeringMachine >().pg;
   psdout(10) << "Reset advmap" << dendl;
 
-  pg->check_full_transition(advmap.lastmap, advmap.osdmap);
+  ps->check_full_transition(advmap.lastmap, advmap.osdmap);
 
   if (pg->should_restart_peering(
        advmap.up_primary,
index 0389c792cde5c52c6ee7979a6fcb0d009d24835d..9d8473057de6c83932df2bd810fafeaa4d3f5318 100644 (file)
@@ -1160,6 +1160,7 @@ public:
   void update_history(const pg_history_t& new_history);
   void check_recovery_sources(const OSDMapRef& map);
   void set_last_peering_reset();
+  void check_full_transition(OSDMapRef lastmap, OSDMapRef osdmap);
 
 public:
   PeeringState(