]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: move peering event type out of PG class
authorSage Weil <sage@redhat.com>
Wed, 6 Dec 2017 02:13:48 +0000 (20:13 -0600)
committerSage Weil <sage@redhat.com>
Tue, 3 Apr 2018 15:12:35 +0000 (10:12 -0500)
We will create these directly from peering Messages shortly.

Signed-off-by: Sage Weil <sage@redhat.com>
src/CMakeLists.txt
src/osd/OSD.cc
src/osd/PG.cc
src/osd/PG.h
src/osd/PGPeeringEvent.cc [new file with mode: 0644]
src/osd/PGPeeringEvent.h

index 73a3cc4356431bb4f13896778b04518c6e8446c8..d0a2d9e66d6c0f96e2d0e73dd249c4397bbd3b7f 100644 (file)
@@ -483,6 +483,7 @@ set(libcommon_files
   osd/OSDMapMapping.cc
   common/histogram.cc
   osd/osd_types.cc
+  osd/PGPeeringEvent.cc
   osd/OpRequest.cc
   common/blkdev.cc
   common/common_init.cc
index 73921cfbc3515308b1e3e84e62b93ed9f8507a2c..961289932e1219968f7c3491e2efe5c2fe07f95a 100644 (file)
@@ -8518,7 +8518,7 @@ void OSD::handle_pg_notify(OpRequestRef op)
       PGPeeringEventRef(
        new PGPeeringEvent(
          it->first.epoch_sent, it->first.query_epoch,
-         PG::MNotifyRec(pg_shard_t(from, it->first.from), it->first,
+         MNotifyRec(pg_shard_t(from, it->first.from), it->first,
           op->get_req()->get_connection()->get_features())))
       );
   }
@@ -8544,7 +8544,7 @@ void OSD::handle_pg_log(OpRequestRef op)
     PGPeeringEventRef(
       new PGPeeringEvent(
        m->get_epoch(), m->get_query_epoch(),
-       PG::MLogRec(pg_shard_t(from, m->from), m)))
+       MLogRec(pg_shard_t(from, m->from), m)))
     );
 }
 
@@ -8572,7 +8572,7 @@ void OSD::handle_pg_info(OpRequestRef op)
       PGPeeringEventRef(
        new PGPeeringEvent(
          p->first.epoch_sent, p->first.query_epoch,
-         PG::MInfoRec(
+         MInfoRec(
            pg_shard_t(
              from, p->first.from), p->first.info, p->first.epoch_sent)))
       );
@@ -8620,13 +8620,13 @@ void OSD::handle_pg_backfill_reserve(OpRequestRef op)
       new PGPeeringEvent(
        m->query_epoch,
        m->query_epoch,
-       PG::RequestBackfillPrio(m->priority)));
+       RequestBackfillPrio(m->priority)));
   } else if (m->type == MBackfillReserve::GRANT) {
     evt = PGPeeringEventRef(
       new PGPeeringEvent(
        m->query_epoch,
        m->query_epoch,
-       PG::RemoteBackfillReserved()));
+       RemoteBackfillReserved()));
   } else if (m->type == MBackfillReserve::REJECT) {
     // NOTE: this is replica -> primary "i reject your request"
     //      and also primary -> replica "cancel my previously-granted request"
@@ -8637,25 +8637,25 @@ void OSD::handle_pg_backfill_reserve(OpRequestRef op)
       new PGPeeringEvent(
        m->query_epoch,
        m->query_epoch,
-       PG::RemoteReservationRejected()));
+       RemoteReservationRejected()));
   } else if (m->type == MBackfillReserve::RELEASE) {
     evt = PGPeeringEventRef(
       new PGPeeringEvent(
        m->query_epoch,
        m->query_epoch,
-       PG::RemoteReservationCanceled()));
+       RemoteReservationCanceled()));
   } else if (m->type == MBackfillReserve::TOOFULL) {
     evt = PGPeeringEventRef(
       new PGPeeringEvent(
        m->query_epoch,
        m->query_epoch,
-       PG::RemoteReservationRevokedTooFull()));
+       RemoteReservationRevokedTooFull()));
   } else if (m->type == MBackfillReserve::REVOKE) {
     evt = PGPeeringEventRef(
       new PGPeeringEvent(
        m->query_epoch,
        m->query_epoch,
-       PG::RemoteReservationRevoked()));
+       RemoteReservationRevoked()));
   } else {
     ceph_abort();
   }
@@ -8679,25 +8679,25 @@ void OSD::handle_pg_recovery_reserve(OpRequestRef op)
       new PGPeeringEvent(
        m->query_epoch,
        m->query_epoch,
-       PG::RequestRecoveryPrio(m->priority)));
+       RequestRecoveryPrio(m->priority)));
   } else if (m->type == MRecoveryReserve::GRANT) {
     evt = PGPeeringEventRef(
       new PGPeeringEvent(
        m->query_epoch,
        m->query_epoch,
-       PG::RemoteRecoveryReserved()));
+       RemoteRecoveryReserved()));
   } else if (m->type == MRecoveryReserve::RELEASE) {
     evt = PGPeeringEventRef(
       new PGPeeringEvent(
        m->query_epoch,
        m->query_epoch,
-       PG::RecoveryDone()));
+       RecoveryDone()));
   } else if (m->type == MRecoveryReserve::REVOKE) {
     evt = PGPeeringEventRef(
       new PGPeeringEvent(
        m->query_epoch,
        m->query_epoch,
-       PG::DeferRecovery(0.0)));
+       DeferRecovery(0.0)));
   } else {
     ceph_abort();
   }
@@ -8767,7 +8767,7 @@ void OSD::handle_pg_query(OpRequestRef op)
        PGPeeringEventRef(
          new PGPeeringEvent(
            it->second.epoch_sent, it->second.epoch_sent,
-           PG::MQuery(pg_shard_t(from, it->second.from),
+           MQuery(pg_shard_t(from, it->second.from),
                       it->second, it->second.epoch_sent))));
       continue;
     }
index 787449b14b8600a1f049296c279e79a3ecc90c3f..5a4adc350ccf9dae9a15d60f79d2f08c60f31bb1 100644 (file)
@@ -90,8 +90,6 @@ static ostream& _prefix(std::ostream *_dout, T *t)
   return *_dout << t->gen_prefix();
 }
 
-MEMPOOL_DEFINE_OBJECT_FACTORY(PGPeeringEvent, pg_peering_evt, osd);
-
 void PGStateHistory::enter(PG* pg, const utime_t entime, const char* state)
 {
   // Ignore trimming state machine for now
index f8d63079b01aedf52545dc0cbe574cc65d217e7b..4cb8637db6a102ec51778af7409277fa549c104b 100644 (file)
@@ -1803,49 +1803,6 @@ protected:
   };
 
 public:
-  struct MInfoRec : boost::statechart::event< MInfoRec > {
-    pg_shard_t from;
-    pg_info_t info;
-    epoch_t msg_epoch;
-    MInfoRec(pg_shard_t from, const pg_info_t &info, epoch_t msg_epoch) :
-      from(from), info(info), msg_epoch(msg_epoch) {}
-    void print(std::ostream *out) const {
-      *out << "MInfoRec from " << from << " info: " << info;
-    }
-  };
-  struct MLogRec : boost::statechart::event< MLogRec > {
-    pg_shard_t from;
-    boost::intrusive_ptr<MOSDPGLog> msg;
-    MLogRec(pg_shard_t from, MOSDPGLog *msg) :
-      from(from), msg(msg) {}
-    void print(std::ostream *out) const {
-      *out << "MLogRec from " << from;
-    }
-  };
-
-  struct MNotifyRec : boost::statechart::event< MNotifyRec > {
-    pg_shard_t from;
-    pg_notify_t notify;
-    uint64_t features;
-    MNotifyRec(pg_shard_t from, const pg_notify_t &notify, uint64_t f) :
-      from(from), notify(notify), features(f) {}
-    void print(std::ostream *out) const {
-      *out << "MNotifyRec from " << from << " notify: " << notify
-        << " features: 0x" << hex << features << dec;
-    }
-  };
-  struct MQuery : boost::statechart::event< MQuery > {
-    pg_shard_t from;
-    pg_query_t query;
-    epoch_t query_epoch;
-    MQuery(pg_shard_t from, const pg_query_t &query, epoch_t query_epoch):
-      from(from), query(query), query_epoch(query_epoch) {}
-    void print(std::ostream *out) const {
-      *out << "MQuery from " << from
-          << " query_epoch " << query_epoch
-          << " query: " << query;
-    }
-  };
 protected:
 
   struct AdvMap : boost::statechart::event< AdvMap > {
@@ -1882,44 +1839,6 @@ protected:
     }
   };
 public:
-  struct RequestBackfillPrio : boost::statechart::event< RequestBackfillPrio > {
-    unsigned priority;
-    explicit RequestBackfillPrio(unsigned prio) :
-              boost::statechart::event< RequestBackfillPrio >(),
-                         priority(prio) {}
-    void print(std::ostream *out) const {
-      *out << "RequestBackfillPrio: priority " << priority;
-    }
-  };
-  struct RequestRecoveryPrio : boost::statechart::event< RequestRecoveryPrio > {
-    unsigned priority;
-    explicit RequestRecoveryPrio(unsigned prio) :
-              boost::statechart::event< RequestRecoveryPrio >(),
-                         priority(prio) {}
-    void print(std::ostream *out) const {
-      *out << "RequestRecoveryPrio: priority " << priority;
-    }
-  };
-#define TrivialEvent(T) struct T : boost::statechart::event< T > { \
-    T() : boost::statechart::event< T >() {}                      \
-    void print(std::ostream *out) const {                         \
-      *out << #T;                                                 \
-    }                                                             \
-  };
-  struct DeferBackfill : boost::statechart::event<DeferBackfill> {
-    float delay;
-    explicit DeferBackfill(float delay) : delay(delay) {}
-    void print(std::ostream *out) const {
-      *out << "DeferBackfill: delay " << delay;
-    }
-  };
-  struct DeferRecovery : boost::statechart::event<DeferRecovery> {
-    float delay;
-    explicit DeferRecovery(float delay) : delay(delay) {}
-    void print(std::ostream *out) const {
-      *out << "DeferRecovery: delay " << delay;
-    }
-  };
   struct UnfoundBackfill : boost::statechart::event<UnfoundBackfill> {
     explicit UnfoundBackfill() {}
     void print(std::ostream *out) const {
@@ -1942,17 +1861,9 @@ protected:
   protected:
   TrivialEvent(Backfilled)
   TrivialEvent(LocalBackfillReserved)
-  public:
-  TrivialEvent(RemoteBackfillReserved)
-  protected:
   TrivialEvent(RejectRemoteReservation)
   public:
-  TrivialEvent(RemoteReservationRejected)
-  TrivialEvent(RemoteReservationRevokedTooFull)
-  TrivialEvent(RemoteReservationRevoked)
-  TrivialEvent(RemoteReservationCanceled)
   TrivialEvent(RequestBackfill)
-  TrivialEvent(RecoveryDone)
   protected:
   TrivialEvent(RemoteRecoveryPreempted)
   TrivialEvent(RemoteBackfillPreempted)
@@ -1969,7 +1880,6 @@ protected:
   TrivialEvent(DoRecovery)
   TrivialEvent(LocalRecoveryReserved)
   public:
-  TrivialEvent(RemoteRecoveryReserved)
   protected:
   TrivialEvent(AllRemotesReserved)
   TrivialEvent(AllBackfillsReserved)
diff --git a/src/osd/PGPeeringEvent.cc b/src/osd/PGPeeringEvent.cc
new file mode 100644 (file)
index 0000000..52aff7d
--- /dev/null
@@ -0,0 +1,8 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include "include/mempool.h"
+#include "osd/PGPeeringEvent.h"
+#include "messages/MOSDPGLog.h"
+
+MEMPOOL_DEFINE_OBJECT_FACTORY(PGPeeringEvent, pg_peering_evt, osd);
index f328a7d81bf48a6a47aac84dcc76d60aeff08956..9234838ece8445cf112101296470937fa51ee659 100644 (file)
@@ -5,6 +5,10 @@
 
 #include <boost/statechart/event.hpp>
 
+#include "osd/osd_types.h"
+
+class MOSDPGLog;
+
 class PGPeeringEvent {
   epoch_t epoch_sent;
   epoch_t epoch_requested;
@@ -40,3 +44,100 @@ public:
   }
 };
 typedef ceph::shared_ptr<PGPeeringEvent> PGPeeringEventRef;
+
+struct MInfoRec : boost::statechart::event< MInfoRec > {
+  pg_shard_t from;
+  pg_info_t info;
+  epoch_t msg_epoch;
+  MInfoRec(pg_shard_t from, const pg_info_t &info, epoch_t msg_epoch) :
+    from(from), info(info), msg_epoch(msg_epoch) {}
+  void print(std::ostream *out) const {
+    *out << "MInfoRec from " << from << " info: " << info;
+  }
+};
+
+struct MLogRec : boost::statechart::event< MLogRec > {
+  pg_shard_t from;
+  boost::intrusive_ptr<MOSDPGLog> msg;
+  MLogRec(pg_shard_t from, MOSDPGLog *msg) :
+    from(from), msg(msg) {}
+  void print(std::ostream *out) const {
+    *out << "MLogRec from " << from;
+  }
+};
+
+struct MNotifyRec : boost::statechart::event< MNotifyRec > {
+  pg_shard_t from;
+  pg_notify_t notify;
+  uint64_t features;
+  MNotifyRec(pg_shard_t from, const pg_notify_t &notify, uint64_t f) :
+    from(from), notify(notify), features(f) {}
+  void print(std::ostream *out) const {
+    *out << "MNotifyRec from " << from << " notify: " << notify
+        << " features: 0x" << hex << features << dec;
+  }
+};
+
+struct MQuery : boost::statechart::event< MQuery > {
+  pg_shard_t from;
+  pg_query_t query;
+  epoch_t query_epoch;
+  MQuery(pg_shard_t from, const pg_query_t &query, epoch_t query_epoch):
+    from(from), query(query), query_epoch(query_epoch) {}
+  void print(std::ostream *out) const {
+    *out << "MQuery from " << from
+        << " query_epoch " << query_epoch
+        << " query: " << query;
+  }
+};
+
+struct RequestBackfillPrio : boost::statechart::event< RequestBackfillPrio > {
+  unsigned priority;
+  explicit RequestBackfillPrio(unsigned prio) :
+    boost::statechart::event< RequestBackfillPrio >(),
+    priority(prio) {}
+  void print(std::ostream *out) const {
+    *out << "RequestBackfillPrio: priority " << priority;
+  }
+};
+
+struct RequestRecoveryPrio : boost::statechart::event< RequestRecoveryPrio > {
+  unsigned priority;
+  explicit RequestRecoveryPrio(unsigned prio) :
+    boost::statechart::event< RequestRecoveryPrio >(),
+    priority(prio) {}
+  void print(std::ostream *out) const {
+    *out << "RequestRecoveryPrio: priority " << priority;
+  }
+};
+
+#define TrivialEvent(T) struct T : boost::statechart::event< T > { \
+    T() : boost::statechart::event< T >() {}                      \
+    void print(std::ostream *out) const {                         \
+      *out << #T;                                                 \
+    }                                                             \
+  };
+
+TrivialEvent(RemoteBackfillReserved)
+TrivialEvent(RemoteReservationRejected)
+TrivialEvent(RemoteReservationRevokedTooFull)
+TrivialEvent(RemoteReservationRevoked)
+TrivialEvent(RemoteReservationCanceled)
+TrivialEvent(RemoteRecoveryReserved)
+TrivialEvent(RecoveryDone)
+
+struct DeferRecovery : boost::statechart::event<DeferRecovery> {
+  float delay;
+  explicit DeferRecovery(float delay) : delay(delay) {}
+  void print(std::ostream *out) const {
+    *out << "DeferRecovery: delay " << delay;
+  }
+};
+
+struct DeferBackfill : boost::statechart::event<DeferBackfill> {
+  float delay;
+  explicit DeferBackfill(float delay) : delay(delay) {}
+  void print(std::ostream *out) const {
+    *out << "DeferBackfill: delay " << delay;
+  }
+};