]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
PG: Added a const spg_t member to the PG class 1897/head
authorSomnath Roy <somnath.roy@sandisk.com>
Wed, 11 Jun 2014 01:10:30 +0000 (18:10 -0700)
committerSomnath Roy <somnath.roy@sandisk.com>
Wed, 11 Jun 2014 01:10:30 +0000 (18:10 -0700)
The const spg_t member is been insantiated from constructor
and now get_pgid() can reference this to return a spg_t instance
without the need of pg_info (thus not requiring to acquire pg_lock).

Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>
src/osd/PG.cc
src/osd/PG.h

index aa3b6d5ac71264d89fc0cea67872449ab9b39423..0d00a9f05ca8f6a087a0610a43437703d14c0540 100644 (file)
@@ -194,7 +194,8 @@ PG::PG(OSDService *o, OSDMapRef curmap,
   finish_sync_event(NULL),
   scrub_after_recovery(false),
   active_pushes(0),
-  recovery_state(this)
+  recovery_state(this),
+  pg_id(p)
 {
 #ifdef PG_DEBUG_REFS
   osd->add_pgid(p, this);
index 1b7311d62528a8538f7c160e8fd41948da6d367c..e8f3c3c829e133a39dfdaf1d7b37ff905d9de826 100644 (file)
@@ -1877,9 +1877,10 @@ public:
   // Prevent copying
   PG(const PG& rhs);
   PG& operator=(const PG& rhs);
+  const spg_t pg_id;
 
  public:
-  spg_t      get_pgid() const { return info.pgid; }
+  const spg_t&      get_pgid() const { return pg_id; }
   int        get_nrep() const { return acting.size(); }
 
   void init_primary_up_acting(