MCPcopy Create free account
hub / github.com/ceph/ceph / throttle_bytes

Method throttle_bytes

src/msg/async/ProtocolV2.cc:1608–1639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1606}
1607
1608CtPtr ProtocolV2::throttle_bytes() {
1609 ldout(cct, 20) << __func__ << dendl;
1610
1611 const size_t cur_msg_size = get_current_msg_size();
1612 if (cur_msg_size) {
1613 if (connection->policy.throttler_bytes) {
1614 ldout(cct, 10) << __func__ << " wants " << cur_msg_size
1615 << " bytes from policy throttler "
1616 << connection->policy.throttler_bytes->get_current() << "/"
1617 << connection->policy.throttler_bytes->get_max() << dendl;
1618 if (!connection->policy.throttler_bytes->get_or_fail(cur_msg_size)) {
1619 ldout(cct, 1) << __func__ << " wants " << cur_msg_size
1620 << " bytes from policy throttler "
1621 << connection->policy.throttler_bytes->get_current()
1622 << "/" << connection->policy.throttler_bytes->get_max()
1623 << " failed, just wait." << dendl;
1624 // following thread pool deal with th full message queue isn't a
1625 // short time, so we can wait a ms.
1626 if (connection->register_time_events.empty()) {
1627 connection->register_time_events.insert(
1628 connection->center->create_time_event(
1629 cct->_conf->ms_client_throttle_retry_time_interval,
1630 connection->wakeup_handler));
1631 }
1632 return nullptr;
1633 }
1634 }
1635 }
1636
1637 state = THROTTLE_DISPATCH_QUEUE;
1638 return CONTINUE(throttle_dispatch_queue);
1639}
1640
1641CtPtr ProtocolV2::throttle_dispatch_queue() {
1642 ldout(cct, 20) << __func__ << dendl;

Callers

nothing calls this directly

Calls 6

get_or_failMethod · 0.80
create_time_eventMethod · 0.80
get_currentMethod · 0.45
get_maxMethod · 0.45
emptyMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected