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>
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();
}