mirror of
https://github.com/ceph/ceph
synced 2025-01-02 00:52:22 +00:00
os/bluestore/AvlAllocator: use cbit for counting the order of alignment
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>
This commit is contained in:
parent
9b52ba1dd0
commit
573cbb796e
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user