]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: recalc_allocated() when decoding bluefs_fnode_t 20771/head
authorKefu Chai <kchai@redhat.com>
Mon, 5 Mar 2018 03:32:48 +0000 (11:32 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 12 Mar 2018 10:42:21 +0000 (18:42 +0800)
Fixes: http://tracker.ceph.com/issues/23212
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 25514e0bbd2d21a0f78ac46bfa857db245952cec)
Conflicts:
src/os/bluestore/bluefs_types.h: replace C++17 stuff with C++11
counterparts.

src/os/bluestore/BlueFS.cc
src/os/bluestore/bluefs_types.h

index d2255b407869dbeba2ea7920ad1807d18ffeb012..bd7bcd69abfa3b35232e7f76ddfb66dadd9a559b 100644 (file)
@@ -780,7 +780,6 @@ int BlueFS::_replay(bool noop)
         {
          bluefs_fnode_t fnode;
          ::decode(fnode, p);
-         fnode.recalc_allocated();
          dout(20) << __func__ << " 0x" << std::hex << pos << std::dec
                    << ":  op_file_update " << " " << fnode << dendl;
          if (!noop) {
index 0cb075f52603ef6c896e26a2b741a97d4139a96d..b5bf775cb7b31b44c1d4e07e3419f8fca3e4979a 100644 (file)
@@ -51,7 +51,24 @@ struct bluefs_fnode_t {
       allocated += p.length;
   }
 
-  DENC(bluefs_fnode_t, v, p) {
+  DENC_HELPERS
+  void bound_encode(size_t& p) const {
+    _denc_friend(*this, p);
+  }
+  void encode(bufferlist::contiguous_appender& p) const {
+    DENC_DUMP_PRE(bluefs_fnode_t);
+    _denc_friend(*this, p);
+    DENC_DUMP_POST(bluefs_fnode_t);
+  }
+  void decode(buffer::ptr::iterator& p) {
+    _denc_friend(*this, p);
+    recalc_allocated();
+  }
+  template<typename T, typename P>
+  friend typename std::enable_if<
+    boost::is_same<T,bluefs_fnode_t>::value ||
+    boost::is_same<T,const bluefs_fnode_t>::value>::type
+  _denc_friend(T& v, P& p) {
     DENC_START(1, 1, p);
     denc_varint(v.ino, p);
     denc_varint(v.size, p);