From e297b1e6ad6b74133de0615f26f551f634517f2a Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 8 Feb 2018 13:36:41 -0600 Subject: [PATCH] osd: pass data into OpQueueItem::run() Signed-off-by: Sage Weil --- src/osd/OSD.cc | 4 ++-- src/osd/OpQueueItem.cc | 35 +++++++++++++++++++++++------------ src/osd/OpQueueItem.h | 21 +++++++++++---------- 3 files changed, 36 insertions(+), 24 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index bdb9a0ed169..e2128ae319a 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -9720,7 +9720,7 @@ void OSD::ShardedOpWQ::_process(uint32_t thread_index, heartbeat_handle_d *hb) if (!qi.peering_requires_pg()) { // for pg-less events, we run them under the ordering lock, since // we don't have the pg lock to keep them ordered. - qi.run(osd, pg, tp_handle); + qi.run(osd, sdata, pg, tp_handle); } else if (osdmap->is_up_acting_osd_shard(token, osd->whoami)) { if (create_info) { if (create_info->by_mon && @@ -9819,7 +9819,7 @@ void OSD::ShardedOpWQ::_process(uint32_t thread_index, heartbeat_handle_d *hb) delete f; *_dout << dendl; - qi.run(osd, pg, tp_handle); + qi.run(osd, sdata, pg, tp_handle); { #ifdef WITH_LTTNG diff --git a/src/osd/OpQueueItem.cc b/src/osd/OpQueueItem.cc index 6a0560d7c93..deb73ee522d 100644 --- a/src/osd/OpQueueItem.cc +++ b/src/osd/OpQueueItem.cc @@ -15,9 +15,11 @@ #include "OpQueueItem.h" #include "OSD.h" -void PGOpItem::run(OSD *osd, - PGRef& pg, - ThreadPool::TPHandle &handle) +void PGOpItem::run( + OSD *osd, + OSDShard *sdata, + PGRef& pg, + ThreadPool::TPHandle &handle) { osd->dequeue_op(pg, op, handle); pg->unlock(); @@ -25,31 +27,38 @@ void PGOpItem::run(OSD *osd, void PGPeeringItem::run( OSD *osd, + OSDShard *sdata, PGRef& pg, ThreadPool::TPHandle &handle) { osd->dequeue_peering_evt(pg.get(), evt, handle); } -void PGSnapTrim::run(OSD *osd, - PGRef& pg, - ThreadPool::TPHandle &handle) +void PGSnapTrim::run( + OSD *osd, + OSDShard *sdata, + PGRef& pg, + ThreadPool::TPHandle &handle) { pg->snap_trimmer(epoch_queued); pg->unlock(); } -void PGScrub::run(OSD *osd, - PGRef& pg, - ThreadPool::TPHandle &handle) +void PGScrub::run( + OSD *osd, + OSDShard *sdata, + PGRef& pg, + ThreadPool::TPHandle &handle) { pg->scrub(epoch_queued, handle); pg->unlock(); } -void PGRecovery::run(OSD *osd, - PGRef& pg, - ThreadPool::TPHandle &handle) +void PGRecovery::run( + OSD *osd, + OSDShard *sdata, + PGRef& pg, + ThreadPool::TPHandle &handle) { osd->do_recovery(pg.get(), epoch_queued, reserved_pushes, handle); pg->unlock(); @@ -57,6 +66,7 @@ void PGRecovery::run(OSD *osd, void PGRecoveryContext::run( OSD *osd, + OSDShard *sdata, PGRef& pg, ThreadPool::TPHandle &handle) { @@ -66,6 +76,7 @@ void PGRecoveryContext::run( void PGDelete::run( OSD *osd, + OSDShard *sdata, PGRef& pg, ThreadPool::TPHandle &handle) { diff --git a/src/osd/OpQueueItem.h b/src/osd/OpQueueItem.h index e981fc67338..faebf4a634a 100644 --- a/src/osd/OpQueueItem.h +++ b/src/osd/OpQueueItem.h @@ -57,6 +57,7 @@ #include "PGPeeringEvent.h" class OSD; +class OSDShard; class OpQueueItem { public: @@ -108,7 +109,7 @@ public: virtual ostream &print(ostream &rhs) const = 0; - virtual void run(OSD *osd, PGRef& pg, ThreadPool::TPHandle &handle) = 0; + virtual void run(OSD *osd, OSDShard *sdata, PGRef& pg, ThreadPool::TPHandle &handle) = 0; virtual ~OpQueueable() {} friend ostream& operator<<(ostream& out, const OpQueueable& q) { return q.print(out); @@ -172,8 +173,8 @@ public: uint64_t get_reserved_pushes() const { return qitem->get_reserved_pushes(); } - void run(OSD *osd, PGRef& pg, ThreadPool::TPHandle &handle) { - qitem->run(osd, pg, handle); + void run(OSD *osd, OSDShard *sdata,PGRef& pg, ThreadPool::TPHandle &handle) { + qitem->run(osd, sdata, pg, handle); } unsigned get_priority() const { return priority; } int get_cost() const { return cost; } @@ -255,7 +256,7 @@ public: boost::optional maybe_get_op() const override final { return op; } - void run(OSD *osd, PGRef& pg, ThreadPool::TPHandle &handle) override final; + void run(OSD *osd, OSDShard *sdata, PGRef& pg, ThreadPool::TPHandle &handle) override final; }; class PGPeeringItem : public PGOpQueueable { @@ -268,7 +269,7 @@ public: ostream &print(ostream &rhs) const override final { return rhs << "PGPeeringEvent(" << evt->get_desc() << ")"; } - void run(OSD *osd, PGRef& pg, ThreadPool::TPHandle &handle) override final; + void run(OSD *osd, OSDShard *sdata, PGRef& pg, ThreadPool::TPHandle &handle) override final; bool is_peering() const override { return true; } @@ -296,7 +297,7 @@ public: << ")"; } void run( - OSD *osd, PGRef& pg, ThreadPool::TPHandle &handle) override final; + OSD *osd, OSDShard *sdata, PGRef& pg, ThreadPool::TPHandle &handle) override final; }; class PGScrub : public PGOpQueueable { @@ -315,7 +316,7 @@ public: << ")"; } void run( - OSD *osd, PGRef& pg, ThreadPool::TPHandle &handle) override final; + OSD *osd, OSDShard *sdata, PGRef& pg, ThreadPool::TPHandle &handle) override final; }; class PGRecovery : public PGOpQueueable { @@ -342,7 +343,7 @@ public: return reserved_pushes; } virtual void run( - OSD *osd, PGRef& pg, ThreadPool::TPHandle &handle) override final; + OSD *osd, OSDShard *sdata, PGRef& pg, ThreadPool::TPHandle &handle) override final; }; class PGRecoveryContext : public PGOpQueueable { @@ -362,7 +363,7 @@ public: << ")"; } void run( - OSD *osd, PGRef& pg, ThreadPool::TPHandle &handle) override final; + OSD *osd, OSDShard *sdata, PGRef& pg, ThreadPool::TPHandle &handle) override final; }; class PGDelete : public PGOpQueueable { @@ -382,5 +383,5 @@ public: << ")"; } void run( - OSD *osd, PGRef& pg, ThreadPool::TPHandle &handle) override final; + OSD *osd, OSDShard *sdata, PGRef& pg, ThreadPool::TPHandle &handle) override final; }; -- 2.39.5