From a7e1a73ae88ca346315f455e26a3fb8c993b82c4 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 13 Sep 2017 17:55:40 -0400 Subject: [PATCH] osd/PG: start grouping public interface at top of class Signed-off-by: Sage Weil --- src/osd/PG.cc | 2 +- src/osd/PG.h | 78 ++++++++++++++++++++++++--------------------------- 2 files changed, 38 insertions(+), 42 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index ed9b508cd6472..2e7c9d32eddd1 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -277,6 +277,7 @@ void PGPool::update(OSDMapRef map) PG::PG(OSDService *o, OSDMapRef curmap, const PGPool &_pool, spg_t p) : + coll(p), osd(o), cct(o->cct), osdriver(osd->store, coll_t(), OSD::make_snapmapper_oid()), @@ -297,7 +298,6 @@ PG::PG(OSDService *o, OSDMapRef curmap, dirty_info(false), dirty_big_info(false), info(p), info_struct_v(0), - coll(p), pg_log(cct), pgmeta_oid(p.make_pgmeta_oid()), missing_loc(this), diff --git a/src/osd/PG.h b/src/osd/PG.h index be311f7cfa604..1841b16a6e270 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -246,9 +246,46 @@ struct PGPool { class PG : public DoutPrefixProvider { public: + const coll_t coll; + ObjectStore::CollectionHandle ch; + + std::string gen_prefix() const override; + CephContext *get_cct() const override { return cct; } + unsigned get_subsys() const override { return ceph_subsys_osd; } + + OSDMapRef get_osdmap() const { + assert(is_locked()); + assert(osdmap_ref); + return osdmap_ref; + } + + void lock_suspend_timeout(ThreadPool::TPHandle &handle) { + handle.suspend_tp_timeout(); + lock(); + handle.reset_tp_timeout(); + } + void lock(bool no_lockdep = false) const; + void unlock() const { + //generic_dout(0) << this << " " << info.pgid << " unlock" << dendl; + assert(!dirty_info); + assert(!dirty_big_info); + _lock.Unlock(); + } + bool is_locked() const { + return _lock.is_locked(); + } + bool is_deleting() const { return deleting; } + + bool is_ec_pg() const { + return pool.info.is_erasure(); + } + const vector get_acting() const { + return acting; + } + protected: OSDService *osd; CephContext *cct; @@ -257,10 +294,6 @@ protected: bool eio_errors_to_process = false; virtual PGBackend *get_pgbackend() = 0; -public: - std::string gen_prefix() const override; - CephContext *get_cct() const override { return cct; } - unsigned get_subsys() const override { return ceph_subsys_osd; } protected: /*** PG ****/ @@ -283,12 +316,6 @@ protected: osdmap_ref = std::move(newmap); } -public: - OSDMapRef get_osdmap() const { - assert(is_locked()); - assert(osdmap_ref); - return osdmap_ref; - } protected: /** locking and reference counting. @@ -311,29 +338,10 @@ protected: friend void put_with_id(PG *pg, uint64_t id) { return pg->put_with_id(id); } #endif -public: bool deleting; // true while in removing or OSD is shutting down ZTracer::Endpoint trace_endpoint; - void lock_suspend_timeout(ThreadPool::TPHandle &handle) { - handle.suspend_tp_timeout(); - lock(); - handle.reset_tp_timeout(); - } - - void lock(bool no_lockdep = false) const; - void unlock() const { - //generic_dout(0) << this << " " << info.pgid << " unlock" << dendl; - assert(!dirty_info); - assert(!dirty_big_info); - _lock.Unlock(); - } - - bool is_locked() const { - return _lock.is_locked(); - } - protected: #ifdef PG_DEBUG_REFS uint64_t get_with_id(); @@ -356,10 +364,6 @@ private: protected: bool dirty_info, dirty_big_info; -public: - bool is_ec_pg() const { - return pool.info.is_erasure(); - } protected: // pg state pg_info_t info; ///< current pg info @@ -380,9 +384,6 @@ protected: } void upgrade(ObjectStore *store); -public: - const coll_t coll; - ObjectStore::CollectionHandle ch; protected: PGLog pg_log; static string get_info_key(spg_t pgid) { @@ -642,11 +643,6 @@ protected: set blocked_by; ///< osds we are blocked by (for pg stats) -public: - const vector get_acting() const { - return acting; - } - protected: // [primary only] content recovery state struct BufferedRecoveryMessages { -- 2.39.5