From bd5b37de64414ca6ac7a229bf62cd7fb4a63f4f9 Mon Sep 17 00:00:00 2001 From: samarah Date: Thu, 7 Dec 2023 13:02:56 -0500 Subject: [PATCH] rgw/cache: Make protected members private Signed-off-by: samarah --- src/rgw/rgw_redis_driver.cc | 2 +- src/rgw/rgw_redis_driver.h | 12 +++-- src/rgw/rgw_ssd_driver.h | 94 ++++++++++++++++++------------------- 3 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/rgw/rgw_redis_driver.cc b/src/rgw/rgw_redis_driver.cc index fd7b44693e3ec..2b9e1dd387a29 100644 --- a/src/rgw/rgw_redis_driver.cc +++ b/src/rgw/rgw_redis_driver.cc @@ -495,7 +495,7 @@ int RedisDriver::set_attr(const DoutPrefixProvider* dpp, const std::string& key, return std::get<0>(resp).value(); } -static Aio::OpFunc redis_read_op(optional_yield y, std::shared_ptr conn, +Aio::OpFunc RedisDriver::redis_read_op(optional_yield y, std::shared_ptr conn, off_t read_ofs, off_t read_len, const std::string& key) { return [y, conn, key] (Aio* aio, AioResult& r) mutable { diff --git a/src/rgw/rgw_redis_driver.h b/src/rgw/rgw_redis_driver.h index a219f7f9b289d..b51924103cdab 100644 --- a/src/rgw/rgw_redis_driver.h +++ b/src/rgw/rgw_redis_driver.h @@ -47,6 +47,12 @@ class RedisDriver : public CacheDriver { virtual int set_attr(const DoutPrefixProvider* dpp, const std::string& key, const std::string& attr_name, const std::string& attr_val, optional_yield y) override; virtual int get_attr(const DoutPrefixProvider* dpp, const std::string& key, const std::string& attr_name, std::string& attr_val, optional_yield y) override; void shutdown(); + + private: + std::shared_ptr conn; + Partition partition_info; + uint64_t free_space; + uint64_t outstanding_write_size; struct redis_response { boost::redis::response resp; @@ -65,11 +71,7 @@ class RedisDriver : public CacheDriver { } }; - protected: - std::shared_ptr conn; - Partition partition_info; - uint64_t free_space; - uint64_t outstanding_write_size; + static Aio::OpFunc redis_read_op(optional_yield y, std::shared_ptr conn, off_t read_ofs, off_t read_len, const std::string& key); }; } } // namespace rgw::cache diff --git a/src/rgw/rgw_ssd_driver.h b/src/rgw/rgw_ssd_driver.h index 370204a2f93ba..9d039cefd1209 100644 --- a/src/rgw/rgw_ssd_driver.h +++ b/src/rgw/rgw_ssd_driver.h @@ -31,6 +31,11 @@ public: virtual Partition get_current_partition_info(const DoutPrefixProvider* dpp) override { return partition_info; } virtual uint64_t get_free_space(const DoutPrefixProvider* dpp) override { return free_space; } +private: + Partition partition_info; + uint64_t free_space; + CephContext* cct; + struct libaio_handler { rgw::Aio* throttle = nullptr; rgw::AioResult& r; @@ -42,66 +47,59 @@ public: } }; -protected: - Partition partition_info; - uint64_t free_space; - -private: - -// unique_ptr with custom deleter for struct aiocb -struct libaio_aiocb_deleter { - void operator()(struct aiocb* c) { - if(c->aio_fildes > 0) { - if( ::close(c->aio_fildes) != 0) { + // unique_ptr with custom deleter for struct aiocb + struct libaio_aiocb_deleter { + void operator()(struct aiocb* c) { + if(c->aio_fildes > 0) { + if( ::close(c->aio_fildes) != 0) { + } } + delete c; } - delete c; - } -}; + }; -template - auto get_async(const DoutPrefixProvider *dpp, ExecutionContext& ctx, const std::string& key, - off_t read_ofs, off_t read_len, CompletionToken&& token); + template + auto get_async(const DoutPrefixProvider *dpp, ExecutionContext& ctx, const std::string& key, + off_t read_ofs, off_t read_len, CompletionToken&& token); -rgw::Aio::OpFunc ssd_cache_read_op(const DoutPrefixProvider *dpp, optional_yield y, rgw::cache::CacheDriver* cache_driver, - off_t read_ofs, off_t read_len, const std::string& key); + rgw::Aio::OpFunc ssd_cache_read_op(const DoutPrefixProvider *dpp, optional_yield y, rgw::cache::CacheDriver* cache_driver, + off_t read_ofs, off_t read_len, const std::string& key); -using unique_aio_cb_ptr = std::unique_ptr; + using unique_aio_cb_ptr = std::unique_ptr; -struct AsyncReadOp { - bufferlist result; - unique_aio_cb_ptr aio_cb; - using Signature = void(boost::system::error_code, bufferlist); - using Completion = ceph::async::Completion; + struct AsyncReadOp { + bufferlist result; + unique_aio_cb_ptr aio_cb; + using Signature = void(boost::system::error_code, bufferlist); + using Completion = ceph::async::Completion; int init(const DoutPrefixProvider *dpp, const std::string& file_path, off_t read_ofs, off_t read_len, void* arg); static void libaio_cb_aio_dispatch(sigval sigval); - template - static auto create(const Executor1& ex1, CompletionHandler&& handler); -}; - -struct AsyncWriteRequest { - const DoutPrefixProvider* dpp; - std::string key; - void *data; - int fd; - struct aiocb *cb; - SSDDriver *priv_data; - - AsyncWriteRequest(const DoutPrefixProvider* dpp) : dpp(dpp) {} - int prepare_libaio_write_op(const DoutPrefixProvider *dpp, bufferlist& bl, unsigned int len, std::string key, std::string cache_location); - static void libaio_write_cb(sigval sigval); - - ~AsyncWriteRequest() { - ::close(fd); - cb->aio_buf = nullptr; - delete(cb); - } -}; + template + static auto create(const Executor1& ex1, CompletionHandler&& handler); + }; -void libaio_write_completion_cb(AsyncWriteRequest* c); + struct AsyncWriteRequest { + const DoutPrefixProvider* dpp; + std::string key; + void *data; + int fd; + struct aiocb *cb; + SSDDriver *priv_data; + + AsyncWriteRequest(const DoutPrefixProvider* dpp) : dpp(dpp) {} + int prepare_libaio_write_op(const DoutPrefixProvider *dpp, bufferlist& bl, unsigned int len, std::string key, std::string cache_location); + static void libaio_write_cb(sigval sigval); + + ~AsyncWriteRequest() { + ::close(fd); + cb->aio_buf = nullptr; + delete(cb); + } + }; + void libaio_write_completion_cb(AsyncWriteRequest* c); }; } } // namespace rgw::cache -- 2.39.5