]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
style changes requested by Igor
authorGabriel BenHanokh <gbenhano@redhat.com>
Wed, 10 Apr 2024 06:57:52 +0000 (06:57 +0000)
committerYite Gu <yitegu0@gmail.com>
Wed, 7 Aug 2024 02:47:01 +0000 (10:47 +0800)
Signed-off-by: Gabriel BenHanokh <gbenhano@redhat.com>
(cherry picked from commit b37080c654122041279d0d2d8a5f367da32169c3)

src/blk/kernel/KernelDevice.cc
src/os/bluestore/BlueStore.cc

index f7980baddf2fad9740f9ecb7335abe61d81e3522..18466648e8eaa3b8edb6a8b90762eb4986d417af 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 = 10;
+      constexpr unsigned MAX_LOCAL_DISCARD = 32;
       unsigned count = 0;
       for (auto p = discard_queued.begin();
           p != discard_queued.end() && count < MAX_LOCAL_DISCARD;
index 4aaf70b7a6fcfda144a9a1baf461016c65ef763f..9cc973b786eba76eb9f9625e1e77d2016269b29d 100644 (file)
@@ -7754,24 +7754,22 @@ void BlueStore::_close_db()
   db = nullptr;
 
   if (do_destage && fm && fm->is_null_manager()) {
-    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) {
+    if (cct->_conf->osd_fast_shutdown) {
+      interval_set<uint64_t> discard_queued;
+      bdev->swap_discard_queued(discard_queued);
       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());
       }
     }
-    // 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
+
+    // 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
     bdev->discard_drain();
     int ret = store_allocator(alloc);
     if (unlikely(ret != 0)) {