From: Sage Weil Date: Thu, 30 Jan 2014 23:09:58 +0000 (-0800) Subject: OSDMap: note encoding features in Incremental encoding X-Git-Tag: v0.78~239^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b9208b47745fdd53d36b682bebfc01e913347092;p=ceph.git OSDMap: note encoding features in Incremental encoding The monitor will need to know what features the incremental was encoded with so that it can encode the OSDMap using the same bits. Introduce a member that is set during decode. During encode, encoding the value passed in by the caller. Signed-off-by: Sage Weil --- diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index d4c36f5ec14c..608177a71491 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -410,7 +410,7 @@ void OSDMap::Incremental::encode(bufferlist& bl, uint64_t features) const } { - ENCODE_START(1, 1, bl); // extended, osd-only data + ENCODE_START(2, 1, bl); // extended, osd-only data ::encode(new_hb_back_up, bl); ::encode(new_up_thru, bl); ::encode(new_last_clean_interval, bl); @@ -422,6 +422,7 @@ void OSDMap::Incremental::encode(bufferlist& bl, uint64_t features) const ::encode(new_uuid, bl); ::encode(new_xinfo, bl); ::encode(new_hb_front_up, bl); + ::encode(features, bl); // NOTE: features arg, not the member ENCODE_FINISH(bl); // osd-only data } @@ -536,6 +537,7 @@ void OSDMap::Incremental::decode(bufferlist::iterator& bl) int struct_v_size = sizeof(struct_v); bl.advance(-struct_v_size); decode_classic(bl); + encode_features = 0; return; } { @@ -561,7 +563,7 @@ void OSDMap::Incremental::decode(bufferlist::iterator& bl) } { - DECODE_START(1, bl); // extended, osd-only data + DECODE_START(2, bl); // extended, osd-only data ::decode(new_hb_back_up, bl); ::decode(new_up_thru, bl); ::decode(new_last_clean_interval, bl); @@ -573,6 +575,10 @@ void OSDMap::Incremental::decode(bufferlist::iterator& bl) ::decode(new_uuid, bl); ::decode(new_xinfo, bl); ::decode(new_hb_front_up, bl); + if (struct_v >= 2) + ::decode(encode_features, bl); + else + encode_features = 0; DECODE_FINISH(bl); // osd-only data } diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index a0237e3f1ef7..a3acc0259cb8 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -111,6 +111,9 @@ class OSDMap { public: class Incremental { public: + /// feature bits we were encoded with. the subsequent OSDMap + /// encoding should match. + uint64_t encode_features; uuid_d fsid; epoch_t epoch; // new epoch; we are a diff from epoch-1 to epoch utime_t modified; @@ -158,6 +161,7 @@ public: static void generate_test_instances(list& o); Incremental(epoch_t e=0) : + encode_features(0), epoch(e), new_pool_max(-1), new_flags(-1), new_max_osd(-1) { memset(&fsid, 0, sizeof(fsid)); }