]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: remove unnecesssary if{}, and make simple using
authormyoungwon oh <ohmyoungwon@gmail.com>
Sat, 7 Nov 2020 00:57:51 +0000 (09:57 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Sat, 7 Nov 2020 01:45:28 +0000 (10:45 +0900)
calc_refs_to_inc_on_set()

Signed-off-by: Myoungwon Oh <myoungwon.oh@samsumg.com>
src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h

index 50af9f3c79aec0576f81a0e57f8ca3055af1dba3..2653888afaf55f80789d43fcdb285de8b94c8799 100644 (file)
@@ -3272,10 +3272,11 @@ void PrimaryLogPG::dec_refcount(const hobject_t& soid, const object_ref_delta_t&
 }
 
 
-void PrimaryLogPG::get_adjacent_clones(const object_info_t& oi, OpContext* ctx
+void PrimaryLogPG::get_adjacent_clones(ObjectContextRef src_obc
                                       ObjectContextRef& _l, ObjectContextRef& _g) 
 {
-  const SnapSet& snapset = ctx->obc->ssc->snapset;
+  const SnapSet& snapset = src_obc->ssc->snapset;
+  const object_info_t& oi = src_obc->obs.oi;
 
   auto get_context = [this, &oi, &snapset](auto iter)
     -> ObjectContextRef {
@@ -3307,7 +3308,7 @@ bool PrimaryLogPG::inc_refcount_by_set(OpContext* ctx, object_manifest_t& set_ch
 {
   object_ref_delta_t refs;
   ObjectContextRef obc_l, obc_g;
-  get_adjacent_clones(ctx->obs->oi, ctx, obc_l, obc_g);
+  get_adjacent_clones(ctx->obc, obc_l, obc_g);
   set_chunk.calc_refs_to_inc_on_set(
     obc_l ? &(obc_l->obs.oi.manifest) : nullptr,
     obc_g ? &(obc_g->obs.oi.manifest) : nullptr,
@@ -3379,7 +3380,7 @@ void PrimaryLogPG::dec_all_refcount_manifest(const object_info_t& oi, OpContext*
   if (oi.manifest.is_chunked()) {
     object_ref_delta_t refs;
     ObjectContextRef obc_l, obc_g;
-    get_adjacent_clones(oi, ctx, obc_l, obc_g);
+    get_adjacent_clones(ctx->obc, obc_l, obc_g);
     oi.manifest.calc_refs_to_drop_on_removal(
       obc_l ? &(obc_l->obs.oi.manifest) : nullptr,
       obc_g ? &(obc_g->obs.oi.manifest) : nullptr,
@@ -10053,22 +10054,19 @@ int PrimaryLogPG::start_dedup(OpRequestRef op, ObjectContextRef obc)
       // all operations are finished
       mop->new_chunk_map[p.first] = chunk_info;
       // skip if the same content exits in prev snap at same offset
-      if (obc->ssc->snapset.clones.size()) {
-       ObjectContextRef cobc = get_prev_clone_obc(obc);
-       if (cobc) {
-         object_ref_delta_t refs;
-         object_manifest_t set_chunk;
-         set_chunk.chunk_map[p.first] = chunk_info;
-         set_chunk.calc_refs_to_inc_on_set(
-           &cobc->obs.oi.manifest,
-           nullptr,
-           refs);
-         if (refs.is_empty()) {
-           dout(15) << " found same chunk " << refs << dendl;
-           continue;
-         } 
-       }
-      }
+      object_ref_delta_t refs;
+      ObjectContextRef obc_l, obc_g;
+      object_manifest_t set_chunk;
+      set_chunk.chunk_map[p.first] = chunk_info;
+      get_adjacent_clones(obc, obc_l, obc_g);
+      set_chunk.calc_refs_to_inc_on_set(
+       obc_l ? &(obc_l->obs.oi.manifest) : nullptr,
+       obc_g ? &(obc_g->obs.oi.manifest) : nullptr,
+       refs);
+      if (refs.is_empty()) {
+       dout(15) << " found same chunk " << refs << dendl;
+       continue;
+      } 
        
       // make a create_or_get_ref op
       bufferlist t;
@@ -10260,7 +10258,7 @@ void PrimaryLogPG::finish_set_dedup(hobject_t oid, int r, ceph_tid_t tid, uint64
     // CDC was done on entire range of manifest object,
     // so the first thing we should do here is to drop the reference to old chunks
     ObjectContextRef obc_l, obc_g;
-    get_adjacent_clones(ctx->obs->oi, ctx.get(), obc_l, obc_g);
+    get_adjacent_clones(obc, obc_l, obc_g);
     // clear all old references
     ctx->obs->oi.manifest.calc_refs_to_drop_on_removal(
       obc_l ? &(obc_l->obs.oi.manifest) : nullptr,
index 1054617eb40f5123a07841d127e57243d55743dc..956474a96672027e6285ed19aef8770761734586 100644 (file)
@@ -1507,7 +1507,7 @@ protected:
   void dec_refcount(const hobject_t& soid, const object_ref_delta_t& refs);
   void dec_refcount_by_dirty(OpContext* ctx);
   ObjectContextRef get_prev_clone_obc(ObjectContextRef obc);
-  void get_adjacent_clones(const object_info_t& oi, OpContext* ctx
+  void get_adjacent_clones(ObjectContextRef src_obc
                           ObjectContextRef& _l, ObjectContextRef& _g);
   bool inc_refcount_by_set(OpContext* ctx, object_manifest_t& tgt,
                           OSDOp& osd_op);