From c08904cee904bc91b1b6beb47a5ef4b55d7670c2 Mon Sep 17 00:00:00 2001 From: myoungwon oh Date: Fri, 1 Oct 2021 10:18:49 +0900 Subject: [PATCH] osd: trim corresponding chunks on tier_evict This commit trims chunks on the object even if the size of the chunks is not equal to the object size. Signed-off-by: Myoungwon Oh --- src/osd/PrimaryLogPG.cc | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 6b1a3e52f45..163703574a3 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -7403,20 +7403,14 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector& ops) } // The chunks already has a reference, so it is just enough to invoke truncate if necessary - uint64_t chunk_length = 0; - for (auto p : obs.oi.manifest.chunk_map) { - chunk_length += p.second.length; - } - if (chunk_length == obs.oi.size) { - for (auto &p : obs.oi.manifest.chunk_map) { - p.second.set_flag(chunk_info_t::FLAG_MISSING); - } + for (auto &p : obs.oi.manifest.chunk_map) { + p.second.set_flag(chunk_info_t::FLAG_MISSING); // punch hole - t->zero(soid, 0, oi.size); - oi.clear_data_digest(); - ctx->delta_stats.num_wr++; - ctx->cache_operation = true; + t->zero(soid, p.first, p.second.length); } + oi.clear_data_digest(); + ctx->delta_stats.num_wr++; + ctx->cache_operation = true; osd->logger->inc(l_osd_tier_evict); } -- 2.39.5