]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: fix assertion in StupidAllocator::get_fragmentation 23606/head
authorIgor Fedotov <ifedotov@suse.com>
Thu, 16 Aug 2018 11:51:06 +0000 (14:51 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Thu, 16 Aug 2018 11:51:06 +0000 (14:51 +0300)
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 <ifedotov@suse.com>
src/os/bluestore/StupidAllocator.cc

index dd17c7718f05d2d34589402ad029f76d3a05cd85..5beca2e5cfa123b3137bd3180d1af209a2172526 100644 (file)
@@ -256,7 +256,7 @@ double StupidAllocator::get_fragmentation(uint64_t alloc_unit)
   uint64_t intervals = 0;
   {
     std::lock_guard<std::mutex> 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();
     }