]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: add optional_yield to RGWSI_SysObj_Cache
authorCasey Bodley <cbodley@redhat.com>
Fri, 23 Nov 2018 20:44:57 +0000 (15:44 -0500)
committerCasey Bodley <cbodley@redhat.com>
Fri, 29 Mar 2019 15:12:49 +0000 (11:12 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/services/svc_sys_obj_cache.cc
src/rgw/services/svc_sys_obj_cache.h

index 5bac5104ff1beca1658365274de4c147f9988a20..e2d41bfbedc12123077ef565399840edf4ed6ad0 100644 (file)
@@ -66,7 +66,8 @@ void RGWSI_SysObj_Cache::normalize_pool_and_obj(const rgw_pool& src_pool, const
 
 int RGWSI_SysObj_Cache::remove(RGWSysObjectCtxBase& obj_ctx,
                                RGWObjVersionTracker *objv_tracker,
-                               const rgw_raw_obj& obj)
+                               const rgw_raw_obj& obj,
+                               optional_yield y)
 
 {
   rgw_pool pool;
@@ -77,12 +78,12 @@ int RGWSI_SysObj_Cache::remove(RGWSysObjectCtxBase& obj_ctx,
   cache.remove(name);
 
   ObjectCacheInfo info;
-  int r = distribute_cache(name, obj, info, REMOVE_OBJ);
+  int r = distribute_cache(name, obj, info, REMOVE_OBJ, y);
   if (r < 0) {
     ldout(cct, 0) << "ERROR: " << __func__ << "(): failed to distribute cache: r=" << r << dendl;
   }
 
-  return RGWSI_SysObj_Core::remove(obj_ctx, objv_tracker, obj);
+  return RGWSI_SysObj_Core::remove(obj_ctx, objv_tracker, obj, y);
 }
 
 int RGWSI_SysObj_Cache::read(RGWSysObjectCtxBase& obj_ctx,
@@ -93,14 +94,15 @@ int RGWSI_SysObj_Cache::read(RGWSysObjectCtxBase& obj_ctx,
                              map<string, bufferlist> *attrs,
                             bool raw_attrs,
                              rgw_cache_entry_info *cache_info,
-                             boost::optional<obj_version> refresh_version)
+                             boost::optional<obj_version> refresh_version,
+                             optional_yield y)
 {
   rgw_pool pool;
   string oid;
   if (ofs != 0) {
     return RGWSI_SysObj_Core::read(obj_ctx, read_state, objv_tracker,
-                          obj, obl, ofs, end, attrs, raw_attrs,
-                          cache_info, refresh_version);
+                                   obj, obl, ofs, end, attrs, raw_attrs,
+                                   cache_info, refresh_version, y);
   }
 
   normalize_pool_and_obj(obj.pool, obj.oid, pool, oid);
@@ -144,7 +146,7 @@ int RGWSI_SysObj_Cache::read(RGWSysObjectCtxBase& obj_ctx,
                         (attrs ? &unfiltered_attrset : nullptr),
                         true, /* cache unfiltered attrs */
                         cache_info,
-                         refresh_version);
+                         refresh_version, y);
   if (r < 0) {
     if (r == -ENOENT) { // only update ENOENT, we'd rather retry other errors
       info.status = r;
@@ -182,8 +184,9 @@ int RGWSI_SysObj_Cache::read(RGWSysObjectCtxBase& obj_ctx,
 }
 
 int RGWSI_SysObj_Cache::get_attr(const rgw_raw_obj& obj,
-                                const char *attr_name,
-                                bufferlist *dest)
+                                 const char *attr_name,
+                                 bufferlist *dest,
+                                 optional_yield y)
 {
   rgw_pool pool;
   string oid;
@@ -208,13 +211,14 @@ int RGWSI_SysObj_Cache::get_attr(const rgw_raw_obj& obj,
     return dest->length();
   }
   /* don't try to cache this one */
-  return RGWSI_SysObj_Core::get_attr(obj, attr_name, dest);
+  return RGWSI_SysObj_Core::get_attr(obj, attr_name, dest, y);
 }
 
 int RGWSI_SysObj_Cache::set_attrs(const rgw_raw_obj& obj, 
                                   map<string, bufferlist>& attrs,
                                   map<string, bufferlist> *rmattrs,
-                                  RGWObjVersionTracker *objv_tracker) 
+                                  RGWObjVersionTracker *objv_tracker,
+                                  optional_yield y)
 {
   rgw_pool pool;
   string oid;
@@ -230,11 +234,11 @@ int RGWSI_SysObj_Cache::set_attrs(const rgw_raw_obj& obj,
     info.version = objv_tracker->write_version;
     info.flags |= CACHE_FLAG_OBJV;
   }
-  int ret = RGWSI_SysObj_Core::set_attrs(obj, attrs, rmattrs, objv_tracker);
+  int ret = RGWSI_SysObj_Core::set_attrs(obj, attrs, rmattrs, objv_tracker, y);
   string name = normal_name(pool, oid);
   if (ret >= 0) {
     cache.put(name, info, NULL);
-    int r = distribute_cache(name, obj, info, UPDATE_OBJ);
+    int r = distribute_cache(name, obj, info, UPDATE_OBJ, y);
     if (r < 0)
       ldout(cct, 0) << "ERROR: failed to distribute cache for " << obj << dendl;
   } else {
@@ -250,7 +254,8 @@ int RGWSI_SysObj_Cache::write(const rgw_raw_obj& obj,
                              bool exclusive,
                              const bufferlist& data,
                              RGWObjVersionTracker *objv_tracker,
-                             real_time set_mtime)
+                             real_time set_mtime,
+                             optional_yield y)
 {
   rgw_pool pool;
   string oid;
@@ -266,8 +271,8 @@ int RGWSI_SysObj_Cache::write(const rgw_raw_obj& obj,
   }
   ceph::real_time result_mtime;
   int ret = RGWSI_SysObj_Core::write(obj, &result_mtime, attrs,
-                            exclusive, data,
-                            objv_tracker, set_mtime);
+                                     exclusive, data,
+                                     objv_tracker, set_mtime, y);
   if (pmtime) {
     *pmtime = result_mtime;
   }
@@ -284,7 +289,7 @@ int RGWSI_SysObj_Cache::write(const rgw_raw_obj& obj,
     // will need that system object in the near-term and b) it
     // generates additional network traffic.
     if (!exclusive) {
-      int r = distribute_cache(name, obj, info, UPDATE_OBJ);
+      int r = distribute_cache(name, obj, info, UPDATE_OBJ, y);
       if (r < 0)
        ldout(cct, 0) << "ERROR: failed to distribute cache for " << obj << dendl;
     }
@@ -298,7 +303,8 @@ int RGWSI_SysObj_Cache::write(const rgw_raw_obj& obj,
 int RGWSI_SysObj_Cache::write_data(const rgw_raw_obj& obj,
                                    const bufferlist& data,
                                    bool exclusive,
-                                   RGWObjVersionTracker *objv_tracker)
+                                   RGWObjVersionTracker *objv_tracker,
+                                   optional_yield y)
 {
   rgw_pool pool;
   string oid;
@@ -314,11 +320,11 @@ int RGWSI_SysObj_Cache::write_data(const rgw_raw_obj& obj,
     info.version = objv_tracker->write_version;
     info.flags |= CACHE_FLAG_OBJV;
   }
-  int ret = RGWSI_SysObj_Core::write_data(obj, data, exclusive, objv_tracker);
+  int ret = RGWSI_SysObj_Core::write_data(obj, data, exclusive, objv_tracker, y);
   string name = normal_name(pool, oid);
   if (ret >= 0) {
     cache.put(name, info, NULL);
-    int r = distribute_cache(name, obj, info, UPDATE_OBJ);
+    int r = distribute_cache(name, obj, info, UPDATE_OBJ, y);
     if (r < 0)
       ldout(cct, 0) << "ERROR: failed to distribute cache for " << obj << dendl;
   } else {
@@ -330,7 +336,8 @@ int RGWSI_SysObj_Cache::write_data(const rgw_raw_obj& obj,
 
 int RGWSI_SysObj_Cache::raw_stat(const rgw_raw_obj& obj, uint64_t *psize, real_time *pmtime, uint64_t *pepoch,
                                  map<string, bufferlist> *attrs, bufferlist *first_chunk,
-                                 RGWObjVersionTracker *objv_tracker)
+                                 RGWObjVersionTracker *objv_tracker,
+                                 optional_yield y)
 {
   rgw_pool pool;
   string oid;
@@ -358,7 +365,8 @@ int RGWSI_SysObj_Cache::raw_stat(const rgw_raw_obj& obj, uint64_t *psize, real_t
       objv_tracker->read_version = info.version;
     goto done;
   }
-  r = RGWSI_SysObj_Core::raw_stat(obj, &size, &mtime, &epoch, &info.xattrs, first_chunk, objv_tracker);
+  r = RGWSI_SysObj_Core::raw_stat(obj, &size, &mtime, &epoch, &info.xattrs,
+                                  first_chunk, objv_tracker, y);
   if (r < 0) {
     if (r == -ENOENT) {
       info.status = r;
@@ -388,17 +396,18 @@ done:
   return 0;
 }
 
-int RGWSI_SysObj_Cache::distribute_cache(const string& normal_name, const rgw_raw_obj& obj, ObjectCacheInfo& obj_info, int op)
+int RGWSI_SysObj_Cache::distribute_cache(const string& normal_name,
+                                         const rgw_raw_obj& obj,
+                                         ObjectCacheInfo& obj_info, int op,
+                                         optional_yield y)
 {
   RGWCacheNotifyInfo info;
-
   info.op = op;
-
   info.obj_info = obj_info;
   info.obj = obj;
   bufferlist bl;
   encode(info, bl);
-  return notify_svc->distribute(normal_name, bl);
+  return notify_svc->distribute(normal_name, bl, y);
 }
 
 int RGWSI_SysObj_Cache::watch_cb(uint64_t notify_id,
index e48b64f228d99f2f0462e1ef6f11474c9c3135a2..b8ff7039c9e8a2234841e1533d50b0ce3f7dcec5 100644 (file)
@@ -35,7 +35,8 @@ protected:
 
   int raw_stat(const rgw_raw_obj& obj, uint64_t *psize, real_time *pmtime, uint64_t *epoch,
                map<string, bufferlist> *attrs, bufferlist *first_chunk,
-               RGWObjVersionTracker *objv_tracker) override;
+               RGWObjVersionTracker *objv_tracker,
+               optional_yield y) override;
 
   int read(RGWSysObjectCtxBase& obj_ctx,
            GetObjState& read_state,
@@ -45,18 +46,22 @@ protected:
            map<string, bufferlist> *attrs,
           bool raw_attrs,
            rgw_cache_entry_info *cache_info,
-           boost::optional<obj_version>) override;
+           boost::optional<obj_version>,
+           optional_yield y) override;
 
-  int get_attr(const rgw_raw_obj& obj, const char *name, bufferlist *dest) override;
+  int get_attr(const rgw_raw_obj& obj, const char *name, bufferlist *dest,
+               optional_yield y) override;
 
   int set_attrs(const rgw_raw_obj& obj, 
                 map<string, bufferlist>& attrs,
                 map<string, bufferlist> *rmattrs,
-                RGWObjVersionTracker *objv_tracker);
+                RGWObjVersionTracker *objv_tracker,
+                optional_yield y);
 
   int remove(RGWSysObjectCtxBase& obj_ctx,
              RGWObjVersionTracker *objv_tracker,
-             const rgw_raw_obj& obj) override;
+             const rgw_raw_obj& obj,
+             optional_yield y) override;
 
   int write(const rgw_raw_obj& obj,
             real_time *pmtime,
@@ -64,14 +69,18 @@ protected:
             bool exclusive,
             const bufferlist& data,
             RGWObjVersionTracker *objv_tracker,
-            real_time set_mtime) override;
+            real_time set_mtime,
+            optional_yield y) override;
 
   int write_data(const rgw_raw_obj& obj,
                  const bufferlist& bl,
                  bool exclusive,
-                 RGWObjVersionTracker *objv_tracker);
+                 RGWObjVersionTracker *objv_tracker,
+                 optional_yield y);
 
-  int distribute_cache(const string& normal_name, const rgw_raw_obj& obj, ObjectCacheInfo& obj_info, int op);
+  int distribute_cache(const string& normal_name, const rgw_raw_obj& obj,
+                       ObjectCacheInfo& obj_info, int op,
+                       optional_yield y);
 
   int watch_cb(uint64_t notify_id,
                uint64_t cookie,