// ceph-osd has this implemented in `PrimaryLogPG::execute_ctx`,
// grep for `ignore_out_data`.
using crimson::common::local_conf;
- if (op_info->allows_returnvec() &&
- op_info->may_write() &&
+ if (op_info.allows_returnvec() &&
+ op_info.may_write() &&
ret >= 0 &&
outdata.length() > local_conf()->osd_max_write_op_reply_len) {
// the justification of this limit it to not inflate the pg log.
}
// for write calls we never return data expect errors or RETURNVEC.
// please refer cls/cls_hello.cc to details.
- if (!op_info->may_write() || op_info->allows_returnvec() || ret < 0) {
+ if (!op_info.may_write() || op_info.allows_returnvec() || ret < 0) {
osd_op.op.extent.length = outdata.length();
osd_op.outdata.claim_append(outdata);
}
logger().warn("handling op {}", ceph_osd_op_name(osd_op.op.op));
switch (const ceph_osd_op& op = osd_op.op; op.op) {
case CEPH_OSD_OP_PGLS:
- return do_pg_op([&osd_op] (const auto& pg, const auto& nspace) {
- return do_pgls(pg, nspace, osd_op);
- });
+ return do_pgls(pg, nspace, osd_op);
case CEPH_OSD_OP_PGLS_FILTER:
- return do_pg_op([&osd_op] (const auto& pg, const auto& nspace) {
- return do_pgls_filtered(pg, nspace, osd_op);
- });
+ return do_pgls_filtered(pg, nspace, osd_op);
case CEPH_OSD_OP_PGNLS:
- return do_pg_op([&osd_op] (const auto& pg, const auto& nspace) {
- return do_pgnls(pg, nspace, osd_op);
- });
+ return do_pgnls(pg, nspace, osd_op);
case CEPH_OSD_OP_PGNLS_FILTER:
- return do_pg_op([&osd_op] (const auto& pg, const auto& nspace) {
- return do_pgnls_filtered(pg, nspace, osd_op);
- });
+ return do_pgnls_filtered(pg, nspace, osd_op);
default:
logger().warn("unknown op {}", ceph_osd_op_name(op.op));
throw std::runtime_error(
};
ObjectContextRef obc;
- const OpInfo* op_info;
+ const OpInfo& op_info;
PG& pg;
PGBackend& backend;
Ref<MOSDOp> msg;
}
public:
- OpsExecuter(ObjectContextRef obc, const OpInfo* op_info, PG& pg, Ref<MOSDOp> msg)
+ OpsExecuter(ObjectContextRef obc, const OpInfo& op_info, PG& pg, Ref<MOSDOp> msg)
: obc(std::move(obc)),
op_info(op_info),
pg(pg),
// PgOpsExecuter -- a class for executing ops targeting a certain PG.
class PgOpsExecuter {
public:
- PgOpsExecuter(PG& pg, Ref<MOSDOp> msg)
- : pg(pg), msg(std::move(msg)) {
+ PgOpsExecuter(const PG& pg, const MOSDOp& msg)
+ : pg(pg), nspace(msg.get_hobj().nspace) {
}
seastar::future<> execute_pg_op(class OSDOp& osd_op);
private:
- // PG operations are being provided with pg instead of os.
- template <class Func>
- auto do_pg_op(Func&& f) {
- return std::forward<Func>(f)(std::as_const(pg),
- std::as_const(msg->get_hobj().nspace));
- }
-
- PG& pg;
- Ref<MOSDOp> msg;
+ const PG& pg;
+ const std::string& nspace;
};
} // namespace crimson::osd
const auto oid = m->get_snapid() == CEPH_SNAPDIR ? m->get_hobj().get_head()
: m->get_hobj();
auto ox =
- std::make_unique<OpsExecuter>(obc, &op_info, *this/* as const& */, m);
+ std::make_unique<OpsExecuter>(obc, op_info, *this/* as const& */, m);
return crimson::do_for_each(
m->ops, [obc, m, ox = ox.get()](OSDOp& osd_op) {
throw crimson::common::system_shutdown_exception();
}
- auto ox = std::make_unique<PgOpsExecuter>(*this/* as const& */, m);
+ auto ox = std::make_unique<PgOpsExecuter>(std::as_const(*this),
+ std::as_const(*m));
return seastar::do_for_each(m->ops, [ox = ox.get()](OSDOp& osd_op) {
logger().debug("will be handling pg op {}", ceph_osd_op_name(osd_op.op.op));
return ox->execute_pg_op(osd_op);