diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/os/filestore/JournalThrottle.cc | |
parent | Initial commit. (diff) | |
download | ceph-upstream.tar.xz ceph-upstream.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/os/filestore/JournalThrottle.cc | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/os/filestore/JournalThrottle.cc b/src/os/filestore/JournalThrottle.cc new file mode 100644 index 000000000..dc1b34d07 --- /dev/null +++ b/src/os/filestore/JournalThrottle.cc @@ -0,0 +1,67 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#include "JournalThrottle.h" +#include "include/ceph_assert.h" + +bool JournalThrottle::set_params( + double _low_threshhold, + double _high_threshhold, + double _expected_throughput, + double _high_multiple, + double _max_multiple, + uint64_t _throttle_max, + std::ostream *errstream) +{ + return throttle.set_params( + _low_threshhold, + _high_threshhold, + _expected_throughput, + _high_multiple, + _max_multiple, + _throttle_max, + errstream); +} + +std::chrono::duration<double> JournalThrottle::get(uint64_t c) +{ + return throttle.get(c); +} + +uint64_t JournalThrottle::take(uint64_t c) +{ + return throttle.take(c); +} + +void JournalThrottle::register_throttle_seq(uint64_t seq, uint64_t c) +{ + locker l(lock); + journaled_ops.push_back(std::make_pair(seq, c)); +} + +std::pair<uint64_t, uint64_t> JournalThrottle::flush(uint64_t mono_id) +{ + uint64_t to_put_bytes = 0; + uint64_t to_put_ops = 0; + { + locker l(lock); + while (!journaled_ops.empty() && + journaled_ops.front().first <= mono_id) { + to_put_bytes += journaled_ops.front().second; + to_put_ops++; + journaled_ops.pop_front(); + } + } + throttle.put(to_put_bytes); + return std::make_pair(to_put_ops, to_put_bytes); +} + +uint64_t JournalThrottle::get_current() +{ + return throttle.get_current(); +} + +uint64_t JournalThrottle::get_max() +{ + return throttle.get_max(); +} |