mirror of
https://github.com/ceph/ceph
synced 2025-03-31 16:25:56 +00:00
Merge pull request #62220 from ifed01/wip-ifed-limit-discard-qlen-reef
reef: blk/KernelDevice: Introduce a cap on the number of pending discards
This commit is contained in:
commit
55f682cc43
src
@ -799,14 +799,21 @@ void KernelDevice::_discard_thread(uint64_t tid)
|
||||
|
||||
// this is private and is expected that the caller checks that discard
|
||||
// threads are running via _discard_started()
|
||||
void KernelDevice::_queue_discard(interval_set<uint64_t> &to_release)
|
||||
bool KernelDevice::_queue_discard(interval_set<uint64_t> &to_release)
|
||||
{
|
||||
if (to_release.empty())
|
||||
return;
|
||||
return false;
|
||||
|
||||
auto max_pending = cct->_conf->bdev_async_discard_max_pending;
|
||||
|
||||
std::lock_guard l(discard_lock);
|
||||
|
||||
if (max_pending > 0 && discard_queued.num_intervals() >= max_pending)
|
||||
return false;
|
||||
|
||||
discard_queued.insert(to_release);
|
||||
discard_cond.notify_one();
|
||||
return true;
|
||||
}
|
||||
|
||||
// return true only if discard was queued, so caller won't have to do
|
||||
@ -817,8 +824,7 @@ bool KernelDevice::try_discard(interval_set<uint64_t> &to_release, bool async)
|
||||
return false;
|
||||
|
||||
if (async && _discard_started()) {
|
||||
_queue_discard(to_release);
|
||||
return true;
|
||||
return _queue_discard(to_release);
|
||||
} else {
|
||||
for (auto p = to_release.begin(); p != to_release.end(); ++p) {
|
||||
_discard(p.get_start(), p.get_len());
|
||||
|
@ -86,7 +86,7 @@ private:
|
||||
|
||||
void _aio_thread();
|
||||
void _discard_thread(uint64_t tid);
|
||||
void _queue_discard(interval_set<uint64_t> &to_release);
|
||||
bool _queue_discard(interval_set<uint64_t> &to_release);
|
||||
bool try_discard(interval_set<uint64_t> &to_release, bool async = true) override;
|
||||
|
||||
int _aio_start();
|
||||
|
@ -4067,6 +4067,23 @@ options:
|
||||
- runtime
|
||||
see_also:
|
||||
- bdev_enable_discard
|
||||
- bdev_async_discard_max_pending
|
||||
- name: bdev_async_discard_max_pending
|
||||
desc: maximum number of pending discards
|
||||
long_desc: The maximum number of pending async discards that can be queued and not claimed by an
|
||||
async discard thread. Discards will not be issued once the queue is full and blocks will be
|
||||
freed back to the allocator immediately instead. This is useful if you have a device with slow
|
||||
discard performance that can't keep up to a consistently high write workload. 0 means
|
||||
'unlimited'.
|
||||
type: uint
|
||||
level: advanced
|
||||
default: 1000000
|
||||
min: 0
|
||||
with_legacy: true
|
||||
flags:
|
||||
- runtime
|
||||
see_also:
|
||||
- bdev_async_discard_threads
|
||||
- name: bdev_flock_retry_interval
|
||||
type: float
|
||||
level: advanced
|
||||
|
Loading…
Reference in New Issue
Block a user