If max throttle bytes is 0, throttle should not be doing anything.
This check is introduced in the beginning of each throttle function
Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>
Signed-off-by: Greg Farnum <greg@inktank.com>
bool Throttle::wait(int64_t m)
{
+ if (0 == max.read()) {
+ return false;
+ }
+
Mutex::Locker l(lock);
if (m) {
assert(m > 0);
int64_t Throttle::take(int64_t c)
{
+ if (0 == max.read()) {
+ return 0;
+ }
assert(c >= 0);
ldout(cct, 10) << "take " << c << dendl;
{
bool Throttle::get(int64_t c, int64_t m)
{
+ if (0 == max.read()) {
+ return false;
+ }
+
assert(c >= 0);
ldout(cct, 10) << "get " << c << " (" << count.read() << " -> " << (count.read() + c) << ")" << dendl;
bool waited = false;
*/
bool Throttle::get_or_fail(int64_t c)
{
+ if (0 == max.read()) {
+ return true;
+ }
+
assert (c >= 0);
Mutex::Locker l(lock);
if (_should_wait(c) || !cond.empty()) {
int64_t Throttle::put(int64_t c)
{
+ if (0 == max.read()) {
+ return 0;
+ }
+
assert(c >= 0);
ldout(cct, 10) << "put " << c << " (" << count.read() << " -> " << (count.read()-c) << ")" << dendl;
Mutex::Locker l(lock);