From 1fdc92716e2f5611a050ba0cf9bba99e78a26b9c Mon Sep 17 00:00:00 2001 From: runsisi Date: Thu, 11 May 2017 21:52:49 +0800 Subject: [PATCH] osd/PrimayLogPG: update modified range to include the whole object size for write_full op Signed-off-by: runsisi --- src/osd/PrimaryLogPG.cc | 11 +++++++---- src/osd/PrimaryLogPG.h | 3 +-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index b9fdd61c4f6..53389ebc9ed 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -5491,7 +5491,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector& ops) obs.oi.set_data_digest(osd_op.indata.crc32c(-1)); write_update_size_and_usage(ctx->delta_stats, oi, ctx->modified_ranges, - 0, op.extent.length, op.extent.length != oi.size ? true : false); + 0, op.extent.length, true); } break; @@ -6753,13 +6753,16 @@ void PrimaryLogPG::make_writeable(OpContext *ctx) void PrimaryLogPG::write_update_size_and_usage(object_stat_sum_t& delta_stats, object_info_t& oi, interval_set& modified, uint64_t offset, - uint64_t length, bool force_changesize) + uint64_t length, bool write_full) { interval_set ch; - if (length) + if (write_full) { + if (oi.size) + ch.insert(0, oi.size); + } else if (length) ch.insert(offset, length); modified.union_of(ch); - if (force_changesize || offset + length > oi.size) { + if (write_full || offset + length > oi.size) { uint64_t new_size = offset + length; delta_stats.num_bytes -= oi.size; delta_stats.num_bytes += new_size; diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 3ea4a80fe34..768ec934ea1 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -1099,8 +1099,7 @@ 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 force_changesize=false); + uint64_t length, bool write_full=false); void add_interval_usage(interval_set& s, object_stat_sum_t& st);