Skip to content

Commit

Permalink
os/bluestore: fix assertion in StupidAllocator::get_fragmentation
Browse files Browse the repository at this point in the history
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>
(cherry picked from commit a60b231)
  • Loading branch information
ifed01 committed Aug 21, 2018
1 parent 162becb commit 237ddf4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/os/bluestore/StupidAllocator.cc
Expand Up @@ -281,7 +281,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();
}
Expand Down

0 comments on commit 237ddf4

Please sign in to comment.