From a7eab94ba88e2b2f1c3bd8e17a19709d45965b50 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Wed, 10 Oct 2018 15:54:25 -0400 Subject: [PATCH] rgw: RGWObjectCtxImpl::invalidate takes const ref also removes the default implementation, which is duplicated in the specialization for rgw_obj Signed-off-by: Casey Bodley --- src/rgw/rgw_rados.cc | 4 ++-- src/rgw/rgw_rados.h | 22 +++------------------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 2154b040bd88c..6ac2daf0058cf 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -205,7 +205,7 @@ int rgw_init_ioctx(librados::Rados *rados, const rgw_pool& pool, IoCtx& ioctx, b } template<> -void RGWObjectCtxImpl::invalidate(rgw_obj& obj) { +void RGWObjectCtxImpl::invalidate(const rgw_obj& obj) { RWLock::WLocker wl(lock); auto iter = objs_state.find(obj); if (iter == objs_state.end()) { @@ -224,7 +224,7 @@ void RGWObjectCtxImpl::invalidate(rgw_obj& obj) { } template<> -void RGWObjectCtxImpl::invalidate(rgw_raw_obj& obj) { +void RGWObjectCtxImpl::invalidate(const rgw_raw_obj& obj) { RWLock::WLocker wl(lock); auto iter = objs_state.find(obj); if (iter == objs_state.end()) { diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 159116858d398..00b3c7abc5c50 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -2062,30 +2062,14 @@ public: assert (!obj.empty()); objs_state[obj].prefetch_data = true; } - void invalidate(T& obj) { - RWLock::WLocker wl(lock); - auto iter = objs_state.find(obj); - if (iter == objs_state.end()) { - return; - } - bool is_atomic = iter->second.is_atomic; - bool prefetch_data = iter->second.prefetch_data; - - objs_state.erase(iter); - - if (is_atomic || prefetch_data) { - auto& s = objs_state[obj]; - s.is_atomic = is_atomic; - s.prefetch_data = prefetch_data; - } - } + void invalidate(const T& obj); }; template<> -void RGWObjectCtxImpl::invalidate(rgw_obj& obj); +void RGWObjectCtxImpl::invalidate(const rgw_obj& obj); template<> -void RGWObjectCtxImpl::invalidate(rgw_raw_obj& obj); +void RGWObjectCtxImpl::invalidate(const rgw_raw_obj& obj); struct RGWObjectCtx { RGWRados *store; -- 2.39.5