]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: clear <off, chunk_info> if the chunk is dedup chunk
authormyoungwon oh <ohmyoungwon@gmail.com>
Sun, 9 Aug 2020 11:27:14 +0000 (20:27 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Tue, 18 Aug 2020 16:38:43 +0000 (01:38 +0900)
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsumg.com>
src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h

index d5adac22051b32422d52acee340db8d7b2a6935b..90f04258ac7f31ae48c28b9f0180a9c7b17eb445 100644 (file)
@@ -2344,7 +2344,7 @@ void PrimaryLogPG::do_op(OpRequestRef& op)
   maybe_force_recovery();
 }
 
-bool PrimaryLogPG::is_dedup_chunk(const object_info_t& oi, const chunk_info_t& chunk)
+bool PrimaryLogPG::is_dedup_chunk(const chunk_info_t& chunk)
 {
   if (pg_pool_t::fingerprint_t fp_algo = pool.info.get_fingerprint_type();
       chunk.has_reference() &&
@@ -2574,7 +2574,7 @@ int PrimaryLogPG::do_manifest_flush(OpRequestRef op, ObjectContextRef obc, Flush
      *
      */
 
-    if (is_dedup_chunk(obc->obs.oi, iter->second)) {
+    if (is_dedup_chunk(iter->second)) {
       pg_pool_t::fingerprint_t fp_algo = pool.info.get_fingerprint_type();
       object_t fp_oid = [&fp_algo, &chunk_data]() -> string {
         switch (fp_algo) {
@@ -3493,12 +3493,14 @@ void PrimaryLogPG::dec_refcount_by_dirty(OpContext* ctx)
   ObjectContextRef cobc = nullptr;
   ObjectContextRef obc = ctx->obc;
   for (auto &p : ctx->obs->oi.manifest.chunk_map) {
-    if (!ctx->clean_regions.is_clean_region(p.first, p.second.length)) {
-      ctx->new_obs.oi.manifest.chunk_map.erase(p.first);
-      if (ctx->new_obs.oi.manifest.chunk_map.empty()) {
-       ctx->new_obs.oi.manifest.type = object_manifest_t::TYPE_NONE;
-       ctx->new_obs.oi.clear_flag(object_info_t::FLAG_MANIFEST);
-       ctx->delta_stats.num_objects_manifest--;
+    if (is_dedup_chunk(p.second)) {
+      if (!ctx->clean_regions.is_clean_region(p.first, p.second.length)) {
+       ctx->new_obs.oi.manifest.chunk_map.erase(p.first);
+       if (ctx->new_obs.oi.manifest.chunk_map.empty()) {
+         ctx->new_obs.oi.manifest.type = object_manifest_t::TYPE_NONE;
+         ctx->new_obs.oi.clear_flag(object_info_t::FLAG_MANIFEST);
+         ctx->delta_stats.num_objects_manifest--;
+       }
       }
     }
   }
index 87eec7163028671b83b2ad318c47765bcd51889a..68a5fb8c9e516ed207380d1596c5531529d5bb30 100644 (file)
@@ -1504,7 +1504,7 @@ protected:
   void dec_all_refcount_manifest(const object_info_t& oi, OpContext* ctx);
   void dec_refcount(const hobject_t& soid, const object_ref_delta_t& refs);
   void dec_refcount_by_dirty(OpContext* ctx);
-  bool is_dedup_chunk(const object_info_t& oi, const chunk_info_t& chunk);
+  bool is_dedup_chunk(const chunk_info_t& chunk);
   ObjectContextRef get_prev_clone_obc(ObjectContextRef obc);
 
   friend struct C_ProxyChunkRead;