]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PrimaryLogPG: add_object_context_to_pg_stat - fix stat 18616/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Thu, 26 Oct 2017 07:54:27 +0000 (15:54 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 30 Oct 2017 13:32:43 +0000 (21:32 +0800)
There might be holes in the extents map, thus it is not always
consistent to calc the clone bytes this way.
Instead we could switch to its own (simpler and consistent) way to
count used bytes for head-object and clone respectively.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/osd/PrimaryLogPG.cc

index d7f37292d86160eb2ed1c7f3a2f5aa478bb011da..d7c5ab3e961b702573a17fadae810ba84aa1b577 100644 (file)
@@ -9992,8 +9992,6 @@ void PrimaryLogPG::add_object_context_to_pg_stat(ObjectContextRef obc, pg_stat_t
   assert(!oi.soid.is_snapdir());
 
   object_stat_sum_t stat;
-  stat.num_bytes += oi.has_extents() ?
-                    oi.extents.size() : oi.size;
   stat.num_objects++;
   if (oi.is_dirty())
     stat.num_objects_dirty++;
@@ -10010,12 +10008,10 @@ void PrimaryLogPG::add_object_context_to_pg_stat(ObjectContextRef obc, pg_stat_t
     if (!obc->ssc)
       obc->ssc = get_snapset_context(oi.soid, false);
     assert(obc->ssc);
-
-    // subtract off clone overlap
-    auto it = obc->ssc->snapset.clone_overlap.find(oi.soid.snap);
-    if (it != obc->ssc->snapset.clone_overlap.end()) {
-      stat.num_bytes -= it->second.size();
-    }
+    stat.num_bytes += obc->ssc->snapset.get_clone_bytes(oi.soid.snap);
+  } else {
+    stat.num_bytes += oi.has_extents() ?
+                      oi.extents.size() : oi.size;
   }
 
   // add it in