]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ReplicatedPG: don't truncate if we don't have to for WRITEFULL
authorSamuel Just <sjust@redhat.com>
Fri, 16 Dec 2016 03:07:03 +0000 (19:07 -0800)
committerSage Weil <sage@redhat.com>
Fri, 16 Dec 2016 17:40:34 +0000 (12:40 -0500)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/PrimaryLogPG.cc

index 714d535e50a0125203138145ee930ad7263c7eb4..b2d0a3fc708f75fff67a7990f85e78b63cac0d17 100644 (file)
@@ -5312,7 +5312,11 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& 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);
        }