]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: EMetaBlob and its sub-parts use modern encoding now
authorGreg Farnum <greg@inktank.com>
Fri, 18 Jan 2013 20:51:52 +0000 (12:51 -0800)
committerGreg Farnum <greg@inktank.com>
Fri, 8 Feb 2013 21:17:52 +0000 (13:17 -0800)
Signed-off-by: Greg Farnum <greg@inktank.com>
src/mds/events/EMetaBlob.h

index d0279c8dc85b6d5ffee96ca299421550409dc2ef..d241c508b82383b04f5478471b5765748befbf8e 100644 (file)
@@ -115,14 +115,13 @@ public:
     }
 
     void encode(bufferlist& bl) const {
-      __u8 struct_v = 3;
-      ::encode(struct_v, bl);
       assert(_enc.length());
+      ENCODE_START(4, 4, bl);
       bl.append(_enc); 
+      ENCODE_FINISH(bl);
     }
     void decode(bufferlist::iterator &bl) {
-      __u8 struct_v;
-      ::decode(struct_v, bl);
+      DECODE_START_LEGACY_COMPAT_LEN(4, 4, 4, bl);
       ::decode(dn, bl);
       ::decode(dnfirst, bl);
       ::decode(dnlast, bl);
@@ -151,6 +150,7 @@ public:
          ::decode(old_inodes, bl);
        }
       }
+      DECODE_FINISH(bl);
     }
 
     void update_inode(MDS *mds, CInode *in);
@@ -190,23 +190,13 @@ public:
     remotebit() {}
 
     void encode(bufferlist& bl) const {
-      __u8 struct_v = 1;
-      ::encode(struct_v, bl);
       assert(_enc.length());
+      ENCODE_START(2, 2, bl);
       bl.append(_enc);
-      /*
-      ::encode(dn, bl);
-      ::encode(dnfirst, bl);
-      ::encode(dnlast, bl);
-      ::encode(dnv, bl);
-      ::encode(ino, bl);
-      ::encode(d_type, bl);
-      ::encode(dirty, bl);
-      */
+      ENCODE_FINISH(bl);
     }
     void decode(bufferlist::iterator &bl) {
-      __u8 struct_v;
-      ::decode(struct_v, bl);
+      DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
       ::decode(dn, bl);
       ::decode(dnfirst, bl);
       ::decode(dnlast, bl);
@@ -214,6 +204,7 @@ public:
       ::decode(ino, bl);
       ::decode(d_type, bl);
       ::decode(dirty, bl);
+      DECODE_FINISH(bl);
     }
     void print(ostream& out) {
       out << " remotebit dn " << dn << " [" << dnfirst << "," << dnlast << "] dnv " << dnv
@@ -247,26 +238,19 @@ public:
     nullbit() {}
 
     void encode(bufferlist& bl) const {
-      __u8 struct_v = 1;
-      ::encode(struct_v, bl);
       assert(_enc.length());
+      ENCODE_START(2, 2, bl);
       bl.append(_enc);
-      /*
-      ::encode(dn, bl);
-      ::encode(dnfirst, bl);
-      ::encode(dnlast, bl);
-      ::encode(dnv, bl);
-      ::encode(dirty, bl);
-      */
+      ENCODE_FINISH(bl);
     }
     void decode(bufferlist::iterator &bl) {
-      __u8 struct_v;
-      ::decode(struct_v, bl);
+      DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
       ::decode(dn, bl);
       ::decode(dnfirst, bl);
       ::decode(dnlast, bl);
       ::decode(dnv, bl);
       ::decode(dirty, bl);
+      DECODE_FINISH(bl);
     }
     void print(ostream& out) {
       out << " nullbit dn " << dn << " [" << dnfirst << "," << dnlast << "] dnv " << dnv
@@ -327,6 +311,7 @@ public:
        p->print(out);
     }
 
+    // if this changes, update the versioning in encode for it!
     void _encode_bits() const {
       ::encode(dfull, dnbl);
       ::encode(dremote, dnbl);
@@ -342,8 +327,7 @@ public:
     }
 
     void encode(bufferlist& bl) const {
-      __u8 struct_v = 1;
-      ::encode(struct_v, bl);
+      ENCODE_START(2, 2, bl);
       ::encode(fnode, bl);
       ::encode(state, bl);
       ::encode(nfull, bl);
@@ -351,10 +335,10 @@ public:
       ::encode(nnull, bl);
       _encode_bits();
       ::encode(dnbl, bl);
+      ENCODE_FINISH(bl);
     }
     void decode(bufferlist::iterator &bl) {
-      __u8 struct_v;
-      ::decode(struct_v, bl);
+      DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl)
       ::decode(fnode, bl);
       ::decode(state, bl);
       ::decode(nfull, bl);
@@ -362,6 +346,7 @@ public:
       ::decode(nnull, bl);
       ::decode(dnbl, bl);
       dn_decoded = false;      // don't decode bits unless we need them.
+      DECODE_FINISH(bl);
     }
   };
   WRITE_CLASS_ENCODER(dirlump)
@@ -398,8 +383,7 @@ private:
 
  public:
   void encode(bufferlist& bl) const {
-    __u8 struct_v = 4;
-    ::encode(struct_v, bl);
+    ENCODE_START(5, 5, bl);
     ::encode(lump_order, bl);
     ::encode(lump_map, bl);
     ::encode(roots, bl);
@@ -417,10 +401,10 @@ private:
     ::encode(client_reqs, bl);
     ::encode(renamed_dirino, bl);
     ::encode(renamed_dir_frags, bl);
-  } 
+    ENCODE_FINISH(bl);
+  }
   void decode(bufferlist::iterator &bl) {
-    __u8 struct_v;
-    ::decode(struct_v, bl);
+    DECODE_START_LEGACY_COMPAT_LEN(5, 5, 5, bl);
     ::decode(lump_order, bl);
     ::decode(lump_map, bl);
     if (struct_v >= 4) {
@@ -458,6 +442,7 @@ private:
       ::decode(renamed_dirino, bl);
       ::decode(renamed_dir_frags, bl);
     }
+    DECODE_FINISH(bl);
   }