]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
OSDMap: note encoding features in Incremental encoding
authorSage Weil <sage@inktank.com>
Thu, 30 Jan 2014 23:09:58 +0000 (15:09 -0800)
committerSage Weil <sage@inktank.com>
Thu, 30 Jan 2014 23:09:58 +0000 (15:09 -0800)
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 <sage@inktank.com>
src/osd/OSDMap.cc
src/osd/OSDMap.h

index d4c36f5ec14cfcf3b8547da5387624c57f25cdcb..608177a714917489a6ecea8f9e1f7db58ad207d7 100644 (file)
@@ -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
   }
 
index a0237e3f1ef793fee5b6ae040c13889d76c2ab17..a3acc0259cb8d4134ba8170afc16370f3eda72b1 100644 (file)
@@ -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<Incremental*>& 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));
     }