]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rgw/rgw_d3n_cacherequest.h
update ceph source to reef 18.2.0
[ceph.git] / ceph / src / rgw / rgw_d3n_cacherequest.h
index eac8c7610eebaa0cd4b8e17fa76a28ec5ae2e36b..edc70247fe1bec301ec2648989a3b8568802d078 100644 (file)
@@ -48,14 +48,14 @@ struct D3nL1CacheRequest {
     using Signature = void(boost::system::error_code, bufferlist);
     using Completion = ceph::async::Completion<Signature, AsyncFileReadOp>;
 
-    int init(const DoutPrefixProvider *dpp, const std::string& file_path, off_t read_ofs, off_t read_len, void* arg) {
-      ldpp_dout(dpp, 20) << "D3nDataCache: " << __func__ << "(): file_path=" << file_path << dendl;
+    int init_async_read(const DoutPrefixProvider *dpp, const std::string& location, off_t read_ofs, off_t read_len, void* arg) {
+      ldpp_dout(dpp, 20) << "D3nDataCache: " << __func__ << "(): location=" << location << dendl;
       aio_cb.reset(new struct aiocb);
       memset(aio_cb.get(), 0, sizeof(struct aiocb));
-      aio_cb->aio_fildes = TEMP_FAILURE_RETRY(::open(file_path.c_str(), O_RDONLY|O_CLOEXEC|O_BINARY));
+      aio_cb->aio_fildes = TEMP_FAILURE_RETRY(::open(location.c_str(), O_RDONLY|O_CLOEXEC|O_BINARY));
       if(aio_cb->aio_fildes < 0) {
         int err = errno;
-        ldpp_dout(dpp, 1) << "ERROR: D3nDataCache: " << __func__ << "(): can't open " << file_path << " : " << cpp_strerror(err) << dendl;
+        ldpp_dout(dpp, 1) << "ERROR: D3nDataCache: " << __func__ << "(): can't open " << location << " : " << cpp_strerror(err) << dendl;
         return -err;
       }
       if (g_conf()->rgw_d3n_l1_fadvise != POSIX_FADV_NORMAL)
@@ -96,7 +96,7 @@ struct D3nL1CacheRequest {
   };
 
   template <typename ExecutionContext, typename CompletionToken>
-  auto async_read(const DoutPrefixProvider *dpp, ExecutionContext& ctx, const std::string& file_path,
+  auto async_read(const DoutPrefixProvider *dpp, ExecutionContext& ctx, const std::string& location,
                   off_t read_ofs, off_t read_len, CompletionToken&& token) {
     using Op = AsyncFileReadOp;
     using Signature = typename Op::Signature;
@@ -104,8 +104,8 @@ struct D3nL1CacheRequest {
     auto p = Op::create(ctx.get_executor(), init.completion_handler);
     auto& op = p->user_data;
 
-    ldpp_dout(dpp, 20) << "D3nDataCache: " << __func__ << "(): file_path=" << file_path << dendl;
-    int ret = op.init(dpp, file_path, read_ofs, read_len, p.get());
+    ldpp_dout(dpp, 20) << "D3nDataCache: " << __func__ << "(): location=" << location << dendl;
+    int ret = op.init_async_read(dpp, location, read_ofs, read_len, p.get());
     if(0 == ret) {
       ret = ::aio_read(op.aio_cb.get());
     }
@@ -131,7 +131,7 @@ struct D3nL1CacheRequest {
   };
 
   void file_aio_read_abstract(const DoutPrefixProvider *dpp, boost::asio::io_context& context, yield_context yield,
-                              std::string& file_path, off_t read_ofs, off_t read_len,
+                              std::string& cache_location, off_t read_ofs, off_t read_len,
                               rgw::Aio* aio, rgw::AioResult& r) {
     using namespace boost::asio;
     async_completion<yield_context, void()> init(yield);
@@ -139,7 +139,7 @@ struct D3nL1CacheRequest {
 
     auto& ref = r.obj.get_ref();
     ldpp_dout(dpp, 20) << "D3nDataCache: " << __func__ << "(): oid=" << ref.obj.oid << dendl;
-    async_read(dpp, context, file_path+"/"+ref.obj.oid, read_ofs, read_len, bind_executor(ex, d3n_libaio_handler{aio, r}));
+    async_read(dpp, context, cache_location+"/"+url_encode(ref.obj.oid, true), read_ofs, read_len, bind_executor(ex, d3n_libaio_handler{aio, r}));
   }
 
 };