]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: move unrelated continuation out of do_with()
authorKefu Chai <kchai@redhat.com>
Mon, 14 Dec 2020 15:56:11 +0000 (23:56 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 14 Dec 2020 17:47:17 +0000 (01:47 +0800)
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 <kchai@redhat.com>
src/crimson/osd/replicated_recovery_backend.cc

index 647e64b797355c585fe2dc20636acf2149a46567..66cc0513ccc2f691f22dc14eb99f56295d3855ba 100644 (file)
@@ -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<pg_shard_t, PushOp>(), 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<pg_shard_t, PushOp>(),
+                            get_shards_to_push(soid),
+      [this, soid, need](auto& pops, auto& shards) {
+        return maybe_push_shards(soid, need, pops, shards);
+      });
   });
 }