From 74bdcb69e3a95b6666c06e8be921db8f5c42e3ca Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Thu, 12 Dec 2013 17:21:38 -0800 Subject: [PATCH] OSDMap: add [new_]primary_temp to the map and Incremental It's not used actively yet, but there it is. Signed-off-by: Greg Farnum --- src/osd/OSDMap.cc | 22 ++++++++++++++++++++++ src/osd/OSDMap.h | 3 +++ 2 files changed, 25 insertions(+) diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index d469b4fc1f63b..8f2e8e4fe8337 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -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::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::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::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::const_iterator p = blacklist.begin(); p != blacklist.end(); diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index 955197f982d25..b150546e24202 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -132,6 +132,7 @@ public: map new_state; // XORed onto previous state. map new_weight; map > new_pg_temp; // [] to remove + map new_primary_temp; // [-1] to remove map new_up_thru; map > new_last_clean_interval; map new_lost; @@ -203,6 +204,7 @@ private: vector<__u32> osd_weight; // 16.16 fixed point, 0x10000 = "in", 0 = "out" vector osd_info; std::tr1::shared_ptr< map > > pg_temp; // temp pg mapping (e.g. while we rebuild) + std::tr1::shared_ptr< map > primary_temp; // temp primary mapping (e.g. while we rebuild) map pools; map pool_name; @@ -231,6 +233,7 @@ private: num_osd(0), max_osd(0), osd_addrs(new addrs_s), pg_temp(new map >), + primary_temp(new map), osd_uuid(new vector), cluster_snapshot_epoch(0), new_blacklist_entries(false), -- 2.39.5