From 80b72bc2efb758a4d5da6baad31e04a302182e8c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rados=C5=82aw=20Zarzy=C5=84ski?= Date: Thu, 28 Sep 2023 14:51:56 +0200 Subject: [PATCH] osd: consolidate RMWPipeline code MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This commit just moved the code to have all methods of `RMWPipeline` groupped in the file. Signed-off-by: Radosław Zarzyński --- src/osd/ECCommon.cc | 54 ++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/osd/ECCommon.cc b/src/osd/ECCommon.cc index 373cc4079d3..7ed15a061f8 100644 --- a/src/osd/ECCommon.cc +++ b/src/osd/ECCommon.cc @@ -308,33 +308,6 @@ void ECCommon::ReadPipeline::on_change() in_progress_client_reads.clear(); } -void ECCommon::RMWPipeline::on_change() -{ - dout(10) << __func__ << dendl; - - completed_to = eversion_t(); - committed_to = eversion_t(); - pipeline_state.clear(); - waiting_reads.clear(); - waiting_state.clear(); - waiting_commit.clear(); - for (auto &&op: tid_to_op_map) { - cache.release_write_pin(op.second->pin); - } - tid_to_op_map.clear(); -} - -void ECCommon::RMWPipeline::call_write_ordered(std::function &&cb) { - if (!waiting_state.empty()) { - waiting_state.back().on_write.emplace_back(std::move(cb)); - } else if (!waiting_reads.empty()) { - waiting_reads.back().on_write.emplace_back(std::move(cb)); - } else { - // Nothing earlier in the pipeline, just call it - cb(); - } -} - void ECCommon::ReadPipeline::get_all_avail_shards( const hobject_t &hoid, const set &error_shards, @@ -905,3 +878,30 @@ void ECCommon::RMWPipeline::check_ops() try_reads_to_commit() || try_finish_rmw()); } + +void ECCommon::RMWPipeline::on_change() +{ + dout(10) << __func__ << dendl; + + completed_to = eversion_t(); + committed_to = eversion_t(); + pipeline_state.clear(); + waiting_reads.clear(); + waiting_state.clear(); + waiting_commit.clear(); + for (auto &&op: tid_to_op_map) { + cache.release_write_pin(op.second->pin); + } + tid_to_op_map.clear(); +} + +void ECCommon::RMWPipeline::call_write_ordered(std::function &&cb) { + if (!waiting_state.empty()) { + waiting_state.back().on_write.emplace_back(std::move(cb)); + } else if (!waiting_reads.empty()) { + waiting_reads.back().on_write.emplace_back(std::move(cb)); + } else { + // Nothing earlier in the pipeline, just call it + cb(); + } +} -- 2.39.5