]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: old_rstat_t now uses modern encoding
authorGreg Farnum <greg@inktank.com>
Wed, 16 Jan 2013 01:33:57 +0000 (17:33 -0800)
committerGreg Farnum <greg@inktank.com>
Fri, 8 Feb 2013 21:17:51 +0000 (13:17 -0800)
Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: Greg Farnum <greg@inktank.com>
src/mds/mdstypes.cc
src/mds/mdstypes.h
src/test/encoding/types.h

index eb2249885368391bc1e9caab6ae48dcd32fa8898..545030b5957302a549d716b33dc4320cfbea2878 100644 (file)
@@ -506,6 +506,49 @@ void fnode_t::generate_test_instances(list<fnode_t*>& 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<old_rstat_t*>& ls)
+{
+  ls.push_back(new old_rstat_t());
+  ls.push_back(new old_rstat_t());
+  ls.back()->first = 12;
+  list<nest_info_t*> nls;
+  nest_info_t::generate_test_instances(nls);
+  ls.back()->rstat = *nls.back();
+  ls.back()->accounted_rstat = *nls.front();
+}
+
 /*
  * session_info_t
  */
index d201a8986903daefcd2f336208ba096113b16073..76a159c33ea69551fd72f291db0898c32f81015b 100644 (file)
@@ -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<old_rstat_t*>& ls);
 };
 WRITE_CLASS_ENCODER(old_rstat_t)
 
index 765b7d0a49f0fea9476286555a4274e206570507..cc7e3ec862d8b6d5826c1f477d89e7b9a5d83376 100644 (file)
@@ -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)