From: Kefu Chai Date: Mon, 14 Dec 2020 15:56:11 +0000 (+0800) Subject: crimson/osd: move unrelated continuation out of do_with() X-Git-Tag: v16.1.0~263^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b030f717e021bbed5a8b8c0829bf3f53ad9f20e2;p=ceph.git crimson/osd: move unrelated continuation out of do_with() if the variables held by do_with() is not used by the continuation, and the continuation does not depend on the other continuations called in the do_with(), let's move it out for smaller lexical scope. and hence better readability. Signed-off-by: Kefu Chai --- diff --git a/src/crimson/osd/replicated_recovery_backend.cc b/src/crimson/osd/replicated_recovery_backend.cc index 647e64b79735..66cc0513ccc2 100644 --- a/src/crimson/osd/replicated_recovery_backend.cc +++ b/src/crimson/osd/replicated_recovery_backend.cc @@ -26,12 +26,12 @@ seastar::future<> ReplicatedRecoveryBackend::recover_object( // always add_recovering(soid) before recover_object(soid) assert(is_recovering(soid)); // start tracking the recovery of soid - return seastar::do_with(std::map(), get_shards_to_push(soid), - [this, soid, need](auto& pops, auto& shards) { - return maybe_pull_missing_obj(soid, need).then( - [this, soid, need, &pops, &shards] { - return maybe_push_shards(soid, need, pops, shards); - }); + return maybe_pull_missing_obj(soid, need).then([this, soid, need] { + return seastar::do_with(std::map(), + get_shards_to_push(soid), + [this, soid, need](auto& pops, auto& shards) { + return maybe_push_shards(soid, need, pops, shards); + }); }); }