]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: RGWObjectCtxImpl::invalidate takes const ref
authorCasey Bodley <cbodley@redhat.com>
Wed, 10 Oct 2018 19:54:25 +0000 (15:54 -0400)
committerCasey Bodley <cbodley@redhat.com>
Tue, 16 Oct 2018 15:06:14 +0000 (11:06 -0400)
also removes the default implementation, which is duplicated in the
specialization for rgw_obj

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index 2154b040bd88c7623d1616e9af95a1db3c99ccef..6ac2daf0058cfa582e485076a99ef4632e696f48 100644 (file)
@@ -205,7 +205,7 @@ int rgw_init_ioctx(librados::Rados *rados, const rgw_pool& pool, IoCtx& ioctx, b
 }
 
 template<>
-void RGWObjectCtxImpl<rgw_obj, RGWObjState>::invalidate(rgw_obj& obj) {
+void RGWObjectCtxImpl<rgw_obj, RGWObjState>::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<rgw_obj, RGWObjState>::invalidate(rgw_obj& obj) {
 }
 
 template<>
-void RGWObjectCtxImpl<rgw_raw_obj, RGWRawObjState>::invalidate(rgw_raw_obj& obj) {
+void RGWObjectCtxImpl<rgw_raw_obj, RGWRawObjState>::invalidate(const rgw_raw_obj& obj) {
   RWLock::WLocker wl(lock);
   auto iter = objs_state.find(obj);
   if (iter == objs_state.end()) {
index 159116858d398e536049130d1b97bbad7df5c416..00b3c7abc5c50a79c04170b89f1c5e1c2905c8e5 100644 (file)
@@ -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<rgw_obj, RGWObjState>::invalidate(rgw_obj& obj);
+void RGWObjectCtxImpl<rgw_obj, RGWObjState>::invalidate(const rgw_obj& obj);
 
 template<>
-void RGWObjectCtxImpl<rgw_raw_obj, RGWRawObjState>::invalidate(rgw_raw_obj& obj);
+void RGWObjectCtxImpl<rgw_raw_obj, RGWRawObjState>::invalidate(const rgw_raw_obj& obj);
 
 struct RGWObjectCtx {
   RGWRados *store;