From 679ed51748d64d7cc5b01b755f35c0e432924074 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Tue, 17 May 2016 19:44:14 +0800 Subject: [PATCH] os/bluestore/BitMapAllocator: make nblks calculationg simpler and faster Signed-off-by: xie xingguo --- src/os/bluestore/BitMapAllocator.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/os/bluestore/BitMapAllocator.cc b/src/os/bluestore/BitMapAllocator.cc index 22cd3a5217d23..846ba6bc249a7 100644 --- a/src/os/bluestore/BitMapAllocator.cc +++ b/src/os/bluestore/BitMapAllocator.cc @@ -88,8 +88,7 @@ int BitMapAllocator::allocate( { assert(!(alloc_unit % m_block_size)); - int64_t len = NEXT_MULTIPLE(want_size, m_block_size); - int64_t nblks = len / m_block_size; + int64_t nblks = (want_size + m_block_size - 1) / m_block_size; assert(alloc_unit); -- 2.39.5