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