]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: reorder some members
authorSage Weil <sage@redhat.com>
Fri, 15 Sep 2017 22:35:40 +0000 (18:35 -0400)
committerSage Weil <sage@redhat.com>
Fri, 6 Oct 2017 18:08:17 +0000 (13:08 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/PG.cc
src/osd/PG.h

index 0c8556a456fdc00d947b10acdf8bff97642e19b0..b1c60fa58e2834a90b4935e55e77c4396c6e2bd7 100644 (file)
@@ -277,9 +277,12 @@ void PGPool::update(OSDMapRef map)
 
 PG::PG(OSDService *o, OSDMapRef curmap,
        const PGPool &_pool, spg_t p) :
+  pg_id(p),
   coll(p),
   osd(o),
   cct(o->cct),
+  osdmap_ref(curmap),
+  pool(_pool),
   osdriver(osd->store, coll_t(), OSD::make_snapmapper_oid()),
   snap_mapper(
     cct,
@@ -288,11 +291,7 @@ PG::PG(OSDService *o, OSDMapRef curmap,
     p.get_split_bits(curmap->get_pg_num(_pool.id)),
     _pool.id,
     p.shard),
-  osdmap_ref(curmap), last_persisted_osdmap_ref(curmap), pool(_pool),
-  _lock("PG::_lock"),
-  #ifdef PG_DEBUG_REFS
-  _ref_id_lock("PG::_ref_id_lock"), _ref_id(0),
-  #endif
+  last_persisted_osdmap_ref(curmap),
   deleting(false),
   trace_endpoint("0.0.0.0", 0, "PG"),
   dirty_info(false), dirty_big_info(false),
@@ -323,7 +322,6 @@ PG::PG(OSDService *o, OSDMapRef curmap,
   scrub_after_recovery(false),
   active_pushes(0),
   recovery_state(this),
-  pg_id(p),
   peer_features(CEPH_FEATURES_SUPPORTED_DEFAULT),
   acting_features(CEPH_FEATURES_SUPPORTED_DEFAULT),
   upacting_features(CEPH_FEATURES_SUPPORTED_DEFAULT),
index c56e18399de6cc9e6e0f79940a8aae54903a0de6..9d9ba79013adf09699b8f337b66ada5be15af85e 100644 (file)
@@ -248,7 +248,9 @@ struct PGPool {
 class PG : public DoutPrefixProvider {
 public:
   // -- members --
+  const spg_t pg_id;
   const coll_t coll;
+
   ObjectStore::CollectionHandle ch;
 
   // -- classes --
@@ -282,8 +284,12 @@ public:
 
   // -- methods --
   std::string gen_prefix() const override;
-  CephContext *get_cct() const override { return cct; }
-  unsigned get_subsys() const override { return ceph_subsys_osd; }
+  CephContext *get_cct() const override {
+    return cct;
+  }
+  unsigned get_subsys() const override {
+    return ceph_subsys_osd;
+  }
 
   OSDMapRef get_osdmap() const {
     assert(is_locked());
@@ -399,15 +405,65 @@ public:
   void put_with_id(uint64_t);
   void dump_live_ids();
 #endif
-
   void get(const char* tag);
   void put(const char* tag);
 
 
+  // ctor
+  PG(OSDService *o, OSDMapRef curmap,
+     const PGPool &pool, spg_t p);
+  ~PG() override;
+
+  // prevent copying
+  explicit PG(const PG& rhs) = delete;
+  PG& operator=(const PG& rhs) = delete;
 
 protected:
+  // -------------
+  // protected
   OSDService *osd;
   CephContext *cct;
+
+  // osdmap
+  OSDMapRef osdmap_ref;
+
+  PGPool pool;
+
+  // locking and reference counting.
+  // I destroy myself when the reference count hits zero.
+  // lock() should be called before doing anything.
+  // get() should be called on pointer copy (to another thread, etc.).
+  // put() should be called on destruction of some previously copied pointer.
+  // unlock() when done with the current pointer (_most common_).
+  mutable Mutex _lock = {"PG::_lock"};
+
+  std::atomic_uint ref{0};
+
+#ifdef PG_DEBUG_REFS
+  Mutex _ref_id_lock = {"PG::_ref_id_lock"};
+  map<uint64_t, string> _live_ids;
+  map<string, uint64_t> _tag_counts;
+  uint64_t _ref_id = 0;
+
+  friend uint64_t get_with_id(PG *pg) { return pg->get_with_id(); }
+  friend void put_with_id(PG *pg, uint64_t id) { return pg->put_with_id(id); }
+#endif
+
+private:
+  friend void intrusive_ptr_add_ref(PG *pg) {
+    pg->get("intptr");
+  }
+  friend void intrusive_ptr_release(PG *pg) {
+    pg->put("intptr");
+  }
+
+
+protected:
+
+
+  // =====================
+
+protected:
   OSDriver osdriver;
   SnapMapper snap_mapper;
   bool eio_errors_to_process = false;
@@ -424,9 +480,7 @@ protected:
     return get_pgbackend()->get_is_recoverable_predicate();
   }
 protected:
-  OSDMapRef osdmap_ref;
   OSDMapRef last_persisted_osdmap_ref;
-  PGPool pool;
 
   void requeue_map_waiters();
 
@@ -437,37 +491,11 @@ protected:
 
 protected:
 
-  /** locking and reference counting.
-   * I destroy myself when the reference count hits zero.
-   * lock() should be called before doing anything.
-   * get() should be called on pointer copy (to another thread, etc.).
-   * put() should be called on destruction of some previously copied pointer.
-   * unlock() when done with the current pointer (_most common_).
-   */  
-  mutable Mutex _lock;
-  std::atomic_uint ref{0};
-
-#ifdef PG_DEBUG_REFS
-  Mutex _ref_id_lock;
-  map<uint64_t, string> _live_ids;
-  map<string, uint64_t> _tag_counts;
-  uint64_t _ref_id;
-
-  friend uint64_t get_with_id(PG *pg) { return pg->get_with_id(); }
-  friend void put_with_id(PG *pg, uint64_t id) { return pg->put_with_id(id); }
-#endif
 
   bool deleting;  // true while in removing or OSD is shutting down
 
   ZTracer::Endpoint trace_endpoint;
 
-private:
-  friend void intrusive_ptr_add_ref(PG *pg) {
-    pg->get("intptr");
-  }
-  friend void intrusive_ptr_release(PG *pg) {
-    pg->put("intptr");
-  }
 
 protected:
   bool dirty_info, dirty_big_info;
@@ -2370,17 +2398,7 @@ protected:
   } recovery_state;
 
 
- public:
-  PG(OSDService *o, OSDMapRef curmap,
-     const PGPool &pool, spg_t p);
-  ~PG() override;
-
- private:
-  // Prevent copying
-  explicit PG(const PG& rhs);
-  PG& operator=(const PG& rhs);
 
-  const spg_t pg_id;
   uint64_t peer_features;
   uint64_t acting_features;
   uint64_t upacting_features;