From 9c482cf9c5ac46f453e527f0c0318d5e04a4270a Mon Sep 17 00:00:00 2001 From: Samarah Date: Tue, 20 Feb 2024 15:39:28 +0000 Subject: [PATCH] d4n/directory: Fix oid for directory blocks Signed-off-by: Samarah --- src/rgw/driver/d4n/rgw_sal_d4n.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rgw/driver/d4n/rgw_sal_d4n.cc b/src/rgw/driver/d4n/rgw_sal_d4n.cc index 39dbd5772d95e..1e297b01e61da 100644 --- a/src/rgw/driver/d4n/rgw_sal_d4n.cc +++ b/src/rgw/driver/d4n/rgw_sal_d4n.cc @@ -764,10 +764,11 @@ int D4NFilterObject::D4NFilterReadOp::D4NFilterGetCB::handle_data(bufferlist& bl } } else if (bl.length() == rgw_get_obj_max_req_size && bl_rem.length() == 0) { // if bl is the same size as rgw_get_obj_max_req_size, write it to cache std::string oid = prefix + "_" + std::to_string(ofs) + "_" + std::to_string(bl_len); - ofs += bl_len; block.blockID = ofs; block.size = bl.length(); block.version = version; + ofs += bl_len; + if (!filter->get_policy_driver()->get_cache_policy()->exist_key(oid)) { auto ret = filter->get_policy_driver()->get_cache_policy()->eviction(dpp, block.size, *y); if (ret == 0) { @@ -811,10 +812,11 @@ int D4NFilterObject::D4NFilterReadOp::D4NFilterGetCB::handle_data(bufferlist& bl if (bl_rem.length() == rgw_get_obj_max_req_size) { std::string oid = prefix + "_" + std::to_string(ofs) + "_" + std::to_string(bl_rem.length()); if (!filter->get_policy_driver()->get_cache_policy()->exist_key(oid)) { - ofs += bl_rem.length(); block.blockID = ofs; block.size = bl_rem.length(); block.version = version; + ofs += bl_rem.length(); + auto ret = filter->get_policy_driver()->get_cache_policy()->eviction(dpp, block.size, *y); if (ret == 0) { ret = filter->get_cache_driver()->put(dpp, oid, bl_rem, bl_rem.length(), attrs, *y); -- 2.39.5