thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From 7bae8147abc5661103da3316f09306939ec03708 Mon Sep 17 00:00:00 2001
9ae3a8
From: Fam Zheng <famz@redhat.com>
9ae3a8
Date: Thu, 5 Sep 2013 08:45:39 +0200
9ae3a8
Subject: [PATCH 11/29] vmdk: fix comment for vmdk_co_write_zeroes
9ae3a8
9ae3a8
RH-Author: Fam Zheng <famz@redhat.com>
9ae3a8
Message-id: <1378370739-22259-1-git-send-email-famz@redhat.com>
9ae3a8
Patchwork-id: 54100
9ae3a8
O-Subject: [RHEL-7 qemu-kvm PATCH] vmdk: fix comment for vmdk_co_write_zeroes
9ae3a8
Bugzilla: 995866
9ae3a8
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Max Reitz <mreitz@redhat.com>
9ae3a8
9ae3a8
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=995866
9ae3a8
Brew:     http://brewweb.devel.redhat.com/brew/taskinfo?taskID=6246791
9ae3a8
Upstream: merged
9ae3a8
9ae3a8
The comment was truncated. Add the missing parts, especially explain why
9ae3a8
we need zero_dry_run.
9ae3a8
9ae3a8
Signed-off-by: Fam Zheng <famz@redhat.com>
9ae3a8
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9ae3a8
(cherry picked from commit 8e50724313895a87057cc243ad805f2eb21feb9f)
9ae3a8
Signed-off-by: Fam Zheng <famz@redhat.com>
9ae3a8
---
9ae3a8
 block/vmdk.c | 8 ++++++--
9ae3a8
 1 file changed, 6 insertions(+), 2 deletions(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 block/vmdk.c |    8 ++++++--
9ae3a8
 1 files changed, 6 insertions(+), 2 deletions(-)
9ae3a8
9ae3a8
diff --git a/block/vmdk.c b/block/vmdk.c
9ae3a8
index a28fb5e..f0c1f93 100644
9ae3a8
--- a/block/vmdk.c
9ae3a8
+++ b/block/vmdk.c
9ae3a8
@@ -1200,8 +1200,10 @@ static coroutine_fn int vmdk_co_read(BlockDriverState *bs, int64_t sector_num,
9ae3a8
 /**
9ae3a8
  * vmdk_write:
9ae3a8
  * @zeroed:       buf is ignored (data is zero), use zeroed_grain GTE feature
9ae3a8
- * if possible, otherwise return -ENOTSUP.
9ae3a8
- * @zero_dry_run: used for zeroed == true only, don't update L2 table, just
9ae3a8
+ *                if possible, otherwise return -ENOTSUP.
9ae3a8
+ * @zero_dry_run: used for zeroed == true only, don't update L2 table, just try
9ae3a8
+ *                with each cluster. By dry run we can find if the zero write
9ae3a8
+ *                is possible without modifying image data.
9ae3a8
  *
9ae3a8
  * Returns: error code with 0 for success.
9ae3a8
  */
9ae3a8
@@ -1328,6 +1330,8 @@ static int coroutine_fn vmdk_co_write_zeroes(BlockDriverState *bs,
9ae3a8
     int ret;
9ae3a8
     BDRVVmdkState *s = bs->opaque;
9ae3a8
     qemu_co_mutex_lock(&s->lock);
9ae3a8
+    /* write zeroes could fail if sectors not aligned to cluster, test it with
9ae3a8
+     * dry_run == true before really updating image */
9ae3a8
     ret = vmdk_write(bs, sector_num, NULL, nb_sectors, true, true);
9ae3a8
     if (!ret) {
9ae3a8
         ret = vmdk_write(bs, sector_num, NULL, nb_sectors, true, false);
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8