]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
os/bluestore/AvlAllocator: specialize _block_picker()
authorKefu Chai <kchai@redhat.com>
Wed, 2 Jun 2021 07:11:30 +0000 (15:11 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 12 Jun 2021 05:13:30 +0000 (13:13 +0800)
commit4837166f9e7a659742d4184f021ad12260247888
tree97969e48b5d3ac27ce91c93f64a4fce391b32ffc
parent7513b24aa5501812db5cc4277cdbd05d402073dc
os/bluestore/AvlAllocator: specialize _block_picker()

before this change AvlAllocator::_block_picker() is used by both the
best-fit mode and first-fit mode. but since we cannot achieve the
locality by searching in the area pointed by curosr in best-fit mode,
we just pass a dummy cursor to AvlAllocator::_block_picker() when
searching in the best-fit mode.

but since the range_size_tree is already sorted by the size of ranges,
if _block_picker() fails to find one by the size, we should just give
up right away, and instead try again using a smaller size.

after this change, instead of sharing AvlAllocator::_block_picker()
across both the first-fit mode and the best-fit mode, this method
is specialize to two different variants: one for first-fit, and the
simplified one for best-fit.

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