From 924fb18fd913910483b814cbdc84b9c28dc02426 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Wed, 16 Jan 2013 16:50:29 -0800 Subject: [PATCH] mds: mds_table_pending_t now uses modern encoding Signed-off-by: Sage Weil Signed-off-by: Greg Farnum --- src/mds/mdstypes.cc | 38 ++++++++++++++++++++++++++++++++++++++ src/mds/mdstypes.h | 19 +++++-------------- src/test/encoding/types.h | 1 + 3 files changed, 44 insertions(+), 14 deletions(-) diff --git a/src/mds/mdstypes.cc b/src/mds/mdstypes.cc index 6f6f9aa19c43c..eb22498853683 100644 --- a/src/mds/mdstypes.cc +++ b/src/mds/mdstypes.cc @@ -660,3 +660,41 @@ void MDSCacheObjectInfo::generate_test_instances(list& ls) ls.back()->dname = "bar foo"; ls.back()->snapid = 21322; } + + +/* + * mds_table_pending_t + */ +void mds_table_pending_t::encode(bufferlist& bl) const +{ + ENCODE_START(2, 2, bl); + ::encode(reqid, bl); + ::encode(mds, bl); + ::encode(tid, bl); + ENCODE_FINISH(bl); +} + +void mds_table_pending_t::decode(bufferlist::iterator& bl) +{ + DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl); + ::decode(reqid, bl); + ::decode(mds, bl); + ::decode(tid, bl); + DECODE_FINISH(bl); +} + +void mds_table_pending_t::dump(Formatter *f) const +{ + f->dump_unsigned("reqid", reqid); + f->dump_unsigned("mds", mds); + f->dump_unsigned("tid", tid); +} + +void mds_table_pending_t::generate_test_instances(list& ls) +{ + ls.push_back(new mds_table_pending_t); + ls.push_back(new mds_table_pending_t); + ls.back()->reqid = 234; + ls.back()->mds = 2; + ls.back()->tid = 35434; +} diff --git a/src/mds/mdstypes.h b/src/mds/mdstypes.h index 32439ffaffd11..d201a8986903d 100644 --- a/src/mds/mdstypes.h +++ b/src/mds/mdstypes.h @@ -625,20 +625,11 @@ struct mds_table_pending_t { uint64_t reqid; __s32 mds; version_t tid; - void encode(bufferlist& bl) const { - __u8 struct_v = 1; - ::encode(struct_v, bl); - ::encode(reqid, bl); - ::encode(mds, bl); - ::encode(tid, bl); - } - void decode(bufferlist::iterator& bl) { - __u8 struct_v; - ::decode(struct_v, bl); - ::decode(reqid, bl); - ::decode(mds, bl); - ::decode(tid, bl); - } + mds_table_pending_t() : reqid(0), mds(0), tid(0) {} + void encode(bufferlist& bl) const; + void decode(bufferlist::iterator& bl); + void dump(Formatter *f) const; + static void generate_test_instances(list& ls); }; WRITE_CLASS_ENCODER(mds_table_pending_t) diff --git a/src/test/encoding/types.h b/src/test/encoding/types.h index b7e798aef34ea..a2fa626e7c351 100644 --- a/src/test/encoding/types.h +++ b/src/test/encoding/types.h @@ -107,6 +107,7 @@ TYPE(fnode_t) TYPE(session_info_t) TYPE(string_snap_t) TYPE(MDSCacheObjectInfo) +TYPE(mds_table_pending_t) #ifdef WITH_RADOSGW -- 2.39.5