qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 09/19] block drivers: expose requirement for


From: Peter Lieven
Subject: Re: [Qemu-devel] [PATCH v3 09/19] block drivers: expose requirement for write same alignment from formats
Date: Mon, 25 Nov 2013 11:33:19 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1

On 22.11.2013 13:39, Paolo Bonzini wrote:
This will let misaligned but large requests use zero clusters.  This
is important because the cluster size is not guest visible.

Signed-off-by: Paolo Bonzini <address@hidden>
---
  block/qcow2.c | 1 +
  block/qed.c   | 1 +
  block/vmdk.c  | 4 ++++
  3 files changed, 6 insertions(+)

diff --git a/block/qcow2.c b/block/qcow2.c
index 1542750..81c4dad 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -718,6 +718,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, 
int flags,
      }
qemu_opts_del(opts);
+    bs->bl.write_zeroes_alignment = s->cluster_sectors;
please add a patch that sets

bs->bl.discard_alignment = s->cluster_sectors;

if (s->use_lazy_refcounts && s->qcow_version < 3) {
          error_setg(errp, "Lazy refcounts require a qcow2 image with at least "
diff --git a/block/qed.c b/block/qed.c
index 59516a5..450a1fa 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -495,6 +495,7 @@ static int bdrv_qed_open(BlockDriverState *bs, QDict 
*options, int flags,
          }
      }
+ bs->bl.write_zeroes_alignment = s->header.cluster_size >> BDRV_SECTOR_BITS;
      s->need_check_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
                                              qed_need_check_timer_cb, s);
diff --git a/block/vmdk.c b/block/vmdk.c
index 6555663..63ea7ff 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -428,6 +428,10 @@ static int vmdk_add_extent(BlockDriverState *bs,
      extent->l2_size = l2_size;
      extent->cluster_sectors = flat ? sectors : cluster_sectors;
+ if (!flat) {
+        bs->bl.write_zeroes_alignment =
+            MAX(bs->bl.write_zeroes_alignment, cluster_sectors);
+    }
      if (s->num_extents > 1) {
          extent->end_sector = (*(extent - 1)).end_sector + extent->sectors;
      } else {


Reviewed-by: Peter Lieven <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]