]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/mds/mdstypes.cc
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / mds / mdstypes.cc
index 8ca1ced1bdf5aba2fd0e8c8954fd545285ebb501..20a2d2d5788017b1db50a5108268912247962443 100644 (file)
@@ -6,7 +6,6 @@
 #include "common/Formatter.h"
 
 const mds_gid_t MDS_GID_NONE = mds_gid_t(0);
-const mds_rank_t MDS_RANK_NONE = mds_rank_t(-1);
 
 
 /*
@@ -16,23 +15,23 @@ const mds_rank_t MDS_RANK_NONE = mds_rank_t(-1);
 void frag_info_t::encode(bufferlist &bl) const
 {
   ENCODE_START(3, 2, bl);
-  ::encode(version, bl);
-  ::encode(mtime, bl);
-  ::encode(nfiles, bl);
-  ::encode(nsubdirs, bl);
-  ::encode(change_attr, bl);
+  encode(version, bl);
+  encode(mtime, bl);
+  encode(nfiles, bl);
+  encode(nsubdirs, bl);
+  encode(change_attr, bl);
   ENCODE_FINISH(bl);
 }
 
-void frag_info_t::decode(bufferlist::iterator &bl)
+void frag_info_t::decode(bufferlist::const_iterator &bl)
 {
   DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl);
-  ::decode(version, bl);
-  ::decode(mtime, bl);
-  ::decode(nfiles, bl);
-  ::decode(nsubdirs, bl);
+  decode(version, bl);
+  decode(mtime, bl);
+  decode(nfiles, bl);
+  decode(nsubdirs, bl);
   if (struct_v >= 3)
-    ::decode(change_attr, bl);
+    decode(change_attr, bl);
   else
     change_attr = 0;
   DECODE_FINISH(bl);
@@ -77,33 +76,33 @@ ostream& operator<<(ostream &out, const frag_info_t &f)
 void nest_info_t::encode(bufferlist &bl) const
 {
   ENCODE_START(3, 2, bl);
-  ::encode(version, bl);
-  ::encode(rbytes, bl);
-  ::encode(rfiles, bl);
-  ::encode(rsubdirs, bl);
+  encode(version, bl);
+  encode(rbytes, bl);
+  encode(rfiles, bl);
+  encode(rsubdirs, bl);
   {
     // removed field
     int64_t ranchors = 0;
-    ::encode(ranchors, bl);
+    encode(ranchors, bl);
   }
-  ::encode(rsnaprealms, bl);
-  ::encode(rctime, bl);
+  encode(rsnaps, bl);
+  encode(rctime, bl);
   ENCODE_FINISH(bl);
 }
 
-void nest_info_t::decode(bufferlist::iterator &bl)
+void nest_info_t::decode(bufferlist::const_iterator &bl)
 {
   DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl);
-  ::decode(version, bl);
-  ::decode(rbytes, bl);
-  ::decode(rfiles, bl);
-  ::decode(rsubdirs, bl);
+  decode(version, bl);
+  decode(rbytes, bl);
+  decode(rfiles, bl);
+  decode(rsubdirs, bl);
   {
     int64_t ranchors;
-    ::decode(ranchors, bl);
+    decode(ranchors, bl);
   }
-  ::decode(rsnaprealms, bl);
-  ::decode(rctime, bl);
+  decode(rsnaps, bl);
+  decode(rctime, bl);
   DECODE_FINISH(bl);
 }
 
@@ -113,7 +112,7 @@ void nest_info_t::dump(Formatter *f) const
   f->dump_unsigned("rbytes", rbytes);
   f->dump_unsigned("rfiles", rfiles);
   f->dump_unsigned("rsubdirs", rsubdirs);
-  f->dump_unsigned("rsnaprealms", rsnaprealms);
+  f->dump_unsigned("rsnaps", rsnaps);
   f->dump_stream("rctime") << rctime;
 }
 
@@ -125,7 +124,7 @@ void nest_info_t::generate_test_instances(list<nest_info_t*>& ls)
   ls.back()->rbytes = 2;
   ls.back()->rfiles = 3;
   ls.back()->rsubdirs = 4;
-  ls.back()->rsnaprealms = 6;
+  ls.back()->rsnaps = 6;
   ls.back()->rctime = utime_t(7, 8);
 }
 
@@ -138,8 +137,8 @@ ostream& operator<<(ostream &out, const nest_info_t &n)
     out << " rc" << n.rctime;
   if (n.rbytes)
     out << " b" << n.rbytes;
-  if (n.rsnaprealms)
-    out << " sr" << n.rsnaprealms;
+  if (n.rsnaps)
+    out << " rs" << n.rsnaps;
   if (n.rfiles || n.rsubdirs)
     out << " " << n.rsize() << "=" << n.rfiles << "+" << n.rsubdirs;
   out << ")";    
@@ -179,18 +178,18 @@ ostream& operator<<(ostream &out, const quota_info_t &n)
 void client_writeable_range_t::encode(bufferlist &bl) const
 {
   ENCODE_START(2, 2, bl);
-  ::encode(range.first, bl);
-  ::encode(range.last, bl);
-  ::encode(follows, bl);
+  encode(range.first, bl);
+  encode(range.last, bl);
+  encode(follows, bl);
   ENCODE_FINISH(bl);
 }
 
-void client_writeable_range_t::decode(bufferlist::iterator& bl)
+void client_writeable_range_t::decode(bufferlist::const_iterator& bl)
 {
   DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
-  ::decode(range.first, bl);
-  ::decode(range.last, bl);
-  ::decode(follows, bl);
+  decode(range.first, bl);
+  decode(range.last, bl);
+  decode(follows, bl);
   DECODE_FINISH(bl);
 }
 
@@ -222,19 +221,21 @@ ostream& operator<<(ostream& out, const client_writeable_range_t& r)
  */
 void inline_data_t::encode(bufferlist &bl) const
 {
-  ::encode(version, bl);
+  using ceph::encode;
+  encode(version, bl);
   if (blp)
-    ::encode(*blp, bl);
+    encode(*blp, bl);
   else
-    ::encode(bufferlist(), bl);
+    encode(bufferlist(), bl);
 }
-void inline_data_t::decode(bufferlist::iterator &p)
+void inline_data_t::decode(bufferlist::const_iterator &p)
 {
-  ::decode(version, p);
+  using ceph::decode;
+  decode(version, p);
   uint32_t inline_len;
-  ::decode(inline_len, p);
+  decode(inline_len, p);
   if (inline_len > 0)
-    ::decode_nohead(inline_len, get_data(), p);
+    decode_nohead(inline_len, get_data(), p);
   else
     free_data();
 }
@@ -246,37 +247,37 @@ void inline_data_t::decode(bufferlist::iterator &p)
 void fnode_t::encode(bufferlist &bl) const
 {
   ENCODE_START(4, 3, bl);
-  ::encode(version, bl);
-  ::encode(snap_purged_thru, bl);
-  ::encode(fragstat, bl);
-  ::encode(accounted_fragstat, bl);
-  ::encode(rstat, bl);
-  ::encode(accounted_rstat, bl);
-  ::encode(damage_flags, bl);
-  ::encode(recursive_scrub_version, bl);
-  ::encode(recursive_scrub_stamp, bl);
-  ::encode(localized_scrub_version, bl);
-  ::encode(localized_scrub_stamp, bl);
+  encode(version, bl);
+  encode(snap_purged_thru, bl);
+  encode(fragstat, bl);
+  encode(accounted_fragstat, bl);
+  encode(rstat, bl);
+  encode(accounted_rstat, bl);
+  encode(damage_flags, bl);
+  encode(recursive_scrub_version, bl);
+  encode(recursive_scrub_stamp, bl);
+  encode(localized_scrub_version, bl);
+  encode(localized_scrub_stamp, bl);
   ENCODE_FINISH(bl);
 }
 
-void fnode_t::decode(bufferlist::iterator &bl)
+void fnode_t::decode(bufferlist::const_iterator &bl)
 {
   DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl);
-  ::decode(version, bl);
-  ::decode(snap_purged_thru, bl);
-  ::decode(fragstat, bl);
-  ::decode(accounted_fragstat, bl);
-  ::decode(rstat, bl);
-  ::decode(accounted_rstat, bl);
+  decode(version, bl);
+  decode(snap_purged_thru, bl);
+  decode(fragstat, bl);
+  decode(accounted_fragstat, bl);
+  decode(rstat, bl);
+  decode(accounted_rstat, bl);
   if (struct_v >= 3) {
-    ::decode(damage_flags, bl);
+    decode(damage_flags, bl);
   }
   if (struct_v >= 4) {
-    ::decode(recursive_scrub_version, bl);
-    ::decode(recursive_scrub_stamp, bl);
-    ::decode(localized_scrub_version, bl);
-    ::decode(localized_scrub_stamp, bl);
+    decode(recursive_scrub_version, bl);
+    decode(recursive_scrub_stamp, bl);
+    decode(localized_scrub_version, bl);
+    decode(localized_scrub_stamp, bl);
   }
   DECODE_FINISH(bl);
 }
@@ -326,18 +327,18 @@ void fnode_t::generate_test_instances(list<fnode_t*>& ls)
 void old_rstat_t::encode(bufferlist& bl) const
 {
   ENCODE_START(2, 2, bl);
-  ::encode(first, bl);
-  ::encode(rstat, bl);
-  ::encode(accounted_rstat, bl);
+  encode(first, bl);
+  encode(rstat, bl);
+  encode(accounted_rstat, bl);
   ENCODE_FINISH(bl);
 }
 
-void old_rstat_t::decode(bufferlist::iterator& bl)
+void old_rstat_t::decode(bufferlist::const_iterator& bl)
 {
   DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
-  ::decode(first, bl);
-  ::decode(rstat, bl);
-  ::decode(accounted_rstat, bl);
+  decode(first, bl);
+  decode(rstat, bl);
+  decode(accounted_rstat, bl);
   DECODE_FINISH(bl);
 }
 
@@ -363,48 +364,153 @@ void old_rstat_t::generate_test_instances(list<old_rstat_t*>& ls)
   ls.back()->accounted_rstat = *nls.front();
 }
 
+/*
+ * feature_bitset_t
+ */
+feature_bitset_t::feature_bitset_t(unsigned long value)
+{
+  if (value) {
+    for (size_t i = 0; i < sizeof(value) * 8; i += bits_per_block) {
+      _vec.push_back((block_type)(value >> i));
+    }
+  }
+}
+
+feature_bitset_t::feature_bitset_t(const vector<size_t>& array)
+{
+  if (!array.empty()) {
+    size_t n = array.back();
+    n += bits_per_block;
+    n /= bits_per_block;
+    _vec.resize(n, 0);
+
+    size_t last = 0;
+    for (auto& bit : array) {
+      if (bit > last)
+       last = bit;
+      else
+       ceph_assert(bit == last);
+      _vec[bit / bits_per_block] |= (block_type)1 << (bit % bits_per_block);
+    }
+  }
+}
+
+feature_bitset_t& feature_bitset_t::operator-=(const feature_bitset_t& other)
+{
+  for (size_t i = 0; i < _vec.size(); ++i) {
+    if (i >= other._vec.size())
+      break;
+    _vec[i] &= ~other._vec[i];
+  }
+  return *this;
+}
+
+void feature_bitset_t::encode(bufferlist& bl) const {
+  using ceph::encode;
+  using ceph::encode_nohead;
+  uint32_t len = _vec.size() * sizeof(block_type);
+  encode(len, bl);
+  encode_nohead(_vec, bl);
+}
+
+void feature_bitset_t::decode(bufferlist::const_iterator &p) {
+  using ceph::decode;
+  using ceph::decode_nohead;
+  uint32_t len;
+  decode(len, p);
+
+  _vec.clear();
+  if (len >= sizeof(block_type))
+    decode_nohead(len / sizeof(block_type), _vec, p);
+
+  if (len % sizeof(block_type)) {
+    ceph_le64 buf{};
+    p.copy(len % sizeof(block_type), (char*)&buf);
+    _vec.push_back((block_type)buf);
+  }
+}
+
+void feature_bitset_t::print(ostream& out) const
+{
+  std::ios_base::fmtflags f(out.flags());
+  for (int i = _vec.size() - 1; i >= 0; --i)
+    out << std::setfill('0') << std::setw(sizeof(block_type) * 2)
+        << std::hex << _vec[i];
+  out.flags(f);
+}
+
+/*
+ * client_metadata_t
+ */
+void client_metadata_t::encode(bufferlist& bl) const
+{
+  ENCODE_START(2, 1, bl);
+  encode(kv_map, bl);
+  encode(features, bl);
+  ENCODE_FINISH(bl);
+}
+
+void client_metadata_t::decode(bufferlist::const_iterator& p)
+{
+  DECODE_START(2, p);
+  decode(kv_map, p);
+  if (struct_v >= 2)
+    decode(features, p);
+  DECODE_FINISH(p);
+}
+
+void client_metadata_t::dump(Formatter *f) const
+{
+  f->dump_stream("features") << features;
+  for (const auto& p : kv_map)
+    f->dump_string(p.first.c_str(), p.second);
+}
+
 /*
  * session_info_t
  */
 void session_info_t::encode(bufferlist& bl, uint64_t features) const
 {
-  ENCODE_START(6, 3, bl);
-  ::encode(inst, bl, features);
-  ::encode(completed_requests, bl);
-  ::encode(prealloc_inos, bl);   // hacky, see below.
-  ::encode(used_inos, bl);
-  ::encode(client_metadata, bl);
-  ::encode(completed_flushes, bl);
-  ::encode(auth_name, bl);
+  ENCODE_START(7, 7, bl);
+  encode(inst, bl, features);
+  encode(completed_requests, bl);
+  encode(prealloc_inos, bl);   // hacky, see below.
+  encode(used_inos, bl);
+  encode(completed_flushes, bl);
+  encode(auth_name, bl);
+  encode(client_metadata, bl);
   ENCODE_FINISH(bl);
 }
 
-void session_info_t::decode(bufferlist::iterator& p)
+void session_info_t::decode(bufferlist::const_iterator& p)
 {
-  DECODE_START_LEGACY_COMPAT_LEN(6, 2, 2, p);
-  ::decode(inst, p);
+  DECODE_START_LEGACY_COMPAT_LEN(7, 2, 2, p);
+  decode(inst, p);
   if (struct_v <= 2) {
     set<ceph_tid_t> s;
-    ::decode(s, p);
+    decode(s, p);
     while (!s.empty()) {
       completed_requests[*s.begin()] = inodeno_t();
       s.erase(s.begin());
     }
   } else {
-    ::decode(completed_requests, p);
+    decode(completed_requests, p);
   }
-  ::decode(prealloc_inos, p);
-  ::decode(used_inos, p);
+  decode(prealloc_inos, p);
+  decode(used_inos, p);
   prealloc_inos.insert(used_inos);
   used_inos.clear();
-  if (struct_v >= 4) {
-    ::decode(client_metadata, p);
+  if (struct_v >= 4 && struct_v < 7) {
+    decode(client_metadata.kv_map, p);
   }
   if (struct_v >= 5) {
-    ::decode(completed_flushes, p);
+    decode(completed_flushes, p);
   }
   if (struct_v >= 6) {
-    ::decode(auth_name, p);
+    decode(auth_name, p);
+  }
+  if (struct_v >= 7) {
+    decode(client_metadata, p);
   }
   DECODE_FINISH(p);
 }
@@ -446,10 +552,9 @@ void session_info_t::dump(Formatter *f) const
   }
   f->close_section();
 
-  for (map<string, string>::const_iterator i = client_metadata.begin();
-      i != client_metadata.end(); ++i) {
-    f->dump_string(i->first.c_str(), i->second);
-  }
+  f->open_array_section("client_metadata");
+  client_metadata.dump(f);
+  f->close_section();
 }
 
 void session_info_t::generate_test_instances(list<session_info_t*>& ls)
@@ -471,16 +576,16 @@ void session_info_t::generate_test_instances(list<session_info_t*>& ls)
 void string_snap_t::encode(bufferlist& bl) const
 {
   ENCODE_START(2, 2, bl);
-  ::encode(name, bl);
-  ::encode(snapid, bl);
+  encode(name, bl);
+  encode(snapid, bl);
   ENCODE_FINISH(bl);
 }
 
-void string_snap_t::decode(bufferlist::iterator& bl)
+void string_snap_t::decode(bufferlist::const_iterator& bl)
 {
   DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
-  ::decode(name, bl);
-  ::decode(snapid, bl);
+  decode(name, bl);
+  decode(snapid, bl);
   DECODE_FINISH(bl);
 }
 
@@ -508,20 +613,20 @@ void string_snap_t::generate_test_instances(list<string_snap_t*>& ls)
 void MDSCacheObjectInfo::encode(bufferlist& bl) const
 {
   ENCODE_START(2, 2, bl);
-  ::encode(ino, bl);
-  ::encode(dirfrag, bl);
-  ::encode(dname, bl);
-  ::encode(snapid, bl);
+  encode(ino, bl);
+  encode(dirfrag, bl);
+  encode(dname, bl);
+  encode(snapid, bl);
   ENCODE_FINISH(bl);
 }
 
-void MDSCacheObjectInfo::decode(bufferlist::iterator& p)
+void MDSCacheObjectInfo::decode(bufferlist::const_iterator& p)
 {
   DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, p);
-  ::decode(ino, p);
-  ::decode(dirfrag, p);
-  ::decode(dname, p);
-  ::decode(snapid, p);
+  decode(ino, p);
+  decode(dirfrag, p);
+  decode(dname, p);
+  decode(snapid, p);
   DECODE_FINISH(p);
 }
 
@@ -554,18 +659,18 @@ void MDSCacheObjectInfo::generate_test_instances(list<MDSCacheObjectInfo*>& ls)
 void mds_table_pending_t::encode(bufferlist& bl) const
 {
   ENCODE_START(2, 2, bl);
-  ::encode(reqid, bl);
-  ::encode(mds, bl);
-  ::encode(tid, bl);
+  encode(reqid, bl);
+  encode(mds, bl);
+  encode(tid, bl);
   ENCODE_FINISH(bl);
 }
 
-void mds_table_pending_t::decode(bufferlist::iterator& bl)
+void mds_table_pending_t::decode(bufferlist::const_iterator& bl)
 {
   DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
-  ::decode(reqid, bl);
-  ::decode(mds, bl);
-  ::decode(tid, bl);
+  decode(reqid, bl);
+  decode(mds, bl);
+  decode(tid, bl);
   DECODE_FINISH(bl);
 }
 
@@ -593,21 +698,21 @@ void inode_load_vec_t::encode(bufferlist &bl) const
 {
   ENCODE_START(2, 2, bl);
   for (const auto &i : vec) {
-    ::encode(i, bl);
+    encode(i, bl);
   }
   ENCODE_FINISH(bl);
 }
 
-void inode_load_vec_t::decode(const utime_t &t, bufferlist::iterator &p)
+void inode_load_vec_t::decode(bufferlist::const_iterator &p)
 {
   DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, p);
   for (auto &i : vec) {
-    ::decode(i, t, p);
+    decode(i, p);
   }
   DECODE_FINISH(p);
 }
 
-void inode_load_vec_t::dump(Formatter *f)
+void inode_load_vec_t::dump(Formatter *f) const
 {
   f->open_array_section("Decay Counters");
   for (const auto &i : vec) {
@@ -620,8 +725,7 @@ void inode_load_vec_t::dump(Formatter *f)
 
 void inode_load_vec_t::generate_test_instances(list<inode_load_vec_t*>& ls)
 {
-  utime_t sample;
-  ls.push_back(new inode_load_vec_t(sample));
+  ls.push_back(new inode_load_vec_t(DecayRate()));
 }
 
 
@@ -639,20 +743,19 @@ void dirfrag_load_vec_t::dump(Formatter *f) const
   f->close_section();
 }
 
-void dirfrag_load_vec_t::dump(Formatter *f, utime_t now, const DecayRate& rate)
+void dirfrag_load_vec_t::dump(Formatter *f, const DecayRate& rate) const
 {
-  f->dump_float("meta_load", meta_load(now, rate));
-  f->dump_float("IRD", get(META_POP_IRD).get(now, rate));
-  f->dump_float("IWR", get(META_POP_IWR).get(now, rate));
-  f->dump_float("READDIR", get(META_POP_READDIR).get(now, rate));
-  f->dump_float("FETCH", get(META_POP_FETCH).get(now, rate));
-  f->dump_float("STORE", get(META_POP_STORE).get(now, rate));
+  f->dump_float("meta_load", meta_load());
+  f->dump_float("IRD", get(META_POP_IRD).get());
+  f->dump_float("IWR", get(META_POP_IWR).get());
+  f->dump_float("READDIR", get(META_POP_READDIR).get());
+  f->dump_float("FETCH", get(META_POP_FETCH).get());
+  f->dump_float("STORE", get(META_POP_STORE).get());
 }
 
-void dirfrag_load_vec_t::generate_test_instances(list<dirfrag_load_vec_t*>& ls)
+void dirfrag_load_vec_t::generate_test_instances(std::list<dirfrag_load_vec_t*>& ls)
 {
-  utime_t sample;
-  ls.push_back(new dirfrag_load_vec_t(sample));
+  ls.push_back(new dirfrag_load_vec_t(DecayRate()));
 }
 
 /*
@@ -660,23 +763,23 @@ void dirfrag_load_vec_t::generate_test_instances(list<dirfrag_load_vec_t*>& ls)
  */
 void mds_load_t::encode(bufferlist &bl) const {
   ENCODE_START(2, 2, bl);
-  ::encode(auth, bl);
-  ::encode(all, bl);
-  ::encode(req_rate, bl);
-  ::encode(cache_hit_rate, bl);
-  ::encode(queue_len, bl);
-  ::encode(cpu_load_avg, bl);
+  encode(auth, bl);
+  encode(all, bl);
+  encode(req_rate, bl);
+  encode(cache_hit_rate, bl);
+  encode(queue_len, bl);
+  encode(cpu_load_avg, bl);
   ENCODE_FINISH(bl);
 }
 
-void mds_load_t::decode(const utime_t &t, bufferlist::iterator &bl) {
+void mds_load_t::decode(bufferlist::const_iterator &bl) {
   DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
-  ::decode(auth, t, bl);
-  ::decode(all, t, bl);
-  ::decode(req_rate, bl);
-  ::decode(cache_hit_rate, bl);
-  ::decode(queue_len, bl);
-  ::decode(cpu_load_avg, bl);
+  decode(auth, bl);
+  decode(all, bl);
+  decode(req_rate, bl);
+  decode(cache_hit_rate, bl);
+  decode(queue_len, bl);
+  decode(cpu_load_avg, bl);
   DECODE_FINISH(bl);
 }
 
@@ -694,10 +797,9 @@ void mds_load_t::dump(Formatter *f) const
   f->close_section();
 }
 
-void mds_load_t::generate_test_instances(list<mds_load_t*>& ls)
+void mds_load_t::generate_test_instances(std::list<mds_load_t*>& ls)
 {
-  utime_t sample;
-  ls.push_back(new mds_load_t(sample));
+  ls.push_back(new mds_load_t(DecayRate()));
 }
 
 /*
@@ -706,29 +808,31 @@ void mds_load_t::generate_test_instances(list<mds_load_t*>& ls)
 void cap_reconnect_t::encode(bufferlist& bl) const {
   ENCODE_START(2, 1, bl);
   encode_old(bl); // extract out when something changes
-  ::encode(snap_follows, bl);
+  encode(snap_follows, bl);
   ENCODE_FINISH(bl);
 }
 
 void cap_reconnect_t::encode_old(bufferlist& bl) const {
-  ::encode(path, bl);
+  using ceph::encode;
+  encode(path, bl);
   capinfo.flock_len = flockbl.length();
-  ::encode(capinfo, bl);
-  ::encode_nohead(flockbl, bl);
+  encode(capinfo, bl);
+  encode_nohead(flockbl, bl);
 }
 
-void cap_reconnect_t::decode(bufferlist::iterator& bl) {
-  DECODE_START(1, bl);
+void cap_reconnect_t::decode(bufferlist::const_iterator& bl) {
+  DECODE_START(2, bl);
   decode_old(bl); // extract out when something changes
   if (struct_v >= 2)
-    ::decode(snap_follows, bl);
+    decode(snap_follows, bl);
   DECODE_FINISH(bl);
 }
 
-void cap_reconnect_t::decode_old(bufferlist::iterator& bl) {
-  ::decode(path, bl);
-  ::decode(capinfo, bl);
-  ::decode_nohead(capinfo.flock_len, flockbl, bl);
+void cap_reconnect_t::decode_old(bufferlist::const_iterator& bl) {
+  using ceph::decode;
+  decode(path, bl);
+  decode(capinfo, bl);
+  decode_nohead(capinfo.flock_len, flockbl, bl);
 }
 
 void cap_reconnect_t::dump(Formatter *f) const
@@ -749,6 +853,47 @@ void cap_reconnect_t::generate_test_instances(list<cap_reconnect_t*>& ls)
   ls.back()->capinfo.cap_id = 1;
 }
 
+/*
+ * snaprealm_reconnect_t
+ */
+void snaprealm_reconnect_t::encode(bufferlist& bl) const {
+  ENCODE_START(1, 1, bl);
+  encode_old(bl); // extract out when something changes
+  ENCODE_FINISH(bl);
+}
+
+void snaprealm_reconnect_t::encode_old(bufferlist& bl) const {
+  using ceph::encode;
+  encode(realm, bl);
+}
+
+void snaprealm_reconnect_t::decode(bufferlist::const_iterator& bl) {
+  DECODE_START(1, bl);
+  decode_old(bl); // extract out when something changes
+  DECODE_FINISH(bl);
+}
+
+void snaprealm_reconnect_t::decode_old(bufferlist::const_iterator& bl) {
+  using ceph::decode;
+  decode(realm, bl);
+}
+
+void snaprealm_reconnect_t::dump(Formatter *f) const
+{
+  f->dump_int("ino", realm.ino);
+  f->dump_int("seq", realm.seq);
+  f->dump_int("parent", realm.parent);
+}
+
+void snaprealm_reconnect_t::generate_test_instances(list<snaprealm_reconnect_t*>& ls)
+{
+  ls.push_back(new snaprealm_reconnect_t);
+  ls.back()->realm.ino = 0x10000000001ULL;
+  ls.back()->realm.seq = 2;
+  ls.back()->realm.parent = 1;
+}
+
+
 ostream& operator<<(ostream &out, const mds_role_t &role)
 {
   out << role.fscid << ":" << role.rank;