]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: BlueFS releases disk extents in bulky manner.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Sun, 10 Sep 2017 12:04:45 +0000 (14:04 +0200)
committerIgor Fedotov <ifedotov@suse.com>
Thu, 14 Mar 2019 16:41:03 +0000 (19:41 +0300)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
(cherry picked from commit 16906c0190fa11fb426651a57a789e454a8f737f)

src/os/bluestore/BlueFS.cc

index 4e2b3620bef55584bd2a0397e597ab64eacf2b0e..da0706549ff0940e51d153c8cf4dd84a91d6d9cc 100644 (file)
@@ -1503,8 +1503,9 @@ int BlueFS::_flush_and_sync_log(std::unique_lock<std::mutex>& 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<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]) {