From: Radoslaw Zarzynski Date: Sun, 10 Sep 2017 12:04:45 +0000 (+0200) Subject: os/bluestore: BlueFS releases disk extents in bulky manner. X-Git-Tag: v12.2.12~16^2~26 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8707370dff08548ebb4ca9ad98e9846529c2ba8a;p=ceph.git os/bluestore: BlueFS releases disk extents in bulky manner. Signed-off-by: Radoslaw Zarzynski (cherry picked from commit 16906c0190fa11fb426651a57a789e454a8f737f) --- diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 4e2b3620bef5..da0706549ff0 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -1503,8 +1503,9 @@ int BlueFS::_flush_and_sync_log(std::unique_lock& l, } 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]); } } @@ -1881,9 +1882,11 @@ int BlueFS::_allocate(uint8_t id, uint64_t len, if (r < 0 || (alloc_len < (int64_t)left)) { if (r == 0) { alloc[id]->unreserve(left - alloc_len); + interval_set 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]) {