From: Sage Weil Date: Fri, 9 Feb 2018 20:42:25 +0000 (-0600) Subject: osd: OSDShard::pg_slot -> OSDShardPGSlot X-Git-Tag: v13.1.0~390^2~68 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4c465fbfacd98d67982fd28fd51a12899bc3b2e5;p=ceph.git osd: OSDShard::pg_slot -> OSDShardPGSlot Signed-off-by: Sage Weil --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 1a7d8a549ed0..8e538fe1f07f 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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()); + auto r = sdata->pg_slots.emplace(pgid, make_unique()); 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 *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()); + auto r = pg_slots.emplace(*p, make_unique()); 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()); + auto r = sdata->pg_slots.emplace(token, make_unique()); auto *slot = r.first->second.get(); dout(30) << __func__ << " " << token << (r.second ? " (new)" : "") diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 8a4bf386cc16..c995c0475c87 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1088,6 +1088,24 @@ enum class io_queue { mclock_client, }; +struct OSDShardPGSlot { + PGRef pg; ///< pg reference + deque to_process; ///< order items for this slot + int num_running = 0; ///< _process threads doing pg lookup/lock + + deque waiting; ///< waiting for pg (or map + pg) + + /// waiting for map (peering evt) + map> 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 to_process; ///< order items for this slot - int num_running = 0; ///< _process threads doing pg lookup/lock - - deque waiting; ///< waiting for pg (or map + pg) - - /// waiting for map (peering evt) - map> 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> pg_slots; + /// pg lock. stale slots are removed by consume_map. + unordered_map> pg_slots; /// priority queue std::unique_ptr> 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 *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 *pgids); void prime_splits(OSDMapRef as_of_osdmap, set *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