Skip to content

Commit 7ac64b0

Browse files
committed
crimson: OpsExecuter no longer needs to be a lw shared ptr
ClientRequest and InternalClientRequest can declare them as auto variables. Signed-off-by: Samuel Just <[email protected]>
1 parent 8f3ac96 commit 7ac64b0

File tree

5 files changed

+18
-20
lines changed

5 files changed

+18
-20
lines changed

src/crimson/osd/ops_executer.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace crimson::osd {
4040
class PG;
4141

4242
// OpsExecuter -- a class for executing ops targeting a certain object.
43-
class OpsExecuter : public seastar::enable_lw_shared_from_this<OpsExecuter> {
43+
class OpsExecuter {
4444
friend class SnapTrimObjSubEvent;
4545

4646
using call_errorator = crimson::errorator<
@@ -549,14 +549,14 @@ template <class Func>
549549
struct OpsExecuter::RollbackHelper {
550550
void rollback_obc_if_modified();
551551
void rollback_obc_if_modified(const std::error_code& e);
552-
seastar::lw_shared_ptr<OpsExecuter> ox;
552+
OpsExecuter *ox;
553553
Func func;
554554
};
555555

556556
template <class Func>
557557
inline OpsExecuter::RollbackHelper<Func>
558558
OpsExecuter::create_rollbacker(Func&& func) {
559-
return {shared_from_this(), std::forward<Func>(func)};
559+
return {this, std::forward<Func>(func)};
560560
}
561561

562562
template <class Func>

src/crimson/osd/osd_operations/client_request.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,7 @@ ClientRequest::do_process(
502502
co_return;
503503
}
504504

505-
auto ox = seastar::make_lw_shared<OpsExecuter>(
506-
pg, obc, op_info, *m, r_conn, snapc);
505+
OpsExecuter ox(pg, obc, op_info, *m, r_conn, snapc);
507506
auto ret = co_await pg->run_executer(
508507
ox, obc, op_info, m->ops
509508
).si_then([]() -> std::optional<std::error_code> {

src/crimson/osd/osd_operations/internal_client_request.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ InternalClientRequest::do_process(
5757
{
5858
LOG_PREFIX(InternalClientRequest::do_process);
5959
auto params = get_do_osd_ops_params();
60-
auto ox = seastar::make_lw_shared<OpsExecuter>(
60+
OpsExecuter ox(
6161
pg, obc, op_info, params, params.get_connection(), SnapContext{});
6262
co_await pg->run_executer(
6363
ox, obc, op_info, osd_ops

src/crimson/osd/pg.cc

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,13 +1080,13 @@ PG::interruptible_future<eversion_t> PG::submit_error_log(
10801080
}
10811081

10821082
PG::run_executer_fut PG::run_executer(
1083-
seastar::lw_shared_ptr<OpsExecuter> ox,
1083+
OpsExecuter &ox,
10841084
ObjectContextRef obc,
10851085
const OpInfo &op_info,
10861086
std::vector<OSDOp>& ops)
10871087
{
10881088
LOG_PREFIX(PG::run_executer);
1089-
auto rollbacker = ox->create_rollbacker(
1089+
auto rollbacker = ox.create_rollbacker(
10901090
[stored_obc=duplicate_obc(obc)](auto &obc) mutable {
10911091
obc->update_from(*stored_obc);
10921092
});
@@ -1095,16 +1095,16 @@ PG::run_executer_fut PG::run_executer(
10951095
});
10961096

10971097
for (auto &op: ops) {
1098-
DEBUGDPP("object {} handle op {}", *this, ox->get_target(), op);
1099-
co_await ox->execute_op(op);
1098+
DEBUGDPP("object {} handle op {}", *this, ox.get_target(), op);
1099+
co_await ox.execute_op(op);
11001100
}
1101-
DEBUGDPP("object {} all operations successful", *this, ox->get_target());
1101+
DEBUGDPP("object {} all operations successful", *this, ox.get_target());
11021102

11031103
// check for full
1104-
if ((ox->delta_stats.num_bytes > 0 ||
1105-
ox->delta_stats.num_objects > 0) &&
1104+
if ((ox.delta_stats.num_bytes > 0 ||
1105+
ox.delta_stats.num_objects > 0) &&
11061106
get_pgpool().info.has_flag(pg_pool_t::FLAG_FULL)) {
1107-
const auto& m = ox->get_message();
1107+
const auto& m = ox.get_message();
11081108
if (m.get_reqid().name.is_mds() || // FIXME: ignore MDS for now
11091109
m.has_flag(CEPH_OSD_FLAG_FULL_FORCE)) {
11101110
INFODPP("full, but proceeding due to FULL_FORCE, or MDS", *this);
@@ -1129,13 +1129,12 @@ PG::run_executer_fut PG::run_executer(
11291129
}
11301130

11311131
PG::submit_executer_fut PG::submit_executer(
1132-
seastar::lw_shared_ptr<OpsExecuter> ox,
1133-
const std::vector<OSDOp>& ops)
1134-
{
1132+
OpsExecuter &&ox,
1133+
const std::vector<OSDOp>& ops) {
11351134
LOG_PREFIX(PG::submit_executer);
11361135
// transaction must commit at this point
11371136
return std::move(
1138-
*ox
1137+
ox
11391138
).flush_changes_n_do_ops_effects(
11401139
ops,
11411140
snap_mapper,

src/crimson/osd/pg.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ class PG : public boost::intrusive_ref_counter<
658658
run_executer_ertr>;
659659
using run_executer_fut = run_executer_iertr::future<>;
660660
run_executer_fut run_executer(
661-
seastar::lw_shared_ptr<OpsExecuter> ox,
661+
OpsExecuter &ox,
662662
ObjectContextRef obc,
663663
const OpInfo &op_info,
664664
std::vector<OSDOp>& ops);
@@ -669,7 +669,7 @@ class PG : public boost::intrusive_ref_counter<
669669
using submit_executer_fut = interruptible_future<
670670
submit_executer_ret>;
671671
submit_executer_fut submit_executer(
672-
seastar::lw_shared_ptr<OpsExecuter> ox,
672+
OpsExecuter &&ox,
673673
const std::vector<OSDOp>& ops);
674674

675675
struct do_osd_ops_params_t;

0 commit comments

Comments
 (0)