From: xie xingguo Date: Thu, 26 Oct 2017 07:54:27 +0000 (+0800) Subject: osd/PrimaryLogPG: add_object_context_to_pg_stat - fix stat X-Git-Tag: v13.0.1~349^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F18616%2Fhead;p=ceph.git osd/PrimaryLogPG: add_object_context_to_pg_stat - fix stat 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 --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index d7f37292d861..d7c5ab3e961b 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -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