Merge pull request #18616 from xiexingguo/wip-hunt-scrub-mismatch

osd/PrimaryLogPG: more oi.extents fixes

Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Yuri Weinstein 2017-10-31 13:51:31 -07:00 committed by GitHub
commit 85bef1e107
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 29 deletions

View File

@ -7205,17 +7205,21 @@ void PrimaryLogPG::write_update_size_and_usage(object_stat_sum_t& delta_stats, o
}
oi.size = new_size;
}
if (length && oi.has_extents()) {
delta_stats.num_bytes -= oi.extents.size();
if (write_full) {
// oi.size may shrink
oi.extents.clear();
assert(offset == 0);
oi.extents.insert(0, length);
} else {
oi.extents.union_of(ch); // deduplicated
}
delta_stats.num_bytes += oi.extents.size();
if (oi.has_extents()) {
delta_stats.num_bytes -= oi.extents.size();
if (write_full) {
// oi.size may shrink
oi.extents.clear();
assert(offset == 0);
if (length) {
oi.extents.insert(0, length);
}
} else {
if (length) {
oi.extents.union_of(ch); // deduplicated
}
}
delta_stats.num_bytes += oi.extents.size();
}
delta_stats.num_wr++;
delta_stats.num_wr_kb += SHIFT_ROUND_UP(length, 10);
@ -9988,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++;
@ -10006,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

View File

@ -5122,16 +5122,7 @@ ostream& operator<<(ostream& out, const object_info_t& oi)
if (oi.has_manifest())
out << " " << oi.manifest;
if (oi.has_extents()) {
out << " extents [";
for (interval_set<uint64_t>::const_iterator p = oi.extents.begin();
p != oi.extents.end();) {
out << p.get_start() << "~" << p.get_len();
++p;
if (p != oi.extents.end()) {
out << ", ";
}
}
out << "]";
out << " extents " << oi.extents;
}
out << ")";
return out;