From d1af5b060c5ed12db83f65a9eb951edf31ebf910 Mon Sep 17 00:00:00 2001 From: Jianpeng Ma Date: Sat, 3 Mar 2018 00:33:00 +0800 Subject: [PATCH] os/bluestore/BlueFS: cleanup code for more readable. And remove the useless judgement. Signed-off-by: Jianpeng Ma --- src/os/bluestore/BlueFS.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 35b4be35b85..7ac3fe7a095 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -218,12 +218,12 @@ int BlueFS::reclaim_blocks(unsigned id, uint64_t want, assert(got != 0); if (got < (int64_t)want) { alloc[id]->unreserve(want - std::max(0, got)); - } - if (got < 0) { - derr << __func__ << " failed to allocate space to return to bluestore" - << dendl; - alloc[id]->dump(); - return got; + if (got < 0) { + derr << __func__ << " failed to allocate space to return to bluestore" + << dendl; + alloc[id]->dump(); + return got; + } } for (auto& p : *extents) { @@ -235,8 +235,7 @@ int BlueFS::reclaim_blocks(unsigned id, uint64_t want, r = _flush_and_sync_log(l); assert(r == 0); - if (logger) - logger->inc(l_bluefs_reclaim_bytes, got); + logger->inc(l_bluefs_reclaim_bytes, got); dout(1) << __func__ << " bdev " << id << " want 0x" << std::hex << want << " got " << *extents << dendl; return 0; -- 2.39.5