]> git-server-git.apps.pok.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:10:02 +0000 (12:10 -0300)
commit4eb4a3db01ab027594fb6e03f6c107484e73f58f
tree29bc98256e7f4ac1a98fbccb8a809738471a689f
parenta3ea37622ee2d0df6f213ac835d00895ad55e8d4
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