From: xie xingguo Date: Sat, 23 Sep 2017 02:54:18 +0000 (+0800) Subject: osd/PrimaryLogPG: calc clone_overlap size in a more efficient and concise way X-Git-Tag: v13.0.1~801^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F17928%2Fhead;p=ceph.git osd/PrimaryLogPG: calc clone_overlap size in a more efficient and concise way Signed-off-by: xie xingguo --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index efdd53e017db..cecd6a657865 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -9824,13 +9824,9 @@ void PrimaryLogPG::add_object_context_to_pg_stat(ObjectContextRef obc, pg_stat_t assert(obc->ssc); // subtract off clone overlap - if (obc->ssc->snapset.clone_overlap.count(oi.soid.snap)) { - interval_set& o = obc->ssc->snapset.clone_overlap[oi.soid.snap]; - for (interval_set::const_iterator r = o.begin(); - r != o.end(); - ++r) { - stat.num_bytes -= r.get_len(); - } + 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(); } }