osd/PrimayLogPG: update modified range to include the whole object size for write_full op

Signed-off-by: runsisi <runsisi@zte.com.cn>
This commit is contained in:
runsisi 2017-05-11 21:52:49 +08:00
parent bb6d2de31a
commit 1fdc92716e
2 changed files with 8 additions and 6 deletions

View File

@ -5491,7 +5491,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& 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<uint64_t>& modified, uint64_t offset,
uint64_t length, bool force_changesize)
uint64_t length, bool write_full)
{
interval_set<uint64_t> 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;

View File

@ -1099,8 +1099,7 @@ protected:
void write_update_size_and_usage(object_stat_sum_t& stats, object_info_t& oi,
interval_set<uint64_t>& modified, uint64_t offset,
uint64_t length,
bool force_changesize=false);
uint64_t length, bool write_full=false);
void add_interval_usage(interval_set<uint64_t>& s, object_stat_sum_t& st);