]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
blk/kernel: bring "bdev_async_discard" config parameter back.
authorIgor Fedotov <igor.fedotov@croit.io>
Wed, 12 Mar 2025 14:42:24 +0000 (17:42 +0300)
committerIgor Fedotov <igor.fedotov@croit.io>
Tue, 15 Apr 2025 08:51:47 +0000 (11:51 +0300)
To ensure backword compatibility for clusters with this parameter
previously set to true.

Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
src/blk/kernel/KernelDevice.cc
src/common/options/global.yaml.in

index 2fb48790463b2d72f9d81fb6fca519294263c8d0..13b1cf196155499411c7bd6791c3c7bbbab98e4b 100644 (file)
@@ -538,6 +538,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;
   }
@@ -1527,6 +1532,7 @@ const char** KernelDevice::get_tracked_conf_keys() const
 {
   static const char* KEYS[] = {
     "bdev_async_discard_threads",
+    "bdev_async_discard",
     "bdev_enable_discard",
     NULL
   };
@@ -1536,7 +1542,8 @@ const char** KernelDevice::get_tracked_conf_keys() const
 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 2954bcf4a1f8986a76073949bb63e990a4ecddcf..67bcefc84bc807d2ce58b95ded482a656bc7d676 100644 (file)
@@ -4075,6 +4075,22 @@ options:
   - runtime
   see_also:
   - bdev_async_discard_threads
+- 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_flock_retry_interval
   type: float
   level: advanced