From cb8078a9545b46d3833faa20a9fe53cedae4758f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rados=C5=82aw=20Zarzy=C5=84ski?= Date: Wed, 27 Sep 2023 12:46:12 +0200 Subject: [PATCH] osd: decouple classical and dummy ops for RMWPipeline::try_finish_rmw() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Radosław Zarzyński --- src/osd/ECBackend.cc | 49 ++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/src/osd/ECBackend.cc b/src/osd/ECBackend.cc index b63ab0cca1cf4..467315a8b7f30 100644 --- a/src/osd/ECBackend.cc +++ b/src/osd/ECBackend.cc @@ -1574,23 +1574,21 @@ struct ECClassicalOp : ECCommon::RMWPipeline::Op { DoutPrefixProvider *dpp, const ceph_release_t require_osd_release) final { - // there is the special case of t-empty op generated in try_finish_rmw() - if (t) { - ECTransaction::generate_transactions( - t.get(), - plan, - ecimpl, - pgid, - sinfo, - remote_read_result, - log_entries, - written, - transactions, - &temp_added, - &temp_cleared, - dpp, - require_osd_release); - } + assert(t); + ECTransaction::generate_transactions( + t.get(), + plan, + ecimpl, + pgid, + sinfo, + remote_read_result, + log_entries, + written, + transactions, + &temp_added, + &temp_cleared, + dpp, + require_osd_release); } template @@ -2227,6 +2225,21 @@ bool ECCommon::RMWPipeline::try_reads_to_commit() return true; } +struct ECDummyOp : ECCommon::RMWPipeline::Op { + void generate_transactions( + ceph::ErasureCodeInterfaceRef &ecimpl, + pg_t pgid, + const ECUtil::stripe_info_t &sinfo, + std::map *written, + std::map *transactions, + DoutPrefixProvider *dpp, + const ceph_release_t require_osd_release) final + { + // NOP, as -- in constrast to ECClassicalOp -- there is no + // transaction involved + } +}; + bool ECCommon::RMWPipeline::try_finish_rmw() { if (waiting_commit.empty()) @@ -2250,7 +2263,7 @@ bool ECCommon::RMWPipeline::try_finish_rmw() waiting_commit.empty()) { // submit a dummy, transaction-empty op to kick the rollforward auto tid = get_parent()->get_tid(); - auto nop = std::make_unique(); + auto nop = std::make_unique(); nop->hoid = op->hoid; nop->trim_to = op->trim_to; nop->roll_forward_to = op->version; -- 2.39.5