From: xie xingguo Date: Wed, 6 Jul 2016 03:40:10 +0000 (+0800) Subject: os/bluestore: simplify is_exhausted() method X-Git-Tag: ses5-milestone5~437^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0c86d5ec0f05da1210262488df43ce69841cc4d3;p=ceph.git os/bluestore: simplify is_exhausted() method Signed-off-by: xie xingguo --- diff --git a/src/os/bluestore/BitAllocator.cc b/src/os/bluestore/BitAllocator.cc index 190962afc08..96528826e27 100644 --- a/src/os/bluestore/BitAllocator.cc +++ b/src/os/bluestore/BitAllocator.cc @@ -419,11 +419,7 @@ BitMapZone::~BitMapZone() bool BitMapZone::is_exhausted() { debug_assert(check_locked()); - if (get_used_blocks() == size()) { - return true; - } else { - return false; - } + return get_used_blocks() == size(); } bool BitMapZone::is_allocated(int64_t start_block, int64_t num_blocks) @@ -523,10 +519,7 @@ void BitMapZone::lock_excl() bool BitMapZone::lock_excl_try() { - if (m_lock.try_lock()) { - return true; - } - return false; + return m_lock.try_lock(); } void BitMapZone::unlock() @@ -793,10 +786,7 @@ void BitMapAreaIN::child_unlock(BitMapArea *child) bool BitMapAreaIN::is_exhausted() { - if (get_used_blocks() == size()) { - return true; - } - return false; + return get_used_blocks() == size(); } int64_t BitMapAreaIN::add_used_blocks(int64_t blks)