]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/BlueFS: cleanup code for more readable.
authorJianpeng Ma <jianpeng.ma@intel.com>
Fri, 2 Mar 2018 16:33:00 +0000 (00:33 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Tue, 6 Mar 2018 08:11:17 +0000 (16:11 +0800)
And remove the useless judgement.

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/os/bluestore/BlueFS.cc

index 35b4be35b85581c23f658ec4e7b63cba974cf240..7ac3fe7a095433982de8fe63049180233bae52a3 100644 (file)
@@ -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<int64_t>(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;