From: Radosław Zarzyński Date: Thu, 28 Sep 2023 12:51:56 +0000 (+0200) Subject: osd: consolidate RMWPipeline code X-Git-Tag: v19.3.0~13^2~19 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=80b72bc2efb758a4d5da6baad31e04a302182e8c;p=ceph.git osd: consolidate RMWPipeline code This commit just moved the code to have all methods of `RMWPipeline` groupped in the file. Signed-off-by: Radosław Zarzyński --- diff --git a/src/osd/ECCommon.cc b/src/osd/ECCommon.cc index 373cc4079d3e..7ed15a061f81 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(); + } +}