Skip to content

Commit

Permalink
Merge pull request #10379 from xiexingguo/xxg-wip-bluestore-2016-07-21
Browse files Browse the repository at this point in the history
os/bluestore: fix bitmap allocating failure if max_alloc_size is 0

Mark's Comments:

This passed Jenkins checks.
This passed "ceph_test_objectstore --gtest_filter=*/2".
This PR did not appear to have a significant impact on performance tests.

Reviewed-by: Mark Nelson <mnelson@redhat.com>
  • Loading branch information
markhpc committed Jul 29, 2016
2 parents efc68bc + a55bd6d commit e7cfdc8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/os/bluestore/BitMapAllocator.cc
Expand Up @@ -191,8 +191,8 @@ int BitMapAllocator::alloc_extents_cont(

while (need_blks > 0) {
int64_t count = 0;
count = m_bit_alloc->alloc_blocks_res(need_blks > max_blks? max_blks: need_blks,
&start_blk);
count = m_bit_alloc->alloc_blocks_res(
(max_blks && need_blks > max_blks) ? max_blks : need_blks, &start_blk);
if (count == 0) {
break;
}
Expand Down
9 changes: 4 additions & 5 deletions src/os/bluestore/BlueFS.cc
Expand Up @@ -1397,13 +1397,12 @@ int BlueFS::_allocate(uint8_t id, uint64_t len, vector<bluefs_extent_t> *ev)

r = alloc[id]->alloc_extents(left, min_alloc_size,
hint, &extents, &count);
assert(r == 0);
if (r < 0) {
assert(0 == "allocate failed... wtf");
return r;
}
for (int i = 0; i < count; i++) {
bluefs_extent_t e = bluefs_extent_t(id, extents[i].offset, extents[i].length);
if (r < 0) {
assert(0 == "allocate failed... wtf");
return r;
}
if (!ev->empty() && ev->back().end() == (uint64_t) e.offset) {
ev->back().length += e.length;
} else {
Expand Down

0 comments on commit e7cfdc8

Please sign in to comment.