]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "style changes requested by Igor"
authorskanta <skanta@redhat.com>
Tue, 5 Nov 2024 10:48:57 +0000 (16:18 +0530)
committerskanta <skanta@redhat.com>
Tue, 5 Nov 2024 10:48:57 +0000 (16:18 +0530)
This reverts commit c3dc1c4f1b3d048fd3409b0bbc69ee81638298be.
The commit was merged prematurely without testing.

Signed-off-by: Srinivasa Bharath Kanta <skanta@redhat.com>
src/blk/kernel/KernelDevice.cc
src/os/bluestore/BlueStore.cc

index b990f7d15372f98c571b307e995f4f4413340b11..9270b3810f1f99011e70021c204279de91d8ae2a 100644 (file)
@@ -765,7 +765,7 @@ void KernelDevice::_discard_thread(uint64_t tid)
       // This will allow threads to work in parallel
       //      instead of a single thread taking over the whole discard_queued.
       // It will also allow threads to finish in a timely manner.
-      constexpr unsigned MAX_LOCAL_DISCARD = 32;
+      constexpr unsigned MAX_LOCAL_DISCARD = 10;
       unsigned count = 0;
       for (auto p = discard_queued.begin();
           p != discard_queued.end() && count < MAX_LOCAL_DISCARD;
index 4f088203e0f89d89a1f3fd6d7866bf1067b799f9..ba1872ee1cbe5aef14d8dbc3b18b32d7fc26e5ec 100644 (file)
@@ -8038,22 +8038,24 @@ void BlueStore::_close_db()
   db = nullptr;
 
   if (do_destage && fm && fm->is_null_manager()) {
-    if (cct->_conf->osd_fast_shutdown) {
-      interval_set<uint64_t> discard_queued;
-      bdev->swap_discard_queued(discard_queued);
+    if (cct->_conf->osd_fast_shutdown == false) {
+      // graceful shutdown -> commit backgrounds discards before storing allocator
+      bdev->discard_drain();
+    }
+
+    interval_set<uint64_t> discard_queued;
+    bdev->swap_discard_queued(discard_queued);
+    if (discard_queued.num_intervals() > 0) {
       dout(10) << __func__ << "::discard_drain: size=" << discard_queued.size()
               << " num_intervals=" << discard_queued.num_intervals() << dendl;
       // copy discard_queued to the allocator before storing it
       for (auto p = discard_queued.begin(); p != discard_queued.end(); ++p) {
-       dout(20) << __func__ << "::discarded-extent=[" << p.get_start()
-                << ", " << p.get_len() << "]" << dendl;
+       dout(20) << __func__ << "::discarded-extent=[" << p.get_start() << ", " << p.get_len() << "]" << dendl;
        alloc->init_add_free(p.get_start(), p.get_len());
       }
     }
-
-    // When we reach here it is either a graceful shutdown (so can drain the full discards-queue)
-    //   or it was a fast shutdown, but we already moved the main discards-queue to the allocator
-    //   and only need to wait for the threads local discard_processing queues to drain
+    // drain the items in the threads local discard_processing queues
+    // There are only a few items in those queues so it is fine to do so in fast shutdown
     bdev->discard_drain();
     int ret = store_allocator(alloc);
     if (unlikely(ret != 0)) {