]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/AvlAllocator: use cbit for counting the order of alignment 41825/head
authorKefu Chai <kchai@redhat.com>
Wed, 2 Jun 2021 08:31:18 +0000 (16:31 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 12 Jun 2021 05:16:17 +0000 (13:16 +0800)
no need to calculate the alignment first, cbits() would suffice. as it
counts the first set bit and the follow 0's in a number. the result
is identical to the cbit(alignment of that number).

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/os/bluestore/AvlAllocator.cc

index 0390e6d6ce9a0ecc0e5b9707ca83c1d4dfa31620..f3b721e87658ee117d5d33258dc2d98842962332 100644 (file)
@@ -266,10 +266,7 @@ int AvlAllocator::_allocate(
        * not guarantee that other allocations sizes may exist in the same
        * region.
        */
-      uint64_t align = size & -size;
-      ceph_assert(align != 0);
-      uint64_t* cursor = &lbas[cbits(align) - 1];
-
+      uint64_t* cursor = &lbas[cbits(size) - 1];
       start = _pick_block_after(cursor, size, unit);
       dout(20) << __func__ << " first fit=" << start << " size=" << size << dendl;
       if (start != uint64_t(-1ULL)) {