}
for (unsigned i = 0; i < to_release.size(); ++i) {
- for (auto p = to_release[i].begin(); p != to_release[i].end(); ++p) {
- alloc[i]->release(p.get_start(), p.get_len());
+ if (!to_release[i].empty()) {
+ /* OK, now we have the guarantee alloc[i] won't be null. */
+ alloc[i]->release(to_release[i]);
}
}
if (r < 0 || (alloc_len < (int64_t)left)) {
if (r == 0) {
alloc[id]->unreserve(left - alloc_len);
+ interval_set<uint64_t> to_release;
for (auto& p : extents) {
- alloc[id]->release(p.offset, p.length);
+ to_release.insert(p.offset, p.length);
}
+ alloc[id]->release(to_release);
}
if (id != BDEV_SLOW) {
if (bdev[id]) {