From 2b3fbcf9b1e1ca4476610648d600d2dd79aa1b0d Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Thu, 11 Aug 2022 17:53:44 -0400 Subject: [PATCH] rgw: RGWContinuousLeaseCR takes arguments by value and moves them 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 --- src/rgw/driver/rados/rgw_cr_rados.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/rgw/driver/rados/rgw_cr_rados.h b/src/rgw/driver/rados/rgw_cr_rados.h index 5a0f1db20a13d..ed7611dc1f211 100644 --- a/src/rgw/driver/rados/rgw_cr_rados.h +++ b/src/rgw/driver/rados/rgw_cr_rados.h @@ -1402,22 +1402,22 @@ public: }; class RGWContinuousLeaseCR : public RGWCoroutine { - RGWAsyncRadosProcessor *async_rados; + RGWAsyncRadosProcessor* async_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; + RGWCoroutine* caller; 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; -- 2.39.5