Skip to content

Commit

Permalink
osd/PrimaryLogPG: add_object_context_to_pg_stat - fix stat
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
xiexingguo committed Oct 30, 2017
1 parent 83594df commit 8c630a0
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/osd/PrimaryLogPG.cc
Expand Up @@ -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++;
Expand All @@ -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
Expand Down

0 comments on commit 8c630a0

Please sign in to comment.