]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Throttler: Add reset support
authorHaomai Wang <haomai@xsky.com>
Wed, 23 Dec 2015 06:41:59 +0000 (14:41 +0800)
committerHaomai Wang <haomai@xsky.com>
Wed, 9 Nov 2016 03:39:02 +0000 (11:39 +0800)
Signed-off-by: Haomai Wang <haomai@xsky.com>
src/common/Throttle.cc
src/common/Throttle.h

index 69d98da418c5e9a745aa43e79e9ddff9c29e6482..7ba623252e26839e4611e3b53a7e83bdcc6e1890 100644 (file)
@@ -235,6 +235,17 @@ int64_t Throttle::put(int64_t c)
   return count.read();
 }
 
+void Throttle::reset()
+{
+  Mutex::Locker l(lock);
+  if (!cond.empty())
+    cond.front()->SignalOne();
+  count.set(0);
+  if (logger) {
+    logger->set(l_throttle_val, 0);
+  }
+}
+
 bool BackoffThrottle::set_params(
   double _low_threshhold,
   double _high_threshhold,
index cafe0d9a1160a77f024990ecf7da613bcefd5c47..b920d195de6f916b87be93b7e4016c86a2757c60 100644 (file)
@@ -105,6 +105,11 @@ public:
    * @returns number of requests being hold after this
    */
   int64_t put(int64_t c = 1);
+   /**
+   * reset the zero to the stock
+   */
+  void reset();
+
   bool should_wait(int64_t c) const {
     return _should_wait(c);
   }