]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: trim corresponding chunks on tier_evict 43379/head
authormyoungwon oh <ohmyoungwon@gmail.com>
Fri, 1 Oct 2021 01:18:49 +0000 (10:18 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Fri, 1 Oct 2021 01:18:49 +0000 (10:18 +0900)
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 <myoungwon.oh@samsung.com>
src/osd/PrimaryLogPG.cc

index 6b1a3e52f45b6b8cd93d7cdd4e52798d328240e5..163703574a3da30080d4b6e432e43f42ebf19fb9 100644 (file)
@@ -7403,20 +7403,14 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& 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);
       }