assert(r == 0); // caller shouldn't ask for more than they can get
int64_t got = alloc[id]->allocate(want, g_conf->bluefs_alloc_size, 0,
extents);
- assert(got > 0);
- if (got < (int64_t)want)
- alloc[id]->unreserve(want - got);
+ if (got < (int64_t)want) {
+ alloc[id]->unreserve(want - MAX(0, got));
+ }
+ if (got <= 0) {
+ derr << __func__ << " failed to allocate space to return to bluestore"
+ << dendl;
+ return got;
+ }
for (auto& p : *extents) {
block_all[id].erase(p.offset, p.length);
AllocExtentVector extents;
int r = bluefs->reclaim_blocks(bluefs_shared_bdev, reclaim,
&extents);
- assert(r >= 0);
-
+ if (r < 0) {
+ derr << __func__ << " failed to reclaim space from bluefs"
+ << dendl;
+ break;
+ }
for (auto e : extents) {
bluefs_extents.erase(e.offset, e.length);
bluefs_extents_reclaiming.insert(e.offset, e.length);