]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: new encoding for OSDSuperblock
authorSage Weil <sage.weil@dreamhost.com>
Thu, 2 Feb 2012 19:34:20 +0000 (11:34 -0800)
committerSage Weil <sage.weil@dreamhost.com>
Fri, 10 Feb 2012 05:58:07 +0000 (21:58 -0800)
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/osd/osd_types.cc

index 9c97b2d33e61d5e3f026bc92e0f93b85576d81aa..1d4f7a6ad1460d5e3b47ee02c3c95a006cccd96f 100644 (file)
@@ -1623,9 +1623,7 @@ void pg_create_t::generate_test_instances(list<pg_create_t*>& o)
 
 void OSDSuperblock::encode(bufferlist &bl) const
 {
-  __u8 v = 4;
-  ::encode(v, bl);
-
+  ENCODE_START(5, 5, bl);
   ::encode(cluster_fsid, bl);
   ::encode(whoami, bl);
   ::encode(current_epoch, bl);
@@ -1636,14 +1634,13 @@ void OSDSuperblock::encode(bufferlist &bl) const
   ::encode(clean_thru, bl);
   ::encode(mounted, bl);
   ::encode(osd_fsid, bl);
+  ENCODE_FINISH(bl);
 }
 
 void OSDSuperblock::decode(bufferlist::iterator &bl)
 {
-  __u8 v;
-  ::decode(v, bl);
-
-  if (v < 3) {
+  DECODE_START_LEGACY_COMPAT_LEN(5, 5, 5, bl);
+  if (struct_v < 3) {
     string magic;
     ::decode(magic, bl);
   }
@@ -1653,15 +1650,16 @@ void OSDSuperblock::decode(bufferlist::iterator &bl)
   ::decode(oldest_map, bl);
   ::decode(newest_map, bl);
   ::decode(weight, bl);
-  if (v >= 2) {
+  if (struct_v >= 2) {
     compat_features.decode(bl);
   } else { //upgrade it!
     compat_features.incompat.insert(CEPH_OSD_FEATURE_INCOMPAT_BASE);
   }
   ::decode(clean_thru, bl);
   ::decode(mounted, bl);
-  if (v >= 4)
+  if (struct_v >= 4)
     ::decode(osd_fsid, bl);
+  DECODE_FINISH(bl);
 }
 
 void OSDSuperblock::dump(Formatter *f) const