From: Amnon Hanuhov Date: Wed, 11 Aug 2021 16:49:44 +0000 (+0300) Subject: crimson/osd: drop PGBackend& from OpsExecuter ctor X-Git-Tag: v17.1.0~52^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=217d0e19dc90eae79cf92376e0bd0790f70024ad;p=ceph.git crimson/osd: drop PGBackend& from OpsExecuter ctor OpsExecuter holds a Ref so the PGBackend can be extracted from it using get_backend() Signed-off-by: Amnon Hanuhov --- diff --git a/src/crimson/osd/ops_executer.cc b/src/crimson/osd/ops_executer.cc index f947a4fab44..c38f3e034e7 100644 --- a/src/crimson/osd/ops_executer.cc +++ b/src/crimson/osd/ops_executer.cc @@ -442,6 +442,24 @@ OpsExecuter::watch_ierrorator::future<> OpsExecuter::do_op_notify_ack( }); } +// Defined here because there is a circular dependency between OpsExecuter and PG +template +auto OpsExecuter::do_const_op(Func&& f) { + // TODO: pass backend as read-only + return std::forward(f)(pg->get_backend(), std::as_const(obc->obs)); +} + +// Defined here because there is a circular dependency between OpsExecuter and PG +template +auto OpsExecuter::do_write_op(Func&& f, bool um) { + ++num_write; + if (!osd_op_params) { + osd_op_params.emplace(); + } + user_modify = um; + return std::forward(f)(pg->get_backend(), obc->obs, txn); +} + OpsExecuter::interruptible_errorated_future OpsExecuter::execute_op(OSDOp& osd_op) { diff --git a/src/crimson/osd/ops_executer.h b/src/crimson/osd/ops_executer.h index d3317d150e2..803b9fda0de 100644 --- a/src/crimson/osd/ops_executer.h +++ b/src/crimson/osd/ops_executer.h @@ -154,7 +154,6 @@ private: Ref pg; // for the sake of object class ObjectContextRef obc; const OpInfo& op_info; - PGBackend& backend; ceph::static_ptr)> msg; std::optional osd_op_params; @@ -208,10 +207,7 @@ private: const ObjectState& os); template - auto do_const_op(Func&& f) { - // TODO: pass backend as read-only - return std::forward(f)(backend, std::as_const(obc->obs)); - } + auto do_const_op(Func&& f); template auto do_read_op(Func&& f) { @@ -221,14 +217,7 @@ private: } template - auto do_write_op(Func&& f, bool um) { - ++num_write; - if (!osd_op_params) { - osd_op_params.emplace(); - } - user_modify = um; - return std::forward(f)(backend, obc->obs, txn); - } + auto do_write_op(Func&& f, bool um); decltype(auto) dont_do_legacy_op() { return crimson::ct_error::operation_not_supported::make(); @@ -239,12 +228,10 @@ public: OpsExecuter(Ref pg, ObjectContextRef obc, const OpInfo& op_info, - PGBackend& backend, const MsgT& msg) : pg(std::move(pg)), obc(std::move(obc)), op_info(op_info), - backend(backend), msg(std::in_place_type_t>{}, &msg) { } diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 2e4b0a5300e..7fd940f1e76 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -750,7 +750,7 @@ PG::do_osd_ops( } return do_osd_ops_execute>( seastar::make_lw_shared( - Ref{this}, std::move(obc), op_info, get_backend(), *m), + Ref{this}, std::move(obc), op_info, *m), m->ops, op_info, [this, m, rvec = op_info.allows_returnvec()] { @@ -794,7 +794,7 @@ PG::do_osd_ops( { return do_osd_ops_execute( seastar::make_lw_shared( - Ref{this}, std::move(obc), op_info, get_backend(), msg_params), + Ref{this}, std::move(obc), op_info, msg_params), ops, std::as_const(op_info), std::move(success_func),