]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: RGWContinuousLeaseCR takes arguments by value and moves them
authorAdam C. Emerson <aemerson@redhat.com>
Thu, 11 Aug 2022 21:53:44 +0000 (17:53 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Wed, 11 Jan 2023 06:26:29 +0000 (01:26 -0500)
Since we were taking them by reference and copying before, this is
strictly better. Callers that give us an RValue can skip the copy.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/rgw/driver/rados/rgw_cr_rados.h

index 5a0f1db20a13d2dd343beec4b4335b86be2824ac..ed7611dc1f2112f2c1f8bac72dcba1106a9d203f 100644 (file)
@@ -1402,22 +1402,22 @@ public:
 };
 
 class RGWContinuousLeaseCR : public RGWCoroutine {
-  RGWAsyncRadosProcessor *async_rados;
+  RGWAsyncRadosProcessorasync_rados;
   rgw::sal::RadosStore* store;
 
   const rgw_raw_obj obj;
 
   const std::string lock_name;
-  const std::string cookie;
+  const std::string cookie{RGWSimpleRadosLockCR::gen_random_cookie(cct)};
 
   int interval;
-  bool going_down{ false };
+  bool going_down{false};
   bool locked{false};
   
   const ceph::timespan interval_tolerance;
   const ceph::timespan ts_interval;
 
-  RGWCoroutine *caller;
+  RGWCoroutinecaller;
 
   bool aborted{false};
   
@@ -1425,14 +1425,14 @@ class RGWContinuousLeaseCR : public RGWCoroutine {
   ceph::coarse_mono_time current_time;
 
 public:
-  RGWContinuousLeaseCR(RGWAsyncRadosProcessor *_async_rados, rgw::sal::RadosStore* _store,
-                       const rgw_raw_obj& _obj,
-                       const std::string& _lock_name, int _interval, RGWCoroutine *_caller)
-    : RGWCoroutine(_store->ctx()), async_rados(_async_rados), store(_store),
-    obj(_obj), lock_name(_lock_name),
-    cookie(RGWSimpleRadosLockCR::gen_random_cookie(cct)),
-    interval(_interval), interval_tolerance(ceph::make_timespan(9*interval/10)), ts_interval(ceph::make_timespan(interval)),
-      caller(_caller)
+  RGWContinuousLeaseCR(RGWAsyncRadosProcessor* async_rados,
+                       rgw::sal::RadosStore* _store,
+                       rgw_raw_obj obj, std::string lock_name,
+                       int interval, RGWCoroutine* caller)
+    : RGWCoroutine(_store->ctx()), async_rados(async_rados), store(_store),
+      obj(std::move(obj)), lock_name(std::move(lock_name)),
+      interval(interval), interval_tolerance(ceph::make_timespan(9*interval/10)),
+      ts_interval(ceph::make_timespan(interval)), caller(caller)
   {}
 
   virtual ~RGWContinuousLeaseCR() override;