From: Igor Fedotov Date: Wed, 12 Mar 2025 14:42:24 +0000 (+0300) Subject: blk/kernel: bring "bdev_async_discard" config parameter back. X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=844cef23a0caa8dd9683ff6a1c706288e23deda1;p=ceph.git blk/kernel: bring "bdev_async_discard" config parameter back. To ensure backword compatibility for clusters with this parameter previously set to true. Signed-off-by: Igor Fedotov (cherry picked from commit ea0df9a2d838f3d3f15678624c19f1f3d0fc5447) --- diff --git a/src/blk/kernel/KernelDevice.cc b/src/blk/kernel/KernelDevice.cc index 2ab53dc94e4..152706bf02e 100644 --- a/src/blk/kernel/KernelDevice.cc +++ b/src/blk/kernel/KernelDevice.cc @@ -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("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("bdev_async_discard") ? 1 : 0; + } if (!cct->_conf.get_val("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 &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(); } } diff --git a/src/common/options/global.yaml.in b/src/common/options/global.yaml.in index f529bd1cc4b..cc8549e2dcf 100644 --- a/src/common/options/global.yaml.in +++ b/src/common/options/global.yaml.in @@ -4083,6 +4083,22 @@ options: flags: - runtime see_also: + - bdev_enable_discard +- 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