]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc: new style encoding for Journal::Header
authorJohn Spray <john.spray@inktank.com>
Mon, 19 May 2014 13:23:40 +0000 (14:23 +0100)
committerJohn Spray <john.spray@inktank.com>
Tue, 20 May 2014 13:07:52 +0000 (14:07 +0100)
Switch to the ENCODE_START, DECODE_START macros
for Journal::Header.  As well as being nice generally,
this has the important side effect of making
journal headers written since JOURNAL_FORMAT_RESILIENT
unreadable to older MDSs, as they will fail their check
on Header.magic.

Signed-off-by: John Spray <john.spray@inktank.com>
src/osdc/Journaler.h

index 03882e23c422923fa97612c08b967ec582311dbb..cce8db31f17557f0b8803f9c495b81b1d63370b0 100644 (file)
@@ -116,8 +116,7 @@ public:
     }
 
     void encode(bufferlist &bl) const {
-      __u8 struct_v = 2;
-      ::encode(struct_v, bl);
+      ENCODE_START(2, 2, bl);
       ::encode(magic, bl);
       ::encode(trimmed_pos, bl);
       ::encode(expire_pos, bl);
@@ -125,10 +124,10 @@ public:
       ::encode(write_pos, bl);
       ::encode(layout, bl);
       ::encode(stream_format, 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(magic, bl);
       ::decode(trimmed_pos, bl);
       ::decode(expire_pos, bl);
@@ -140,6 +139,7 @@ public:
       } else {
         stream_format = JOURNAL_FORMAT_LEGACY;
       }
+      DECODE_FINISH(bl);
     }
 
     void dump(Formatter *f) const {