]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
OSDMap: add [new_]primary_temp to the map and Incremental
authorGreg Farnum <greg@inktank.com>
Fri, 13 Dec 2013 01:21:38 +0000 (17:21 -0800)
committerGreg Farnum <greg@inktank.com>
Thu, 16 Jan 2014 00:33:06 +0000 (16:33 -0800)
It's not used actively yet, but there it is.

Signed-off-by: Greg Farnum <greg@inktank.com>
src/osd/OSDMap.cc
src/osd/OSDMap.h

index d469b4fc1f63bdd226c27aa05b6b63b1616384c5..8f2e8e4fe8337c5690c8e77df387ba088d686b08 100644 (file)
@@ -405,6 +405,7 @@ void OSDMap::Incremental::encode(bufferlist& bl, uint64_t features) const
     ::encode(new_state, bl);
     ::encode(new_weight, bl);
     ::encode(new_pg_temp, bl);
+    ::encode(new_primary_temp, bl);
     ENCODE_FINISH(bl); // client-usable data
   }
 
@@ -555,6 +556,7 @@ void OSDMap::Incremental::decode(bufferlist::iterator& bl)
     ::decode(new_state, bl);
     ::decode(new_weight, bl);
     ::decode(new_pg_temp, bl);
+    ::decode(new_primary_temp, bl);
     DECODE_FINISH(bl); // client-usable data
   }
 
@@ -677,6 +679,15 @@ void OSDMap::Incremental::dump(Formatter *f) const
   }
   f->close_section();
 
+  f->open_array_section("primary_temp");
+  for (map<pg_t, int>::const_iterator p = new_primary_temp.begin();
+      p != new_primary_temp.end();
+      ++p) {
+    f->dump_stream("pgid") << p->first;
+    f->dump_int("osd", p->second);
+  }
+  f->close_section(); // primary_temp
+
   f->open_array_section("new_up_thru");
   for (map<int32_t,uint32_t>::const_iterator p = new_up_thru.begin(); p != new_up_thru.end(); ++p) {
     f->open_object_section("osd");
@@ -1468,6 +1479,7 @@ void OSDMap::encode(bufferlist& bl, uint64_t features) const
     ::encode(osd_addrs->client_addr, bl);
 
     ::encode(*pg_temp, bl);
+    ::encode(*primary_temp, bl);
 
     // crush
     bufferlist cbl;
@@ -1652,6 +1664,7 @@ void OSDMap::decode(bufferlist::iterator& bl)
     ::decode(osd_addrs->client_addr, bl);
 
     ::decode(*pg_temp, bl);
+    ::decode(*primary_temp, bl);
 
     // crush
     bufferlist cbl;
@@ -1762,6 +1775,15 @@ void OSDMap::dump(Formatter *f) const
   }
   f->close_section();
 
+  f->open_array_section("primary_temp");
+  for (map<pg_t, int>::const_iterator p = primary_temp->begin();
+      p != primary_temp->end();
+      ++p) {
+    f->dump_stream("pgid") << p->first;
+    f->dump_int("osd", p->second);
+  }
+  f->close_section(); // primary_temp
+
   f->open_array_section("blacklist");
   for (hash_map<entity_addr_t,utime_t>::const_iterator p = blacklist.begin();
        p != blacklist.end();
index 955197f982d25d6e3f81d743080891de7767c2ea..b150546e242022f7491bd8f4c0d41a809430951e 100644 (file)
@@ -132,6 +132,7 @@ public:
     map<int32_t,uint8_t> new_state;             // XORed onto previous state.
     map<int32_t,uint32_t> new_weight;
     map<pg_t,vector<int32_t> > new_pg_temp;     // [] to remove
+    map<pg_t, int> new_primary_temp;            // [-1] to remove
     map<int32_t,epoch_t> new_up_thru;
     map<int32_t,pair<epoch_t,epoch_t> > new_last_clean_interval;
     map<int32_t,epoch_t> new_lost;
@@ -203,6 +204,7 @@ private:
   vector<__u32>   osd_weight;   // 16.16 fixed point, 0x10000 = "in", 0 = "out"
   vector<osd_info_t> osd_info;
   std::tr1::shared_ptr< map<pg_t,vector<int> > > pg_temp;  // temp pg mapping (e.g. while we rebuild)
+  std::tr1::shared_ptr< map<pg_t,int > > primary_temp;  // temp primary mapping (e.g. while we rebuild)
 
   map<int64_t,pg_pool_t> pools;
   map<int64_t,string> pool_name;
@@ -231,6 +233,7 @@ private:
             num_osd(0), max_osd(0),
             osd_addrs(new addrs_s),
             pg_temp(new map<pg_t,vector<int> >),
+            primary_temp(new map<pg_t,int>),
             osd_uuid(new vector<uuid_d>),
             cluster_snapshot_epoch(0),
             new_blacklist_entries(false),