From: Igor Fedotov Date: Thu, 16 Aug 2018 11:51:06 +0000 (+0300) Subject: os/bluestore: fix assertion in StupidAllocator::get_fragmentation X-Git-Tag: v14.0.1~533^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a60b2316ce0bed28c468043cff4cab5e61b1a694;p=ceph.git os/bluestore: fix assertion in StupidAllocator::get_fragmentation One might face an assertion (assert(intervals <= max_intervals)) in StupidAllocator::get_fragmentation method for clusters created by early Luminous releases and before. The root cause is that block volume size wasn't aligned with min_alloc_size and hence we missed that last fraction interval during max_interval calculation. Signed-off-by: Igor Fedotov --- diff --git a/src/os/bluestore/StupidAllocator.cc b/src/os/bluestore/StupidAllocator.cc index dd17c7718f05..5beca2e5cfa1 100644 --- a/src/os/bluestore/StupidAllocator.cc +++ b/src/os/bluestore/StupidAllocator.cc @@ -256,7 +256,7 @@ double StupidAllocator::get_fragmentation(uint64_t alloc_unit) uint64_t intervals = 0; { std::lock_guard l(lock); - max_intervals = num_free / alloc_unit; + max_intervals = p2roundup(num_free, alloc_unit) / alloc_unit; for (unsigned bin = 0; bin < free.size(); ++bin) { intervals += free[bin].num_intervals(); }