Skip to content

Commit 398f7a0

Browse files
committed
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 <[email protected]> (cherry picked from commit 7b914cb)
1 parent e4f4743 commit 398f7a0

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

src/blk/kernel/KernelDevice.cc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,11 @@ void KernelDevice::_discard_update_threads(bool discard_stop)
582582

583583
uint64_t oldcount = discard_threads.size();
584584
uint64_t newcount = cct->_conf.get_val<uint64_t>("bdev_async_discard_threads");
585+
if (newcount == 0) {
586+
//backward compatibility mode to make sure legacy "bdev_async_discard" is
587+
// taken into account if set.
588+
newcount = cct->_conf.get_val<bool>("bdev_async_discard") ? 1 : 0;
589+
}
585590
if (!cct->_conf.get_val<bool>("bdev_enable_discard") || !support_discard || discard_stop) {
586591
newcount = 0;
587592
}
@@ -1616,14 +1621,16 @@ std::vector<std::string> KernelDevice::get_tracked_keys()
16161621
{
16171622
return {
16181623
"bdev_async_discard_threads"s,
1619-
"bdev_enable_discard"s
1624+
"bdev_async_discard"s,
1625+
"bdev_enable_discard"s,
16201626
};
16211627
}
16221628

16231629
void KernelDevice::handle_conf_change(const ConfigProxy& conf,
16241630
const std::set <std::string> &changed)
16251631
{
1626-
if (changed.count("bdev_async_discard_threads") || changed.count("bdev_enable_discard")) {
1632+
if (changed.count("bdev_async_discard_threads") || changed.count("bdev_async_discard") ||
1633+
changed.count("bdev_enable_discard")) {
16271634
_discard_update_threads();
16281635
}
16291636
}

src/common/options/global.yaml.in

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4150,6 +4150,22 @@ options:
41504150
see_also:
41514151
- bdev_enable_discard
41524152
- bdev_async_discard_max_pending
4153+
- name: bdev_async_discard
4154+
long_desc: When set this works like an alias for 'bdev_async_discard_threads = 1"
4155+
mode to avoid implicit async discard mode disablement after upgrade.
4156+
Ignored if 'dev_asunc_discard_threads' is greater than zero.
4157+
This parameter is DEPRECATED and provided for backward compatibility for
4158+
Squid minor releases only.
4159+
PLEASE SWITCH TO 'bdev_async_discard_threads' USE.
4160+
type: bool
4161+
level: advanced
4162+
default: false
4163+
with_legacy: false
4164+
flags:
4165+
- runtime
4166+
see_also:
4167+
- bdev_enable_discard
4168+
- bdev_async_discard_threads
41534169
- name: bdev_async_discard_max_pending
41544170
desc: maximum number of pending discards
41554171
long_desc: The maximum number of pending async discards that can be queued and not claimed by an

0 commit comments

Comments
 (0)