]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: OSDShard::pg_slot -> OSDShardPGSlot
authorSage Weil <sage@redhat.com>
Fri, 9 Feb 2018 20:42:25 +0000 (14:42 -0600)
committerSage Weil <sage@redhat.com>
Wed, 4 Apr 2018 13:26:53 +0000 (08:26 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc
src/osd/OSD.h

index 1a7d8a549ed00308f63cf2ddc383fd1aff0a8ceb..8e538fe1f07f7a2092eaa768def551fa3d0c66e4 100644 (file)
@@ -3725,7 +3725,7 @@ void OSD::register_pg(PGRef pg)
   uint32_t shard_index = pgid.hash_to_shard(num_shards);
   auto sdata = shards[shard_index];
   Mutex::Locker l(sdata->sdata_op_ordering_lock);
-  auto r = sdata->pg_slots.emplace(pgid, make_unique<OSDShard::pg_slot>());
+  auto r = sdata->pg_slots.emplace(pgid, make_unique<OSDShardPGSlot>());
   assert(r.second);
   auto *slot = r.first->second.get();
   dout(20) << __func__ << " " << pgid << " " << pg << dendl;
@@ -9245,7 +9245,7 @@ int OSD::init_op_flags(OpRequestRef& op)
 #undef dout_prefix
 #define dout_prefix *_dout << "osd." << osd->get_nodeid() << ":" << shard_id << "." << __func__ << " "
 
-void OSDShard::_attach_pg(pg_slot *slot, PG *pg)
+void OSDShard::_attach_pg(OSDShardPGSlot *slot, PG *pg)
 {
   dout(10) << pg->pg_id << " " << pg << dendl;
   slot->pg = pg;
@@ -9253,7 +9253,7 @@ void OSDShard::_attach_pg(pg_slot *slot, PG *pg)
   ++osd->num_pgs;
 }
 
-void OSDShard::_detach_pg(pg_slot *slot)
+void OSDShard::_detach_pg(OSDShardPGSlot *slot)
 {
   dout(10) << slot->pg->pg_id << " " << slot->pg << dendl;
   slot->pg->osd_shard = nullptr;
@@ -9277,7 +9277,7 @@ void OSDShard::consume_map(
   // check slots
   auto p = pg_slots.begin();
   while (p != pg_slots.end()) {
-    OSDShard::pg_slot *slot = p->second.get();
+    OSDShardPGSlot *slot = p->second.get();
     const spg_t& pgid = p->first;
     dout(20) << __func__ << " " << pgid << dendl;
     if (old_osdmap &&
@@ -9344,7 +9344,7 @@ void OSDShard::consume_map(
 
 void OSDShard::_wake_pg_slot(
   spg_t pgid,
-  OSDShard::pg_slot *slot)
+  OSDShardPGSlot *slot)
 {
   dout(20) << __func__ << " " << pgid
           << " to_process " << slot->to_process
@@ -9409,7 +9409,7 @@ void OSDShard::_prime_splits(set<spg_t> *pgids)
   while (p != pgids->end()) {
     unsigned shard_index = p->hash_to_shard(osd->num_shards);
     if (shard_index == shard_id) {
-      auto r = pg_slots.emplace(*p, make_unique<OSDShard::pg_slot>());
+      auto r = pg_slots.emplace(*p, make_unique<OSDShardPGSlot>());
       if (r.second) {
        dout(10) << "priming slot " << *p << dendl;
        r.first->second->waiting_for_split = true;
@@ -9474,7 +9474,7 @@ void OSDShard::unprime_split_children(spg_t parent, unsigned old_pg_num)
 
 void OSD::ShardedOpWQ::_add_slot_waiter(
   spg_t pgid,
-  OSDShard::pg_slot *slot,
+  OSDShardPGSlot *slot,
   OpQueueItem&& qi)
 {
   if (qi.is_peering()) {
@@ -9533,7 +9533,7 @@ void OSD::ShardedOpWQ::_process(uint32_t thread_index, heartbeat_handle_d *hb)
   uint64_t requeue_seq;
   const auto token = item.get_ordering_token();
   {
-    auto r = sdata->pg_slots.emplace(token, make_unique<OSDShard::pg_slot>());
+    auto r = sdata->pg_slots.emplace(token, make_unique<OSDShardPGSlot>());
     auto *slot = r.first->second.get();
     dout(30) << __func__ << " " << token
             << (r.second ? " (new)" : "")
index 8a4bf386cc168916c0bb6756288048dadb550cbc..c995c0475c87d11e510333de5db0ebfdc156f5f4 100644 (file)
@@ -1088,6 +1088,24 @@ enum class io_queue {
   mclock_client,
 };
 
+struct OSDShardPGSlot {
+  PGRef pg;                      ///< pg reference
+  deque<OpQueueItem> to_process; ///< order items for this slot
+  int num_running = 0;          ///< _process threads doing pg lookup/lock
+
+  deque<OpQueueItem> waiting;   ///< waiting for pg (or map + pg)
+
+  /// waiting for map (peering evt)
+  map<epoch_t,deque<OpQueueItem>> waiting_peering;
+
+  /// incremented by wake_pg_waiters; indicates racing _process threads
+  /// should bail out (their op has been requeued)
+  uint64_t requeue_seq = 0;
+
+  /// waiting for split child to materialize
+  bool waiting_for_split = false;
+};
+
 struct OSDShard {
   const unsigned shard_id;
   CephContext *cct;
@@ -1099,28 +1117,10 @@ struct OSDShard {
 
   OSDMapRef osdmap;
 
-  struct pg_slot {
-    PGRef pg;                     ///< cached pg reference [optional]
-    deque<OpQueueItem> to_process; ///< order items for this slot
-    int num_running = 0;          ///< _process threads doing pg lookup/lock
-
-    deque<OpQueueItem> waiting;   ///< waiting for pg (or map + pg)
-
-    /// waiting for map (peering evt)
-    map<epoch_t,deque<OpQueueItem>> waiting_peering;
-
-    /// incremented by wake_pg_waiters; indicates racing _process threads
-    /// should bail out (their op has been requeued)
-    uint64_t requeue_seq = 0;
-
-    /// waiting for split child to materialize
-    bool waiting_for_split = false;
-  };
-
   /// map of slots for each spg_t.  maintains ordering of items dequeued
   /// from pqueue while _process thread drops shard lock to acquire the
-  /// pg lock.  slots are removed by consume_map.
-  unordered_map<spg_t,unique_ptr<pg_slot>> pg_slots;
+  /// pg lock.  stale slots are removed by consume_map.
+  unordered_map<spg_t,unique_ptr<OSDShardPGSlot>> pg_slots;
 
   /// priority queue
   std::unique_ptr<OpQueue<OpQueueItem, uint64_t>> pqueue;
@@ -1140,8 +1140,8 @@ struct OSDShard {
        priority, cost, std::move(item));
   }
 
-  void _attach_pg(pg_slot *slot, PG *pg);
-  void _detach_pg(pg_slot *slot);
+  void _attach_pg(OSDShardPGSlot *slot, PG *pg);
+  void _detach_pg(OSDShardPGSlot *slot);
 
   /// push osdmap into shard
   void consume_map(
@@ -1149,7 +1149,7 @@ struct OSDShard {
     unsigned *pushes_to_free,
     set<spg_t> *new_children);
 
-  void _wake_pg_slot(spg_t pgid, OSDShard::pg_slot *slot);
+  void _wake_pg_slot(spg_t pgid, OSDShardPGSlot *slot);
 
   void _prime_splits(set<spg_t> *pgids);
   void prime_splits(OSDMapRef as_of_osdmap, set<spg_t> *pgids);
@@ -1654,7 +1654,7 @@ protected:
 
     void _add_slot_waiter(
       spg_t token,
-      OSDShard::pg_slot *slot,
+      OSDShardPGSlot *slot,
       OpQueueItem&& qi);
 
     /// try to do some work