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