Skip to content

Commit

Permalink
os/bluestore: recalc_allocated() when decoding bluefs_fnode_t
Browse files Browse the repository at this point in the history
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 25514e0)
Conflicts:
	src/os/bluestore/bluefs_types.h: replace C++17 stuff with C++11
counterparts.
  • Loading branch information
tchaikov committed Mar 12, 2018
1 parent cd12851 commit c7c4e27
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/os/bluestore/BlueFS.cc
Expand Up @@ -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) {
Expand Down
19 changes: 18 additions & 1 deletion src/os/bluestore/bluefs_types.h
Expand Up @@ -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);
Expand Down

0 comments on commit c7c4e27

Please sign in to comment.