Skip to content

Commit

Permalink
os/bluestore: fix allocation vs reservation for bluefs extents
Browse files Browse the repository at this point in the history
- drop the MIN cruft
- unreserve what we didn't get

Signed-off-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed Jan 8, 2016
1 parent ece7ef2 commit a87470e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/os/bluestore/BlueStore.cc
Expand Up @@ -1430,12 +1430,14 @@ int BlueStore::_balance_bluefs_freespace(vector<bluestore_extent_t> *extents)
assert(r == 0);

bluestore_extent_t e;
r = alloc->allocate(MIN(gift, 1ull<<31), min_alloc_size, 0,
&e.offset, &e.length);
r = alloc->allocate(gift, min_alloc_size, 0, &e.offset, &e.length);
if (r < 0) {
assert(0 == "allocate failed, wtf");
return r;
}
if (e.length < gift) {
alloc->unreserve(gift - e.length);
}

dout(1) << __func__ << " gifting " << e << " to bluefs" << dendl;
extents->push_back(e);
Expand Down

0 comments on commit a87470e

Please sign in to comment.