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

Method throttle_bytes

src/msg/async/ProtocolV1.cc:707–739  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

705}
706
707CtPtr ProtocolV1::throttle_bytes() {
708 ldout(cct, 20) << __func__ << dendl;
709
710 cur_msg_size = current_header.front_len + current_header.middle_len +
711 current_header.data_len;
712 if (cur_msg_size) {
713 if (connection->policy.throttler_bytes) {
714 ldout(cct, 10) << __func__ << " wants " << cur_msg_size
715 << " bytes from policy throttler "
716 << connection->policy.throttler_bytes->get_current() << "/"
717 << connection->policy.throttler_bytes->get_max() << dendl;
718 if (!connection->policy.throttler_bytes->get_or_fail(cur_msg_size)) {
719 ldout(cct, 1) << __func__ << " wants " << cur_msg_size
720 << " bytes from policy throttler "
721 << connection->policy.throttler_bytes->get_current()
722 << "/" << connection->policy.throttler_bytes->get_max()
723 << " failed, just wait." << dendl;
724 // following thread pool deal with th full message queue isn't a
725 // short time, so we can wait a ms.
726 if (connection->register_time_events.empty()) {
727 connection->register_time_events.insert(
728 connection->center->create_time_event(
729 cct->_conf->ms_client_throttle_retry_time_interval,
730 connection->wakeup_handler));
731 }
732 return nullptr;
733 }
734 }
735 }
736
737 state = THROTTLE_DISPATCH_QUEUE;
738 return CONTINUE(throttle_dispatch_queue);
739}
740
741CtPtr ProtocolV1::throttle_dispatch_queue() {
742 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