From 60730271d49a3c16bee6ff60c402b924a0280efc Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Fri, 18 Jan 2013 12:51:52 -0800 Subject: [PATCH] mds: EMetaBlob and its sub-parts use modern encoding now Signed-off-by: Greg Farnum --- src/mds/events/EMetaBlob.h | 59 ++++++++++++++------------------------ 1 file changed, 22 insertions(+), 37 deletions(-) diff --git a/src/mds/events/EMetaBlob.h b/src/mds/events/EMetaBlob.h index d0279c8dc85b6..d241c508b8238 100644 --- a/src/mds/events/EMetaBlob.h +++ b/src/mds/events/EMetaBlob.h @@ -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); } -- 2.39.5