});
}
-std::pair<hobject_t, RWState::State> PG::get_oid_and_lock(
- const MOSDOp &m,
- const OpInfo &op_info)
+hobject_t PG::get_oid(const MOSDOp &m)
+{
+ return (m.get_snapid() == CEPH_SNAPDIR ?
+ m.get_hobj().get_head() :
+ m.get_hobj());
+}
+
+RWState::State PG::get_lock_type(const OpInfo &op_info)
{
- auto oid = m.get_snapid() == CEPH_SNAPDIR ?
- m.get_hobj().get_head() : m.get_hobj();
- RWState::State lock_type = RWState::RWNONE;
if (op_info.rwordered() && op_info.may_read()) {
- lock_type = RWState::RWState::RWEXCL;
+ return RWState::RWEXCL;
} else if (op_info.rwordered()) {
- lock_type = RWState::RWState::RWWRITE;
+ return RWState::RWWRITE;
} else {
ceph_assert(op_info.may_read());
- lock_type = RWState::RWState::RWREAD;
+ return RWState::RWREAD;
}
- return std::make_pair(oid, lock_type);
}
std::optional<hobject_t> PG::resolve_oid(
void handle_activate_map(PeeringCtx &rctx);
void handle_initialize(PeeringCtx &rctx);
- static std::pair<hobject_t, RWState::State> get_oid_and_lock(
- const MOSDOp &m,
- const OpInfo &op_info);
+ static hobject_t get_oid(const MOSDOp &m);
+ static RWState::State get_lock_type(const OpInfo &op_info);
static std::optional<hobject_t> resolve_oid(
const SnapSet &snapset,
const hobject_t &oid);
if (__builtin_expect(stopping, false)) {
throw crimson::common::system_shutdown_exception();
}
- auto [oid, type] = get_oid_and_lock(*m, op_info);
- return get_locked_obc(op, oid, type)
+ RWState::State type = get_lock_type(op_info);
+ return get_locked_obc(op, get_oid(*m), type)
.safe_then([f=std::forward<F>(f), type=type](auto obc) {
return f(obc).finally([obc, type=type] {
obc->put_lock_type(type);