yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-block-drivers-expose-requirement-for-write-same-alig.patch.patch.patch

9ae3a8
From 2ae5ce2fe476decb545f16c5af382e5959b2933a Mon Sep 17 00:00:00 2001
9ae3a8
Message-Id: <2ae5ce2fe476decb545f16c5af382e5959b2933a.1389014116.git.minovotn@redhat.com>
9ae3a8
In-Reply-To: <c8cc35838d42aa286242772d97e3a9be7bb786ba.1389014116.git.minovotn@redhat.com>
9ae3a8
References: <c8cc35838d42aa286242772d97e3a9be7bb786ba.1389014116.git.minovotn@redhat.com>
9ae3a8
From: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
Date: Mon, 9 Dec 2013 14:09:19 +0100
9ae3a8
Subject: [PATCH 31/50] block drivers: expose requirement for write same
9ae3a8
 alignment from formats
9ae3a8
9ae3a8
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
Message-id: <1386598178-11845-34-git-send-email-pbonzini@redhat.com>
9ae3a8
Patchwork-id: 56070
9ae3a8
O-Subject: [RHEL 7.0 qemu-kvm PATCH 33/52] block drivers: expose requirement for write same alignment from formats
9ae3a8
Bugzilla: 1007815
9ae3a8
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
9ae3a8
This will let misaligned but large requests use zero clusters.  This
9ae3a8
is important because the cluster size is not guest visible.
9ae3a8
9ae3a8
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
Reviewed-by: Peter Lieven <pl@kamp.de>
9ae3a8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
(cherry picked from commit cffb1ec600de83f693a23578fc2f344c1af9b96f)
9ae3a8
9ae3a8
Conflicts:
9ae3a8
	block/qed.c
9ae3a8
---
9ae3a8
 block/qcow2.c | 1 +
9ae3a8
 block/qed.c   | 1 +
9ae3a8
 block/vmdk.c  | 4 ++++
9ae3a8
 3 files changed, 6 insertions(+)
9ae3a8
9ae3a8
Signed-off-by: Michal Novotny <minovotn@redhat.com>
9ae3a8
---
9ae3a8
 block/qcow2.c | 1 +
9ae3a8
 block/qed.c   | 1 +
9ae3a8
 block/vmdk.c  | 4 ++++
9ae3a8
 3 files changed, 6 insertions(+)
9ae3a8
9ae3a8
diff --git a/block/qcow2.c b/block/qcow2.c
9ae3a8
index bbba11f..bf1f66f 100644
9ae3a8
--- a/block/qcow2.c
9ae3a8
+++ b/block/qcow2.c
9ae3a8
@@ -717,6 +717,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
9ae3a8
     }
9ae3a8
 
9ae3a8
     qemu_opts_del(opts);
9ae3a8
+    bs->bl.write_zeroes_alignment = s->cluster_sectors;
9ae3a8
 
9ae3a8
     if (s->use_lazy_refcounts && s->qcow_version < 3) {
9ae3a8
         error_setg(errp, "Lazy refcounts require a qcow2 image with at least "
9ae3a8
diff --git a/block/qed.c b/block/qed.c
9ae3a8
index c470329..0805ba3 100644
9ae3a8
--- a/block/qed.c
9ae3a8
+++ b/block/qed.c
9ae3a8
@@ -495,6 +495,7 @@ static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags,
9ae3a8
         }
9ae3a8
     }
9ae3a8
 
9ae3a8
+    bs->bl.write_zeroes_alignment = s->header.cluster_size >> BDRV_SECTOR_BITS;
9ae3a8
     s->need_check_timer = qemu_new_timer_ns(vm_clock,
9ae3a8
                                             qed_need_check_timer_cb, s);
9ae3a8
 
9ae3a8
diff --git a/block/vmdk.c b/block/vmdk.c
9ae3a8
index 6d676e4..8662016 100644
9ae3a8
--- a/block/vmdk.c
9ae3a8
+++ b/block/vmdk.c
9ae3a8
@@ -428,6 +428,10 @@ static int vmdk_add_extent(BlockDriverState *bs,
9ae3a8
     extent->l2_size = l2_size;
9ae3a8
     extent->cluster_sectors = flat ? sectors : cluster_sectors;
9ae3a8
 
9ae3a8
+    if (!flat) {
9ae3a8
+        bs->bl.write_zeroes_alignment =
9ae3a8
+            MAX(bs->bl.write_zeroes_alignment, cluster_sectors);
9ae3a8
+    }
9ae3a8
     if (s->num_extents > 1) {
9ae3a8
         extent->end_sector = (*(extent - 1)).end_sector + extent->sectors;
9ae3a8
     } else {
9ae3a8
-- 
9ae3a8
1.7.11.7
9ae3a8