From 2323aa17d49ec6b6f125865a6e1344d10658d469 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Thu, 15 Dec 2016 19:07:03 -0800 Subject: [PATCH] ReplicatedPG: don't truncate if we don't have to for WRITEFULL Signed-off-by: Samuel Just --- src/osd/PrimaryLogPG.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 714d535e50a..b2d0a3fc708 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -5312,7 +5312,11 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector& ops) op.flags = op.flags | CEPH_OSD_OP_FLAG_FADVISE_DONTNEED; maybe_create_new_object(ctx); - t->truncate(soid, 0); + if (pool.info.require_rollback()) { + t->truncate(soid, 0); + } else if (obs.exists && op.extent.length < oi.size) { + t->truncate(soid, op.extent.length); + } if (op.extent.length) { t->write(soid, 0, op.extent.length, osd_op.indata, op.flags); } -- 2.39.5