]> 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)
committerMauricio Faria de Oliveira <mfo@canonical.com>
Wed, 10 Nov 2021 15:07:56 +0000 (12:07 -0300)
commit8a29f2b9bfb9d27c6443a2143ed7540e31694c4f
tree17e848c4c38b637f1480606541fc2375e2db0e6c
parente36e968de12902fda8305ec5f4b82c98faffa8a9
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>
(cherry picked from commit 4837166f9e7a659742d4184f021ad12260247888)
Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
src/os/bluestore/AvlAllocator.cc
src/os/bluestore/AvlAllocator.h