{
assert(lock.is_locked());
assert(next);
- while (!stopping &&
- cur_ios < io_limits.first &&
- pending_wbs.size() < fd_limits.first &&
- cur_size < size_limits.first)
+ while (!stopping && !beyond_limit())
cond.Wait(lock);
if (stopping)
return false;
wbiter->second.first.add(nocache, len, 1);
insert_object(hoid);
- if (!(cur_ios < io_limits.first &&
- pending_wbs.size() < fd_limits.first &&
- cur_size < size_limits.first))
+ if (beyond_limit())
cond.Signal();
}
void WBThrottle::throttle()
{
Mutex::Locker l(lock);
- while (!stopping && !(
- cur_ios < io_limits.second &&
- pending_wbs.size() < fd_limits.second &&
- cur_size < size_limits.second)) {
+ while (!stopping && beyond_limit()) {
cond.Wait(lock);
}
}
FS fs;
void set_from_conf();
+ bool beyond_limit() const {
+ if (cur_ios < io_limits.first &&
+ pending_wbs.size() < fd_limits.first &&
+ cur_size < size_limits.first)
+ return false;
+ else
+ return true;
+ }
+
public:
WBThrottle(CephContext *cct);
~WBThrottle();