From f9aea5da93c63c44e83d604ae89642cbc2a59719 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 18 Dec 2017 13:55:45 -0600 Subject: [PATCH] osd: move part of wake_pg_waiters into helper We'll need this shortly. Signed-off-by: Sage Weil --- src/osd/OSD.cc | 37 +++++++++++++++++++++++-------------- src/osd/OSD.h | 3 +++ 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 8cc4ec181334f..8e009c6f7ef7e 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -9488,6 +9488,28 @@ int OSD::init_op_flags(OpRequestRef& op) #undef dout_prefix #define dout_prefix *_dout << "osd." << osd->whoami << " op_wq " +void OSD::ShardedOpWQ::_wake_pg_slot( + spg_t pgid, + ShardData *sdata, + ShardData::pg_slot& slot, + unsigned *pushes_to_free) +{ + dout(20) << __func__ << " " << pgid + << " to_process " << slot.to_process + << " waiting_for_pg=" << (int)slot.waiting_for_pg << dendl; + for (auto& q : slot.to_process) { + *pushes_to_free += q.get_reserved_pushes(); + } + for (auto i = slot.to_process.rbegin(); + i != slot.to_process.rend(); + ++i) { + sdata->_enqueue_front(std::move(*i), osd->op_prio_cutoff); + } + slot.to_process.clear(); + slot.waiting_for_pg = false; + ++slot.requeue_seq; +} + void OSD::ShardedOpWQ::wake_pg_waiters(spg_t pgid) { uint32_t shard_index = pgid.hash_to_shard(shard_list.size()); @@ -9498,20 +9520,7 @@ void OSD::ShardedOpWQ::wake_pg_waiters(spg_t pgid) Mutex::Locker l(sdata->sdata_op_ordering_lock); auto p = sdata->pg_slots.find(pgid); if (p != sdata->pg_slots.end()) { - dout(20) << __func__ << " " << pgid - << " to_process " << p->second.to_process - << " waiting_for_pg=" << (int)p->second.waiting_for_pg << dendl; - for (auto& q : p->second.to_process) { - pushes_to_free += q.get_reserved_pushes(); - } - for (auto i = p->second.to_process.rbegin(); - i != p->second.to_process.rend(); - ++i) { - sdata->_enqueue_front(std::move(*i), osd->op_prio_cutoff); - } - p->second.to_process.clear(); - p->second.waiting_for_pg = false; - ++p->second.requeue_seq; + _wake_pg_slot(pgid, sdata, p->second, &pushes_to_free); queued = true; } } diff --git a/src/osd/OSD.h b/src/osd/OSD.h index aa245780fb5ac..b13d70245aaca 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1659,6 +1659,9 @@ private: /// wake any pg waiters after a PG is created/instantiated void wake_pg_waiters(spg_t pgid); + void _wake_pg_slot(spg_t pgid, ShardData *sdata, ShardData::pg_slot& slot, + unsigned *pushes_to_free); + /// prune ops (and possibly pg_slots) for pgs that shouldn't be here void prune_pg_waiters(OSDMapRef osdmap, int whoami); -- 2.39.5