]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
bluestore/BitAllocator: simplify calculation of num_child
authorxie xingguo <xie.xingguo@zte.com.cn>
Sat, 4 Jun 2016 03:19:37 +0000 (11:19 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Sat, 4 Jun 2016 03:49:39 +0000 (11:49 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/bluestore/BitAllocator.cc

index 61c8d3ee098156e7a988ce6c2a28b59470a2fb6a..2184963588bbcab25fdcd4656ccb351dfae9d2cb 100644 (file)
@@ -703,11 +703,8 @@ void BitMapAreaIN::init(int64_t total_blocks, int64_t area_idx, bool def)
   init_common(total_blocks, area_idx, def);
   int64_t level_factor = pow(BitMapArea::get_span_size(), m_level);
 
-  num_child = total_blocks / level_factor;
+  num_child = (total_blocks + level_factor - 1) / level_factor;
   debug_assert(num_child < MAX_INT16);
-  if (total_blocks % level_factor) {
-    num_child++;
-  }
 
   m_child_size_blocks = level_factor;