From 952b88b009f4f8da82ec527041769d3825b4fc87 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 22 Aug 2019 16:47:19 +0800 Subject: [PATCH] crimson/osd: lift continuation in PGMeta::load() after making `open_collection()` return a future, we don't need to chain the body of `PGMeta::load()` after `omap_get_values()`. instead we can lift it. Signed-off-by: Kefu Chai --- src/crimson/osd/pg_meta.cc | 63 +++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/src/crimson/osd/pg_meta.cc b/src/crimson/osd/pg_meta.cc index 5510972eb61..30ef48b37c8 100644 --- a/src/crimson/osd/pg_meta.cc +++ b/src/crimson/osd/pg_meta.cc @@ -62,39 +62,38 @@ seastar::future PGMeta::load() {string{infover_key}, string{info_key}, string{biginfo_key}, - string{fastinfo_key}}).then( - [this](auto&& values) { - { - // sanity check - auto infover = find_value<__u8>(values, infover_key); - assert(infover); - if (infover < 10) { - throw std::runtime_error("incompatible pg meta"); - } - } - pg_info_t info; - { - auto found = find_value(values, info_key); - assert(found); - info = *std::move(found); + string{fastinfo_key}}); + }).then([this](auto&& values) { + { + // sanity check + auto infover = find_value<__u8>(values, infover_key); + assert(infover); + if (infover < 10) { + throw std::runtime_error("incompatible pg meta"); } - PastIntervals past_intervals; - { - using biginfo_t = std::pair; - auto big_info = find_value(values, biginfo_key); - assert(big_info); - past_intervals = std::move(big_info->first); - info.purged_snaps = std::move(big_info->second); - } - { - auto fast_info = find_value(values, fastinfo_key); - if (fast_info) { - fast_info->try_apply_to(&info); - } + } + pg_info_t info; + { + auto found = find_value(values, info_key); + assert(found); + info = *std::move(found); + } + PastIntervals past_intervals; + { + using biginfo_t = std::pair; + auto big_info = find_value(values, biginfo_key); + assert(big_info); + past_intervals = std::move(big_info->first); + info.purged_snaps = std::move(big_info->second); + } + { + auto fast_info = find_value(values, fastinfo_key); + if (fast_info) { + fast_info->try_apply_to(&info); } - return seastar::make_ready_future( - std::move(info), - std::move(past_intervals)); - }); + } + return seastar::make_ready_future( + std::move(info), + std::move(past_intervals)); }); } -- 2.39.5