From: xie xingguo Date: Wed, 21 Sep 2016 08:19:04 +0000 (+0800) Subject: common/throttle: simplify Throttle::_wait() X-Git-Tag: v11.1.0~559^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3ab5ef39649dfeedbfc9e0ae56d7f69ac7393d20;p=ceph.git common/throttle: simplify Throttle::_wait() 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 --- diff --git a/src/common/Throttle.cc b/src/common/Throttle.cc index 8a52906cd5e5..69d98da418c5 100644 --- a/src/common/Throttle.cc +++ b/src/common/Throttle.cc @@ -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;