yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-block-drivers-add-discard-write_zeroes-properties-to.patch.patch.patch

0a122b
From d10c277da89a9a2d288560fc6ccdc455b3d39090 Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <d10c277da89a9a2d288560fc6ccdc455b3d39090.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:18 +0100
0a122b
Subject: [PATCH 30/50] block drivers: add discard/write_zeroes properties to
0a122b
 bdrv_get_info implementation
0a122b
0a122b
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
0a122b
Message-id: <1386598178-11845-33-git-send-email-pbonzini@redhat.com>
0a122b
Patchwork-id: 56069
0a122b
O-Subject: [RHEL 7.0 qemu-kvm PATCH 32/52] block drivers: add discard/write_zeroes properties to bdrv_get_info implementation
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
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 95de6d7078b029b73708059a17cef20f332adcb7)
0a122b
---
0a122b
 block/qcow2.c | 2 ++
0a122b
 block/qed.c   | 2 ++
0a122b
 block/vdi.c   | 1 +
0a122b
 block/vhdx.c  | 3 +++
0a122b
 block/vpc.c   | 1 +
0a122b
 5 files changed, 9 insertions(+)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 block/qcow2.c | 2 ++
0a122b
 block/qed.c   | 2 ++
0a122b
 block/vdi.c   | 1 +
0a122b
 block/vhdx.c  | 3 +++
0a122b
 block/vpc.c   | 1 +
0a122b
 5 files changed, 9 insertions(+)
0a122b
0a122b
diff --git a/block/qcow2.c b/block/qcow2.c
0a122b
index c109646..bbba11f 100644
0a122b
--- a/block/qcow2.c
0a122b
+++ b/block/qcow2.c
0a122b
@@ -1886,6 +1886,8 @@ static int64_t qcow2_vm_state_offset(BDRVQcowState *s)
0a122b
 static int qcow2_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
0a122b
 {
0a122b
     BDRVQcowState *s = bs->opaque;
0a122b
+    bdi->unallocated_blocks_are_zero = true;
0a122b
+    bdi->can_write_zeroes_with_unmap = (s->qcow_version >= 3);
0a122b
     bdi->cluster_size = s->cluster_size;
0a122b
     bdi->vm_state_offset = qcow2_vm_state_offset(s);
0a122b
     return 0;
0a122b
diff --git a/block/qed.c b/block/qed.c
0a122b
index e163372..c470329 100644
0a122b
--- a/block/qed.c
0a122b
+++ b/block/qed.c
0a122b
@@ -1475,6 +1475,8 @@ static int bdrv_qed_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
0a122b
     memset(bdi, 0, sizeof(*bdi));
0a122b
     bdi->cluster_size = s->header.cluster_size;
0a122b
     bdi->is_dirty = s->header.features & QED_F_NEED_CHECK;
0a122b
+    bdi->unallocated_blocks_are_zero = true;
0a122b
+    bdi->can_write_zeroes_with_unmap = true;
0a122b
     return 0;
0a122b
 }
0a122b
 
0a122b
diff --git a/block/vdi.c b/block/vdi.c
0a122b
index dcbc27c..f973883 100644
0a122b
--- a/block/vdi.c
0a122b
+++ b/block/vdi.c
0a122b
@@ -331,6 +331,7 @@ static int vdi_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
0a122b
     logout("\n");
0a122b
     bdi->cluster_size = s->block_size;
0a122b
     bdi->vm_state_offset = 0;
0a122b
+    bdi->unallocated_blocks_are_zero = true;
0a122b
     return 0;
0a122b
 }
0a122b
 
0a122b
diff --git a/block/vhdx.c b/block/vhdx.c
0a122b
index 7285b95..41c3065 100644
0a122b
--- a/block/vhdx.c
0a122b
+++ b/block/vhdx.c
0a122b
@@ -884,6 +884,9 @@ static int vhdx_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
0a122b
 
0a122b
     bdi->cluster_size = s->block_size;
0a122b
 
0a122b
+    bdi->unallocated_blocks_are_zero =
0a122b
+        (s->params.data_bits & VHDX_PARAMS_HAS_PARENT) == 0;
0a122b
+
0a122b
     return 0;
0a122b
 }
0a122b
 
0a122b
diff --git a/block/vpc.c b/block/vpc.c
0a122b
index 49520c1..059069f 100644
0a122b
--- a/block/vpc.c
0a122b
+++ b/block/vpc.c
0a122b
@@ -448,6 +448,7 @@ static int vpc_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
0a122b
         bdi->cluster_size = s->block_size;
0a122b
     }
0a122b
 
0a122b
+    bdi->unallocated_blocks_are_zero = true;
0a122b
     return 0;
0a122b
 }
0a122b
 
0a122b
-- 
0a122b
1.7.11.7
0a122b