From 80233f28d43ac546e18e2a76be6c7977176ed7e8 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 15 Sep 2017 23:11:34 -0400 Subject: [PATCH] osd/PG: on_shutdown -> shutdown in public interface Signed-off-by: Sage Weil --- src/osd/OSD.cc | 10 ++-------- src/osd/PG.h | 3 ++- src/osd/PrimaryLogPG.cc | 10 +++++++++- src/osd/PrimaryLogPG.h | 3 ++- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 8290c01176293..c38fd8009f00e 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -3257,14 +3257,8 @@ int OSD::shutdown() // Shutdown PGs { RWLock::RLocker l(pg_map_lock); - for (ceph::unordered_map::iterator p = pg_map.begin(); - p != pg_map.end(); - ++p) { - dout(20) << " kicking pg " << p->first << dendl; - p->second->lock(); - p->second->on_shutdown(); - p->second->unlock(); - p->second->osr->flush(); + for (auto& p : pg_map) { + p.second->shutdown(); } } diff --git a/src/osd/PG.h b/src/osd/PG.h index fa01d21ec8047..5bb432615ff37 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -386,6 +386,8 @@ public: void get_pg_stats(std::function f); + virtual void shutdown() = 0; + virtual void do_request( OpRequestRef& op, ThreadPool::TPHandle &handle @@ -2684,7 +2686,6 @@ protected: virtual void on_change(ObjectStore::Transaction *t) = 0; virtual void on_activate() = 0; virtual void on_flushed() = 0; - virtual void on_shutdown() = 0; virtual void check_blacklisted_watchers() = 0; friend ostream& operator<<(ostream& out, const PG& pg); diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index c2ed9c4ce6b38..45ed663e73432 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -10698,9 +10698,17 @@ void PrimaryLogPG::clear_async_reads() } } +void PrimaryLogPG::shutdown() +{ + lock(); + on_shutdown(); + unlock(); + osr->flush(); +} + void PrimaryLogPG::on_shutdown() { - dout(10) << "on_shutdown" << dendl; + dout(10) << __func__ << dendl; // remove from queues osd->peering_wq.dequeue(this); diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 5c95c34ff3340..c70e44b4108b3 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -1784,7 +1784,8 @@ public: void on_activate() override; void on_flushed() override; void on_removal(ObjectStore::Transaction *t) override; - void on_shutdown() override; + void shutdown() override; + void on_shutdown(); bool check_failsafe_full(ostream &ss) override; bool check_osdmap_full(const set &missing_on) override; int rep_repair_primary_object(const hobject_t& soid, OpRequestRef op); -- 2.39.5