]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/throttle: start using 64-bit values 19759/head
authorIgor Fedotov <ifedotov@suse.com>
Wed, 3 Jan 2018 11:16:19 +0000 (14:16 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Wed, 3 Jan 2018 11:16:19 +0000 (14:16 +0300)
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/common/Throttle.cc
src/common/Throttle.h

index 795e960e1ad6f065a9c0d2b2731e0feb88e24759..1e9aed5d36ba8dd18586af52279e0d0baf5c9048 100644 (file)
@@ -76,7 +76,7 @@ Throttle::~Throttle()
 void Throttle::_reset_max(int64_t m)
 {
   // lock must be held.
-  if (static_cast<int64_t>(max) == m)
+  if (max == m)
     return;
   if (!conds.empty())
     conds.front().notify_one();
@@ -222,7 +222,7 @@ int64_t Throttle::put(int64_t c)
     if (!conds.empty())
       conds.front().notify_one();
     // if count goes negative, we failed somewhere!
-    assert(static_cast<int64_t>(count) >= c);
+    assert(count >= c);
     count -= c;
     if (logger) {
       logger->inc(l_throttle_put);
index 9081c006b77476cadc6f37fad9d431c6bc3609f3..d9efe5cc85e31bfc21fa9d6474d8d9cdfe003434 100644 (file)
@@ -29,7 +29,7 @@ class Throttle {
   CephContext *cct;
   const std::string name;
   PerfCountersRef logger;
-  std::atomic<unsigned> count = { 0 }, max = { 0 };
+  std::atomic<int64_t> count = { 0 }, max = { 0 };
   std::mutex lock;
   std::list<std::condition_variable> conds;
   const bool use_perf;