From: John Spray Date: Mon, 19 May 2014 13:23:40 +0000 (+0100) Subject: osdc: new style encoding for Journal::Header X-Git-Tag: v0.82~48^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1c2bb374177b7fc55612f6a38043f79ee87547d7;p=ceph.git osdc: new style encoding for Journal::Header 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 --- diff --git a/src/osdc/Journaler.h b/src/osdc/Journaler.h index 03882e23c42..cce8db31f17 100644 --- a/src/osdc/Journaler.h +++ b/src/osdc/Journaler.h @@ -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 {