]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: add discard in BlueFS and BlueStore
authorTaeksang Kim <voidbag@gmail.com>
Sat, 22 Apr 2017 06:32:20 +0000 (15:32 +0900)
committerTaeksang Kim <voidbag@gmail.com>
Tue, 20 Feb 2018 15:00:52 +0000 (00:00 +0900)
discard is added to BlueFS.cc and BlueStore.cc

Signed-off-by: Taeksang Kim <voidbag@gmail.com>
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueStore.cc

index 5c3c2e0bac1a768a53f103880f93b68460443fdc..94a3b9044257b4144f9dc98869981482a47c8ab6 100644 (file)
@@ -1572,6 +1572,9 @@ int BlueFS::_flush_and_sync_log(std::unique_lock<std::mutex>& l,
   for (unsigned i = 0; i < to_release.size(); ++i) {
     if (!to_release[i].empty()) {
       /* OK, now we have the guarantee alloc[i] won't be null. */
+      for (auto p = to_release[i].begin(); p != to_release[i].end(); ++p) {
+        bdev[i]->discard(p.get_start(), p.get_len());
+      }
       alloc[i]->release(to_release[i]);
     }
   }
index bd38f32cb1bd16d36b71755220154ba9151218cb..2d0d8ecdc72623187f8c29a93a5046d519af0ebd 100644 (file)
@@ -8286,6 +8286,11 @@ void BlueStore::_txc_release_alloc(TransContext *txc)
 {
   // it's expected we're called with lazy_release_lock already taken!
   if (likely(!cct->_conf->bluestore_debug_no_reuse_blocks)) {
+    for (interval_set<uint64_t>::iterator p = txc->released.begin();
+        p != txc->released.end();
+        ++p) {
+      bdev->discard(p.get_start(), p.get_len());
+    }
     dout(10) << __func__ << " " << txc << " " << std::hex
              << txc->released << std::dec << dendl;
     alloc->release(txc->released);