From 7b914cb49d50241b2ed7811d8660fce27a80ae39 Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Wed, 12 Mar 2025 17:42:24 +0300 Subject: [PATCH] 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 --- src/blk/kernel/KernelDevice.cc | 9 ++++++++- src/common/options/global.yaml.in | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/blk/kernel/KernelDevice.cc b/src/blk/kernel/KernelDevice.cc index 2fb48790463b2..13b1cf1961554 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 2954bcf4a1f89..67bcefc84bc80 100644 --- a/src/common/options/global.yaml.in +++ b/src/common/options/global.yaml.in @@ -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 -- 2.39.5