From cfbd18864602ecad1a34c904bfcb03b025fc3d37 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Fri, 10 Jul 2020 12:50:54 -0400 Subject: [PATCH] librbd: directly post completions to the asio strand 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 --- src/librbd/io/AioCompletion.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/librbd/io/AioCompletion.cc b/src/librbd/io/AioCompletion.cc index a50677215818b..9e1d1e18fe7a3 100644 --- a/src/librbd/io/AioCompletion.cc +++ b/src/librbd/io/AioCompletion.cc @@ -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) { @@ -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() {