]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/throttle: simplify Throttle::_wait() 11165/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 21 Sep 2016 08:19:04 +0000 (16:19 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Wed, 21 Sep 2016 09:08:48 +0000 (17:08 +0800)
We don't have to check/set the "waited" member when falling into this branch,
which is deemed to be true.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/common/Throttle.cc

index 8a52906cd5e5de436ac1470eb80e4f877be4c248..69d98da418c5e9a745aa43e79e9ddff9c29e6482 100644 (file)
@@ -97,22 +97,19 @@ bool Throttle::_wait(int64_t c)
   if (_should_wait(c) || !cond.empty()) { // always wait behind other waiters.
     Cond *cv = new Cond;
     cond.push_back(cv);
+    waited = true;
+    ldout(cct, 2) << "_wait waiting..." << dendl;
+    if (logger)
+      start = ceph_clock_now(cct);
+
     do {
-      if (!waited) {
-       ldout(cct, 2) << "_wait waiting..." << dendl;
-       if (logger)
-         start = ceph_clock_now(cct);
-      }
-      waited = true;
       cv->Wait(lock);
     } while (_should_wait(c) || cv != cond.front());
 
-    if (waited) {
-      ldout(cct, 3) << "_wait finished waiting" << dendl;
-      if (logger) {
-       utime_t dur = ceph_clock_now(cct) - start;
-        logger->tinc(l_throttle_wait, dur);
-      }
+    ldout(cct, 2) << "_wait finished waiting" << dendl;
+    if (logger) {
+      utime_t dur = ceph_clock_now(cct) - start;
+      logger->tinc(l_throttle_wait, dur);
     }
 
     delete cv;