Signed-off-by: Igor Fedotov <ifedotov@suse.com>
(cherry picked from commit
fa37ed1a48fd804ac199509bd78c470480ecbb22)
Conflicts:
src/common/Throttle.cc : Resolved in _reset_max and put func
src/common/Throttle.h : Retained only count var changes
void Throttle::_reset_max(int64_t m)
{
+ // lock must be held.
assert(lock.is_locked());
- if (static_cast<int64_t>(max) == m)
+ if (max == m)
return;
if (!cond.empty())
cond.front()->SignalOne();
if (c) {
if (!cond.empty())
cond.front()->SignalOne();
- assert(static_cast<int64_t>(count) >= c); // if count goes negative, we failed somewhere!
+ // if count goes negative, we failed somewhere!
+ assert(count >= c);
count -= c;
if (logger) {
logger->inc(l_throttle_put);
CephContext *cct;
const std::string name;
PerfCounters *logger;
- std::atomic<unsigned> count = { 0 }, max = { 0 };
+ std::atomic<int64_t> count = { 0 }, max = { 0 };
Mutex lock;
list<Cond*> cond;
const bool use_perf;