From: Igor Fedotov Date: Wed, 3 Jan 2018 11:16:19 +0000 (+0300) Subject: common/throttle: start using 64-bit values X-Git-Tag: v12.2.3~51^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=07a122a3fda26c7b65ecf0879f24a8380568b47f;p=ceph.git common/throttle: start using 64-bit values Signed-off-by: Igor Fedotov (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 --- diff --git a/src/common/Throttle.cc b/src/common/Throttle.cc index 1d84be68d4f..3c25b557ff9 100644 --- a/src/common/Throttle.cc +++ b/src/common/Throttle.cc @@ -81,8 +81,9 @@ Throttle::~Throttle() void Throttle::_reset_max(int64_t m) { + // lock must be held. assert(lock.is_locked()); - if (static_cast(max) == m) + if (max == m) return; if (!cond.empty()) cond.front()->SignalOne(); @@ -229,7 +230,8 @@ int64_t Throttle::put(int64_t c) if (c) { if (!cond.empty()) cond.front()->SignalOne(); - assert(static_cast(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); diff --git a/src/common/Throttle.h b/src/common/Throttle.h index efc5ba037ae..0b02c68ef36 100644 --- a/src/common/Throttle.h +++ b/src/common/Throttle.h @@ -30,7 +30,7 @@ class Throttle { CephContext *cct; const std::string name; PerfCounters *logger; - std::atomic count = { 0 }, max = { 0 }; + std::atomic count = { 0 }, max = { 0 }; Mutex lock; list cond; const bool use_perf;