From 6d437c74e3c8b4305e95fb64f5bcc4d88e507692 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Tue, 19 Sep 2017 18:29:44 +0800 Subject: [PATCH] osd/PrimaryLogPG: kill add_interval_usage Use inline size() member of interval_set instead, which is faster and simpler. Signed-off-by: xie xingguo --- src/osd/PrimaryLogPG.cc | 9 +-------- src/osd/PrimaryLogPG.h | 2 -- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 76ea8ac40076b..f4099c4043ba6 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -7171,7 +7171,7 @@ void PrimaryLogPG::make_writeable(OpContext *ctx) interval_set &newest_overlap = ctx->new_snapset.clone_overlap.rbegin()->second; ctx->modified_ranges.intersection_of(newest_overlap); // modified_ranges is still in use by the clone - add_interval_usage(ctx->modified_ranges, ctx->delta_stats); + ctx->delta_stats.num_bytes += ctx->modified_ranges.size(); newest_overlap.subtract(ctx->modified_ranges); } } @@ -7212,13 +7212,6 @@ void PrimaryLogPG::write_update_size_and_usage(object_stat_sum_t& delta_stats, o delta_stats.num_wr_kb += SHIFT_ROUND_UP(length, 10); } -void PrimaryLogPG::add_interval_usage(interval_set& s, object_stat_sum_t& delta_stats) -{ - for (interval_set::const_iterator p = s.begin(); p != s.end(); ++p) { - delta_stats.num_bytes += p.get_len(); - } -} - void PrimaryLogPG::complete_disconnect_watches( ObjectContextRef obc, const list &to_disconnect) diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 18cfb49a41062..0256548474c9b 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -1106,8 +1106,6 @@ protected: void write_update_size_and_usage(object_stat_sum_t& stats, object_info_t& oi, interval_set& modified, uint64_t offset, uint64_t length, bool write_full=false); - void add_interval_usage(interval_set& s, object_stat_sum_t& st); - enum class cache_result_t { NOOP, -- 2.39.5