Skip to content

Commit f3d801a

Browse files
authored
Merge pull request ceph#65608 from ifed01/wip-ifed-bool-async-discard-back
blk/kernel: bring "bdev_async_discard" config parameter back. Reviewed-by: Radoslaw Zarzynski <[email protected]> Reviewed-by: Yite Gu <[email protected]>
2 parents a43f5c7 + 398f7a0 commit f3d801a

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
@@ -583,6 +583,11 @@ void KernelDevice::_discard_update_threads(bool discard_stop)
583583

584584
uint64_t oldcount = discard_threads.size();
585585
uint64_t newcount = cct->_conf.get_val<uint64_t>("bdev_async_discard_threads");
586+
if (newcount == 0) {
587+
//backward compatibility mode to make sure legacy "bdev_async_discard" is
588+
// taken into account if set.
589+
newcount = cct->_conf.get_val<bool>("bdev_async_discard") ? 1 : 0;
590+
}
586591
if (!cct->_conf.get_val<bool>("bdev_enable_discard") || !support_discard || discard_stop) {
587592
newcount = 0;
588593
}
@@ -1617,14 +1622,16 @@ std::vector<std::string> KernelDevice::get_tracked_keys()
16171622
{
16181623
return {
16191624
"bdev_async_discard_threads"s,
1620-
"bdev_enable_discard"s
1625+
"bdev_async_discard"s,
1626+
"bdev_enable_discard"s,
16211627
};
16221628
}
16231629

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

src/common/options/global.yaml.in

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

0 commit comments

Comments
 (0)