]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.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)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Wed, 8 Oct 2025 15:17:31 +0000 (15:17 +0000)
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)
(cherry picked from commit 615ca9bfbc279bd0be7c0545b35d681dd168d088)

Resolves: rhbz#2394395

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

index db06d3052863416b52e8db58a9337ec269f0856a..9061be66b18707fcdb05d6fcc30554d68b2a0bb3 100644 (file)
@@ -581,6 +581,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;
   }
@@ -1579,6 +1584,7 @@ std::vector<std::string> KernelDevice::get_tracked_keys()
 {
   return {
     "bdev_async_discard_threads"s,
+    "bdev_async_discard"s,
     "bdev_enable_discard"s
   };
 }
@@ -1586,7 +1592,8 @@ std::vector<std::string> KernelDevice::get_tracked_keys()
 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 7b41733250073cff7675fb939769302844db9d97..35699471500e91d5bb8f4145f7395c7be8af381a 100644 (file)
@@ -4158,6 +4158,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