Skip to content

Commit

Permalink
librbd: directly post completions to the asio strand
Browse files Browse the repository at this point in the history
Avoid the unnecessary wrapping of the strand completion in a
bind_executor by just directly posting the completion to the
strand.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
  • Loading branch information
Jason Dillaman committed Jul 16, 2020
1 parent 9b6a204 commit cfbd188
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/librbd/io/AioCompletion.cc
Expand Up @@ -157,10 +157,9 @@ void AioCompletion::queue_complete() {
add_request();

// ensure completion fires in clean lock context
boost::asio::post(*ictx->asio_engine, boost::asio::bind_executor(
ictx->asio_engine->get_api_strand(), [this]() {
boost::asio::post(ictx->asio_engine->get_api_strand(), [this]() {
complete_request(0);
}));
});
}

void AioCompletion::block(CephContext* cct) {
Expand Down Expand Up @@ -261,12 +260,11 @@ void AioCompletion::complete_external_callback() {

// ensure librbd external users never experience concurrent callbacks
// from multiple librbd-internal threads.
boost::asio::dispatch(*ictx->asio_engine, boost::asio::bind_executor(
ictx->asio_engine->get_api_strand(), [this]() {
boost::asio::dispatch(ictx->asio_engine->get_api_strand(), [this]() {
complete_cb(rbd_comp, complete_arg);
complete_event_socket();
put();
}));
});
}

void AioCompletion::complete_event_socket() {
Expand Down

0 comments on commit cfbd188

Please sign in to comment.