with_obc_func_t&& func)
{
assert(!oid.is_head());
- return with_head_obc<RWState::RWREAD>(oid.get_head(),
+ return with_obc<RWState::RWREAD>(oid.get_head(),
[oid, func=std::move(func), this](auto head) mutable
-> load_obc_iertr::future<> {
if (!head->obs.exists) {
template<RWState::State State>
ObjectContextLoader::load_obc_iertr::future<>
- ObjectContextLoader::with_head_obc(hobject_t oid,
- with_obc_func_t&& func)
+ ObjectContextLoader::with_obc(hobject_t oid,
+ with_obc_func_t&& func)
{
- auto [obc, existed] =
- shard_services.get_cached_obc(std::move(oid));
- return with_head_obc<State>(std::move(obc),
- existed,
- std::move(func));
+ if (oid.is_head()) {
+ auto [obc, existed] =
+ shard_services.get_cached_obc(std::move(oid));
+ return with_head_obc<State>(std::move(obc),
+ existed,
+ std::move(func));
+ } else {
+ return with_clone_obc<State>(oid, std::move(func));
+ }
}
ObjectContextLoader::load_obc_iertr::future<ObjectContextRef>
// explicitly instantiate the used instantiations
template ObjectContextLoader::load_obc_iertr::future<>
- ObjectContextLoader::with_head_obc<RWState::RWNONE>(hobject_t,
- with_obc_func_t&&);
-
- template ObjectContextLoader::load_obc_iertr::future<>
- ObjectContextLoader::with_head_obc<RWState::RWREAD>(hobject_t,
- with_obc_func_t&&);
-
- template ObjectContextLoader::load_obc_iertr::future<>
- ObjectContextLoader::with_head_obc<RWState::RWWRITE>(hobject_t,
- with_obc_func_t&&);
-
- template ObjectContextLoader::load_obc_iertr::future<>
- ObjectContextLoader::with_head_obc<RWState::RWEXCL>(hobject_t,
- with_obc_func_t&&);
-
- template ObjectContextLoader::load_obc_iertr::future<>
- ObjectContextLoader::with_clone_obc<RWState::RWNONE>(hobject_t,
- with_obc_func_t&&);
+ ObjectContextLoader::with_obc<RWState::RWNONE>(hobject_t,
+ with_obc_func_t&&);
template ObjectContextLoader::load_obc_iertr::future<>
- ObjectContextLoader::with_clone_obc<RWState::RWREAD>(hobject_t,
- with_obc_func_t&&);
+ ObjectContextLoader::with_obc<RWState::RWREAD>(hobject_t,
+ with_obc_func_t&&);
template ObjectContextLoader::load_obc_iertr::future<>
- ObjectContextLoader::with_clone_obc<RWState::RWWRITE>(hobject_t,
- with_obc_func_t&&);
+ ObjectContextLoader::with_obc<RWState::RWWRITE>(hobject_t,
+ with_obc_func_t&&);
template ObjectContextLoader::load_obc_iertr::future<>
- ObjectContextLoader::with_clone_obc<RWState::RWEXCL>(hobject_t,
- with_obc_func_t&&);
+ ObjectContextLoader::with_obc<RWState::RWEXCL>(hobject_t,
+ with_obc_func_t&&);
}
const hobject_t oid = get_oid(hobj);
switch (get_lock_type(op_info)) {
case RWState::RWREAD:
- if (oid.is_head()) {
- return obc_loader.with_head_obc<RWState::RWREAD>(oid, std::move(f));
- } else {
- return obc_loader.with_clone_obc<RWState::RWREAD>(oid, std::move(f));
- }
+ return obc_loader.with_obc<RWState::RWREAD>(oid, std::move(f));
case RWState::RWWRITE:
- if (oid.is_head()) {
- return obc_loader.with_head_obc<RWState::RWWRITE>(oid, std::move(f));
- } else {
- return obc_loader.with_clone_obc<RWState::RWWRITE>(oid, std::move(f));
- }
+ return obc_loader.with_obc<RWState::RWWRITE>(oid, std::move(f));
case RWState::RWEXCL:
- if (oid.is_head()) {
- return obc_loader.with_head_obc<RWState::RWEXCL>(oid, std::move(f));
- } else {
- return obc_loader.with_clone_obc<RWState::RWEXCL>(oid, std::move(f));
- }
+ return obc_loader.with_obc<RWState::RWEXCL>(oid, std::move(f));
default:
ceph_abort();
};
// start tracking the recovery of soid
return maybe_pull_missing_obj(soid, need).then_interruptible([this, soid, need] {
logger().debug("recover_object: loading obc: {}", soid);
- return pg.obc_loader.with_head_obc<RWState::RWREAD>(soid,
+ return pg.obc_loader.with_obc<RWState::RWREAD>(soid,
[this, soid, need](auto obc) {
logger().debug("recover_object: loaded obc: {}", obc->obs.oi.soid);
auto& recovery_waiter = get_recovering(soid);
auto prepare_waiter = interruptor::make_interruptible(
seastar::make_ready_future<>());
if (pi.recovery_progress.first) {
- prepare_waiter = pg.obc_loader.with_head_obc<RWState::RWNONE>(
+ prepare_waiter = pg.obc_loader.with_obc<RWState::RWNONE>(
pi.recovery_info.soid, [&pi, &recovery_waiter, &pop](auto obc) {
pi.obc = obc;
recovery_waiter.obc = obc;