]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
PGStateUtils: improvements for PGStateHistory 27874/head
authorSamuel Just <sjust@redhat.com>
Thu, 25 Apr 2019 18:40:52 +0000 (11:40 -0700)
committersjust@redhat.com <sjust@redhat.com>
Wed, 1 May 2019 18:22:29 +0000 (11:22 -0700)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/PG.h
src/osd/PGStateUtils.cc
src/osd/PGStateUtils.h
src/osd/PeeringState.cc

index d9bea3b5fc3d3fd45e4dafd71bad8170d83fedcf..95fbae2b58df5794572d796e1c5c08d1cc35cbfe 100644 (file)
@@ -198,7 +198,7 @@ public:
     return recovery_state.get_osdmap();
   }
 
-  epoch_t get_osdmap_epoch() const override {
+  epoch_t get_osdmap_epoch() const override final {
     return recovery_state.get_osdmap()->get_epoch();
   }
 
index 035b0b8f9f0aa43250b685c3612757d46974f8e1..5ffc1f0f16b08e0f654bfd89dd3a61ecb002f440 100644 (file)
@@ -22,13 +22,13 @@ NamedState::~NamedState() {
 void PGStateHistory::enter(const utime_t entime, const char* state)
 {
   if (pi == nullptr) {
-    pi = std::unique_ptr<PGStateInstance>(new PGStateInstance);
+    pi = std::make_unique<PGStateInstance>();
   }
   pi->enter_state(entime, state);
 }
 
 void PGStateHistory::exit(const char* state) {
-  pi->setepoch(es->get_osdmap_epoch());
+  pi->setepoch(es.get_osdmap_epoch());
   pi->exit_state(ceph_clock_now());
   if (pi->empty()) {
     reset();
index 3c61d553f34584023f802070bf9a1d49599bfd75..732425cdc761209f9571e04960c3f03b0ad660dc 100644 (file)
@@ -62,7 +62,7 @@ struct PGStateInstance {
 
 class PGStateHistory {
 public:
-  PGStateHistory(EpochSource *es) : buffer(10), es(es) {}
+  PGStateHistory(const EpochSource &es) : buffer(10), es(es) {}
 
   void enter(const utime_t entime, const char* state);
 
@@ -83,5 +83,5 @@ public:
 private:
   std::unique_ptr<PGStateInstance> pi;
   boost::circular_buffer<std::unique_ptr<PGStateInstance>> buffer;
-  EpochSource *es;
+  const EpochSource &es;
 };
index 013ed49b3a79419f590341602cd6fbac58bc7e2b..79a07ab8b4aae46bc66e8757c0ebe1fc197b80a7 100644 (file)
@@ -119,7 +119,7 @@ PeeringState::PeeringState(
   OSDMapRef curmap,
   DoutPrefixProvider *dpp,
   PeeringListener *pl)
-  : state_history(pl),
+  : state_history(*pl),
     cct(cct),
     spgid(spgid),
     dpp(dpp),