diff options
author | Adam C. Emerson <aemerson@redhat.com> | 2022-12-02 07:55:47 +0100 |
---|---|---|
committer | Casey Bodley <cbodley@redhat.com> | 2023-11-29 19:15:27 +0100 |
commit | a493b0710a50786ef0374df52831774fe6ca8d51 (patch) | |
tree | b6978426f4e9deeb04b78c81ae3bd1004c73ec81 /src/rgw/services | |
parent | rgw: Remove `RGWSI_RADOS` from `RGWSI_ConfigKey_RADOS` (diff) | |
download | ceph-a493b0710a50786ef0374df52831774fe6ca8d51.tar.xz ceph-a493b0710a50786ef0374df52831774fe6ca8d51.zip |
rgw: Remove `RGWSI_RADOS` from `RGWSI_MDLog`
Simply use the RADOS handle and `rgw_rados_ref` directly.
Also move `async_processor` out from `RGWSI_RADOS` and into
`RGWServices_Def`. This is as good a place as it for any, for now, as
it's reachable by everyone who needs it and exists through the
lifetime of the process.
Eventually it's going to go away due to coroutinization, anyway.
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
Diffstat (limited to 'src/rgw/services')
-rw-r--r-- | src/rgw/services/svc_mdlog.cc | 33 | ||||
-rw-r--r-- | src/rgw/services/svc_mdlog.h | 10 | ||||
-rw-r--r-- | src/rgw/services/svc_rados.cc | 13 | ||||
-rw-r--r-- | src/rgw/services/svc_rados.h | 6 |
4 files changed, 27 insertions, 35 deletions
diff --git a/src/rgw/services/svc_mdlog.cc b/src/rgw/services/svc_mdlog.cc index da723f3e129..603718dc96e 100644 --- a/src/rgw/services/svc_mdlog.cc +++ b/src/rgw/services/svc_mdlog.cc @@ -30,13 +30,16 @@ RGWSI_MDLog::RGWSI_MDLog(CephContext *cct, bool _run_sync) : RGWServiceInstance( RGWSI_MDLog::~RGWSI_MDLog() { } -int RGWSI_MDLog::init(RGWSI_RADOS *_rados_svc, RGWSI_Zone *_zone_svc, RGWSI_SysObj *_sysobj_svc, RGWSI_Cls *_cls_svc) +int RGWSI_MDLog::init(librados::Rados* rados_, RGWSI_Zone *_zone_svc, + RGWSI_SysObj *_sysobj_svc, RGWSI_Cls *_cls_svc, + RGWAsyncRadosProcessor* async_processor_) { svc.zone = _zone_svc; svc.sysobj = _sysobj_svc; svc.mdlog = this; - svc.rados = _rados_svc; + rados = rados_; svc.cls = _cls_svc; + async_processor = async_processor_; return 0; } @@ -262,11 +265,12 @@ class ReadHistoryCR : public RGWCoroutine { ReadHistoryCR(const DoutPrefixProvider *dpp, const Svc& svc, Cursor *cursor, - RGWObjVersionTracker *objv_tracker) + RGWObjVersionTracker *objv_tracker, + RGWAsyncRadosProcessor* async_processor) : RGWCoroutine(svc.zone->ctx()), dpp(dpp), svc(svc), cursor(cursor), objv_tracker(objv_tracker), - async_processor(svc.rados->get_async_processor()) + async_processor(async_processor) {} int operate(const DoutPrefixProvider *dpp) { @@ -312,10 +316,11 @@ class WriteHistoryCR : public RGWCoroutine { WriteHistoryCR(const DoutPrefixProvider *dpp, Svc& svc, const Cursor& cursor, - RGWObjVersionTracker *objv) + RGWObjVersionTracker *objv, + RGWAsyncRadosProcessor* async_processor) : RGWCoroutine(svc.zone->ctx()), dpp(dpp), svc(svc), cursor(cursor), objv(objv), - async_processor(svc.rados->get_async_processor()) + async_processor(async_processor) {} int operate(const DoutPrefixProvider *dpp) { @@ -353,18 +358,22 @@ class TrimHistoryCR : public RGWCoroutine { RGWObjVersionTracker *objv; //< to prevent racing updates Cursor next; //< target cursor for oldest log period Cursor existing; //< existing cursor read from disk + RGWAsyncRadosProcessor* async_processor; public: - TrimHistoryCR(const DoutPrefixProvider *dpp, const Svc& svc, Cursor cursor, RGWObjVersionTracker *objv) + TrimHistoryCR(const DoutPrefixProvider *dpp, const Svc& svc, Cursor cursor, + RGWObjVersionTracker *objv, + RGWAsyncRadosProcessor* async_processor) : RGWCoroutine(svc.zone->ctx()), dpp(dpp), svc(svc), - cursor(cursor), objv(objv), next(cursor) { + cursor(cursor), objv(objv), next(cursor), + async_processor(async_processor) { next.next(); // advance past cursor } int operate(const DoutPrefixProvider *dpp) { reenter(this) { // read an existing history, and write the new history if it's newer - yield call(new ReadHistoryCR(dpp, svc, &existing, objv)); + yield call(new ReadHistoryCR(dpp, svc, &existing, objv, async_processor)); if (retcode < 0) { return set_cr_error(retcode); } @@ -375,7 +384,7 @@ class TrimHistoryCR : public RGWCoroutine { return set_cr_error(-ECANCELED); } // overwrite with updated history - yield call(new WriteHistoryCR(dpp, svc, next, objv)); + yield call(new WriteHistoryCR(dpp, svc, next, objv, async_processor)); if (retcode < 0) { return set_cr_error(retcode); } @@ -512,13 +521,13 @@ Cursor RGWSI_MDLog::read_oldest_log_period(optional_yield y, const DoutPrefixPro RGWCoroutine* RGWSI_MDLog::read_oldest_log_period_cr(const DoutPrefixProvider *dpp, Cursor *period, RGWObjVersionTracker *objv) const { - return new mdlog::ReadHistoryCR(dpp, svc, period, objv); + return new mdlog::ReadHistoryCR(dpp, svc, period, objv, async_processor); } RGWCoroutine* RGWSI_MDLog::trim_log_period_cr(const DoutPrefixProvider *dpp, Cursor period, RGWObjVersionTracker *objv) const { - return new mdlog::TrimHistoryCR(dpp, svc, period, objv); + return new mdlog::TrimHistoryCR(dpp, svc, period, objv, async_processor); } RGWMetadataLog* RGWSI_MDLog::get_log(const std::string& period) diff --git a/src/rgw/services/svc_mdlog.h b/src/rgw/services/svc_mdlog.h index 8b37ba11e56..f169ee88db9 100644 --- a/src/rgw/services/svc_mdlog.h +++ b/src/rgw/services/svc_mdlog.h @@ -29,7 +29,6 @@ class RGWCoroutine; class RGWSI_Zone; class RGWSI_SysObj; -class RGWSI_RADOS; namespace mdlog { class ReadHistoryCR; @@ -58,18 +57,21 @@ public: RGWSI_MDLog(CephContext *cct, bool run_sync); virtual ~RGWSI_MDLog(); + librados::Rados* rados{nullptr}; + RGWAsyncRadosProcessor* async_processor{nullptr}; + struct Svc { - RGWSI_RADOS *rados{nullptr}; RGWSI_Zone *zone{nullptr}; RGWSI_SysObj *sysobj{nullptr}; RGWSI_MDLog *mdlog{nullptr}; RGWSI_Cls *cls{nullptr}; } svc; - int init(RGWSI_RADOS *_rados_svc, + int init(librados::Rados* rados_, RGWSI_Zone *_zone_svc, RGWSI_SysObj *_sysobj_svc, - RGWSI_Cls *_cls_svc); + RGWSI_Cls *_cls_svc, + RGWAsyncRadosProcessor* async_processor_); int do_start(optional_yield y, const DoutPrefixProvider *dpp) override; diff --git a/src/rgw/services/svc_rados.cc b/src/rgw/services/svc_rados.cc index d682b87eb2c..34de9857e19 100644 --- a/src/rgw/services/svc_rados.cc +++ b/src/rgw/services/svc_rados.cc @@ -34,27 +34,14 @@ int RGWSI_RADOS::do_start(optional_yield, const DoutPrefixProvider *dpp) return ret; } - async_processor.reset(new RGWAsyncRadosProcessor(cct, cct->_conf->rgw_num_async_rados_threads)); - async_processor->start(); - return 0; } void RGWSI_RADOS::shutdown() { - if (async_processor) { - async_processor->stop(); - } rados.shutdown(); } -void RGWSI_RADOS::stop_processor() -{ - if (async_processor) { - async_processor->stop(); - } -} - librados::Rados* RGWSI_RADOS::get_rados_handle() { return &rados; diff --git a/src/rgw/services/svc_rados.h b/src/rgw/services/svc_rados.h index 4e7cf672c7a..2a3940a34d9 100644 --- a/src/rgw/services/svc_rados.h +++ b/src/rgw/services/svc_rados.h @@ -28,7 +28,6 @@ struct RGWAccessListFilterPrefix : public RGWAccessListFilter { class RGWSI_RADOS : public RGWServiceInstance { librados::Rados rados; - std::unique_ptr<RGWAsyncRadosProcessor> async_processor; int do_start(optional_yield, const DoutPrefixProvider *dpp) override; @@ -66,16 +65,11 @@ public: void init() {} void shutdown() override; - void stop_processor(); std::string cluster_fsid(); uint64_t instance_id(); bool check_secure_mon_conn(const DoutPrefixProvider *dpp) const; - RGWAsyncRadosProcessor *get_async_processor() { - return async_processor.get(); - } - int clog_warn(const std::string& msg); class Handle; |