From 0fe7a0860727a65b5597dcf6f3ff485804ea8e3f Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Tue, 15 Jan 2013 17:33:57 -0800 Subject: [PATCH] mds: old_rstat_t now uses modern encoding Signed-off-by: Sage Weil Signed-off-by: Greg Farnum --- src/mds/mdstypes.cc | 43 +++++++++++++++++++++++++++++++++++++++ src/mds/mdstypes.h | 18 ++++------------ src/test/encoding/types.h | 1 + 3 files changed, 48 insertions(+), 14 deletions(-) diff --git a/src/mds/mdstypes.cc b/src/mds/mdstypes.cc index eb22498853683..545030b595730 100644 --- a/src/mds/mdstypes.cc +++ b/src/mds/mdstypes.cc @@ -506,6 +506,49 @@ void fnode_t::generate_test_instances(list& ls) } +/* + * old_rstat_t + */ +void old_rstat_t::encode(bufferlist& bl) const +{ + ENCODE_START(2, 2, bl); + ::encode(first, bl); + ::encode(rstat, bl); + ::encode(accounted_rstat, bl); + ENCODE_FINISH(bl); +} + +void old_rstat_t::decode(bufferlist::iterator& bl) +{ + DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl); + ::decode(first, bl); + ::decode(rstat, bl); + ::decode(accounted_rstat, bl); + DECODE_FINISH(bl); +} + +void old_rstat_t::dump(Formatter *f) const +{ + f->dump_unsigned("snapid", first); + f->open_object_section("rstat"); + rstat.dump(f); + f->close_section(); + f->open_object_section("accounted_rstat"); + accounted_rstat.dump(f); + f->close_section(); +} + +void old_rstat_t::generate_test_instances(list& ls) +{ + ls.push_back(new old_rstat_t()); + ls.push_back(new old_rstat_t()); + ls.back()->first = 12; + list nls; + nest_info_t::generate_test_instances(nls); + ls.back()->rstat = *nls.back(); + ls.back()->accounted_rstat = *nls.front(); +} + /* * session_info_t */ diff --git a/src/mds/mdstypes.h b/src/mds/mdstypes.h index d201a8986903d..76a159c33ea69 100644 --- a/src/mds/mdstypes.h +++ b/src/mds/mdstypes.h @@ -472,20 +472,10 @@ struct old_rstat_t { snapid_t first; nest_info_t rstat, accounted_rstat; - void encode(bufferlist& bl) const { - __u8 struct_v = 1; - ::encode(struct_v, bl); - ::encode(first, bl); - ::encode(rstat, bl); - ::encode(accounted_rstat, bl); - } - void decode(bufferlist::iterator& bl) { - __u8 struct_v; - ::decode(struct_v, bl); - ::decode(first, bl); - ::decode(rstat, bl); - ::decode(accounted_rstat, bl); - } + void encode(bufferlist& bl) const; + void decode(bufferlist::iterator& p); + void dump(Formatter *f) const; + static void generate_test_instances(list& ls); }; WRITE_CLASS_ENCODER(old_rstat_t) diff --git a/src/test/encoding/types.h b/src/test/encoding/types.h index 765b7d0a49f0f..cc7e3ec862d8b 100644 --- a/src/test/encoding/types.h +++ b/src/test/encoding/types.h @@ -104,6 +104,7 @@ TYPE(client_writeable_range_t) TYPE(inode_t) TYPE(old_inode_t) TYPE(fnode_t) +TYPE(old_rstat_t) TYPE(session_info_t) TYPE(string_snap_t) TYPE(MDSCacheObjectInfo) -- 2.39.5