]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
blk/kernel: bring "bdev_async_discard" config parameter back. 65608/head
authorIgor Fedotov <igor.fedotov@croit.io>
Wed, 12 Mar 2025 14:42:24 +0000 (17:42 +0300)
committerIgor Fedotov <igor.fedotov@croit.io>
Fri, 19 Sep 2025 23:28:59 +0000 (02:28 +0300)
To ensure backword compatibility for clusters with this parameter
previously set to true.

Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
(cherry picked from commit 7b914cb49d50241b2ed7811d8660fce27a80ae39)

src/blk/kernel/KernelDevice.cc
src/common/options/global.yaml.in

index dd730bba24a1e7115215f460a4de7a250f0e01a9..886635b10fa121504de436c74f53efd2df1a6a34 100644 (file)
@@ -582,6 +582,11 @@ void KernelDevice::_discard_update_threads(bool discard_stop)
 
   uint64_t oldcount = discard_threads.size();
   uint64_t newcount = cct->_conf.get_val<uint64_t>("bdev_async_discard_threads");
+  if (newcount == 0) {
+    //backward compatibility mode to make sure legacy "bdev_async_discard" is
+    // taken into account if set.
+    newcount = cct->_conf.get_val<bool>("bdev_async_discard") ? 1 : 0;
+  }
   if (!cct->_conf.get_val<bool>("bdev_enable_discard") || !support_discard || discard_stop) {
     newcount = 0;
   }
@@ -1616,14 +1621,16 @@ std::vector<std::string> KernelDevice::get_tracked_keys()
 {
   return {
     "bdev_async_discard_threads"s,
-    "bdev_enable_discard"s
+    "bdev_async_discard"s,
+    "bdev_enable_discard"s,
   };
 }
 
 void KernelDevice::handle_conf_change(const ConfigProxy& conf,
                             const std::set <std::string> &changed)
 {
-  if (changed.count("bdev_async_discard_threads") || changed.count("bdev_enable_discard")) {
+  if (changed.count("bdev_async_discard_threads") || changed.count("bdev_async_discard") ||
+      changed.count("bdev_enable_discard")) {
     _discard_update_threads();
   }
 }
index 512e749f53fda7936e6892bdaf21a11e8c9ed7a4..58feb40b92543293f42adfd3d81df43642e08230 100644 (file)
@@ -4150,6 +4150,22 @@ options:
   see_also:
   - bdev_enable_discard
   - bdev_async_discard_max_pending
+- name: bdev_async_discard
+  long_desc: When set this works like an alias for 'bdev_async_discard_threads = 1"
+    mode to avoid implicit async discard mode disablement after upgrade.
+    Ignored if 'dev_asunc_discard_threads' is greater than zero.
+    This parameter is DEPRECATED and provided for backward compatibility for
+    Squid minor releases only.
+    PLEASE SWITCH TO 'bdev_async_discard_threads' USE.
+  type: bool
+  level: advanced
+  default: false
+  with_legacy: false
+  flags:
+  - runtime
+  see_also:
+  - bdev_enable_discard
+  - bdev_async_discard_threads
 - name: bdev_async_discard_max_pending
   desc: maximum number of pending discards
   long_desc: The maximum number of pending async discards that can be queued and not claimed by an