yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-qemu-img-Convert-by-cluster-size-if-target-is-compre.patch

958e1b
From 871111d1bf38bc391728793f898527823717ed6d Mon Sep 17 00:00:00 2001
958e1b
Message-Id: <871111d1bf38bc391728793f898527823717ed6d.1418766606.git.jen@redhat.com>
958e1b
In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com>
958e1b
References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com>
958e1b
From: Fam Zheng <famz@redhat.com>
958e1b
Date: Thu, 4 Dec 2014 00:05:12 -0600
958e1b
Subject: [CHANGE 18/31] qemu-img: Convert by cluster size if target is
958e1b
 compressed
958e1b
To: rhvirt-patches@redhat.com,
958e1b
    jen@redhat.com
958e1b
958e1b
RH-Author: Fam Zheng <famz@redhat.com>
958e1b
Message-id: <1417651524-18041-19-git-send-email-famz@redhat.com>
958e1b
Patchwork-id: 62691
958e1b
O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 18/30] qemu-img: Convert by cluster size if target is compressed
958e1b
Bugzilla: 1134283
958e1b
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
958e1b
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
958e1b
RH-Acked-by: Max Reitz <mreitz@redhat.com>
958e1b
958e1b
If target block driver forces compression, qemu-img convert needs to
958e1b
write by cluster size as well as "-c" option.
958e1b
958e1b
Particularly, this applies for converting to VMDK streamOptimized
958e1b
format.
958e1b
958e1b
Signed-off-by: Fam Zheng <famz@redhat.com>
958e1b
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
958e1b
(cherry picked from commit 85f49cad879adfb5c3cbdc47ca3c3b50eb8f40bc)
958e1b
Signed-off-by: Fam Zheng <famz@redhat.com>
958e1b
Signed-off-by: Jeff E. Nelson <jen@redhat.com>
958e1b
---
958e1b
 include/block/block.h | 4 ++++
958e1b
 qemu-img.c            | 1 +
958e1b
 2 files changed, 5 insertions(+)
958e1b
958e1b
diff --git a/include/block/block.h b/include/block/block.h
958e1b
index 3651bd9..b06a9dc 100644
958e1b
--- a/include/block/block.h
958e1b
+++ b/include/block/block.h
958e1b
@@ -34,6 +34,10 @@ typedef struct BlockDriverInfo {
958e1b
      * opened with BDRV_O_UNMAP flag for this to work.
958e1b
      */
958e1b
     bool can_write_zeroes_with_unmap;
958e1b
+    /*
958e1b
+     * True if this block driver only supports compressed writes
958e1b
+     */
958e1b
+    bool needs_compressed_writes;
958e1b
 } BlockDriverInfo;
958e1b
 
958e1b
 typedef struct BlockFragInfo {
958e1b
diff --git a/qemu-img.c b/qemu-img.c
958e1b
index f14890f..9c021e7 100644
958e1b
--- a/qemu-img.c
958e1b
+++ b/qemu-img.c
958e1b
@@ -1477,6 +1477,7 @@ static int img_convert(int argc, char **argv)
958e1b
             goto out;
958e1b
         }
958e1b
     } else {
958e1b
+        compress = compress || bdi.needs_compressed_writes;
958e1b
         cluster_sectors = bdi.cluster_size / BDRV_SECTOR_SIZE;
958e1b
     }
958e1b
 
958e1b
-- 
958e1b
2.1.0
958e1b