From 47af391c56e241e612efb656811d587cd309c82f Mon Sep 17 00:00:00 2001 From: Matan Breizman Date: Sun, 7 Apr 2024 12:23:56 +0000 Subject: [PATCH] crimson/osd/object_context_loader: Simplify with_obc No change in behavior Signed-off-by: Matan Breizman --- src/crimson/osd/object_context_loader.cc | 12 ++++-------- src/crimson/osd/object_context_loader.h | 5 ++--- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/crimson/osd/object_context_loader.cc b/src/crimson/osd/object_context_loader.cc index 351bb3b46dea5..699f1c4728d46 100644 --- a/src/crimson/osd/object_context_loader.cc +++ b/src/crimson/osd/object_context_loader.cc @@ -9,11 +9,11 @@ using crimson::common::local_conf; template ObjectContextLoader::load_obc_iertr::future<> - ObjectContextLoader::with_head_obc(ObjectContextRef obc, - bool existed, + ObjectContextLoader::with_head_obc(const hobject_t& oid, with_obc_func_t&& func) { LOG_PREFIX(ObjectContextLoader::with_head_obc); + auto [obc, existed] = obc_registry.get_cached_obc(oid); DEBUGDPP("object {}", dpp, obc->get_oid()); assert(obc->is_head()); obc->append_to(obc_set_accessing); @@ -36,7 +36,7 @@ using crimson::common::local_conf; template ObjectContextLoader::load_obc_iertr::future<> - ObjectContextLoader::with_clone_obc(hobject_t oid, + ObjectContextLoader::with_clone_obc(const hobject_t& oid, with_obc_func_t&& func) { LOG_PREFIX(ObjectContextLoader::with_clone_obc); @@ -97,11 +97,7 @@ using crimson::common::local_conf; with_obc_func_t&& func) { if (oid.is_head()) { - auto [obc, existed] = - obc_registry.get_cached_obc(std::move(oid)); - return with_head_obc(std::move(obc), - existed, - std::move(func)); + return with_head_obc(oid, std::move(func)); } else { return with_clone_obc(oid, std::move(func)); } diff --git a/src/crimson/osd/object_context_loader.h b/src/crimson/osd/object_context_loader.h index a594f3db975e6..1d9c3bb90a276 100644 --- a/src/crimson/osd/object_context_loader.h +++ b/src/crimson/osd/object_context_loader.h @@ -59,12 +59,11 @@ private: obc_accessing_list_t obc_set_accessing; template - load_obc_iertr::future<> with_clone_obc(hobject_t oid, + load_obc_iertr::future<> with_clone_obc(const hobject_t& oid, with_obc_func_t&& func); template - load_obc_iertr::future<> with_head_obc(ObjectContextRef obc, - bool existed, + load_obc_iertr::future<> with_head_obc(const hobject_t& oid, with_obc_func_t&& func); template -- 2.39.5