[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 08/19] block drivers: add discard/write_zeroes pr
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH v3 08/19] block drivers: add discard/write_zeroes properties to bdrv_get_info implementation |
Date: |
Fri, 22 Nov 2013 13:39:50 +0100 |
Signed-off-by: Paolo Bonzini <address@hidden>
---
block/qcow2.c | 2 ++
block/qed.c | 2 ++
block/vdi.c | 1 +
block/vhdx.c | 3 +++
block/vpc.c | 1 +
5 files changed, 9 insertions(+)
diff --git a/block/qcow2.c b/block/qcow2.c
index 2fe37ed..1542750 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1892,6 +1892,8 @@ static coroutine_fn int
qcow2_co_flush_to_os(BlockDriverState *bs)
static int qcow2_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
{
BDRVQcowState *s = bs->opaque;
+ bdi->unallocated_blocks_are_zero = true;
+ bdi->can_write_zeroes_with_unmap = (s->qcow_version >= 3);
bdi->cluster_size = s->cluster_size;
bdi->vm_state_offset = qcow2_vm_state_offset(s);
return 0;
diff --git a/block/qed.c b/block/qed.c
index adc2736..59516a5 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -1475,6 +1475,8 @@ static int bdrv_qed_get_info(BlockDriverState *bs,
BlockDriverInfo *bdi)
memset(bdi, 0, sizeof(*bdi));
bdi->cluster_size = s->header.cluster_size;
bdi->is_dirty = s->header.features & QED_F_NEED_CHECK;
+ bdi->unallocated_blocks_are_zero = true;
+ bdi->can_write_zeroes_with_unmap = true;
return 0;
}
diff --git a/block/vdi.c b/block/vdi.c
index b6ec002..2d7490f 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -331,6 +331,7 @@ static int vdi_get_info(BlockDriverState *bs,
BlockDriverInfo *bdi)
logout("\n");
bdi->cluster_size = s->block_size;
bdi->vm_state_offset = 0;
+ bdi->unallocated_blocks_are_zero = true;
return 0;
}
diff --git a/block/vhdx.c b/block/vhdx.c
index ed6fa53..67bbe10 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -1049,6 +1049,9 @@ static int vhdx_get_info(BlockDriverState *bs,
BlockDriverInfo *bdi)
bdi->cluster_size = s->block_size;
+ bdi->unallocated_blocks_are_zero =
+ (s->params.data_bits & VHDX_PARAMS_HAS_PARENT) == 0;
+
return 0;
}
diff --git a/block/vpc.c b/block/vpc.c
index 551876f..1d326cb 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -464,6 +464,7 @@ static int vpc_get_info(BlockDriverState *bs,
BlockDriverInfo *bdi)
bdi->cluster_size = s->block_size;
}
+ bdi->unallocated_blocks_are_zero = true;
return 0;
}
--
1.8.4.2
- Re: [Qemu-devel] [PATCH v3 03/19] block: add flags argument to bdrv_co_write_zeroes tracepoint, (continued)
- [Qemu-devel] [PATCH v3 04/19] block: add bdrv_aio_write_zeroes, Paolo Bonzini, 2013/11/22
- [Qemu-devel] [PATCH v3 05/19] block: handle ENOTSUP from discard in generic code, Paolo Bonzini, 2013/11/22
- [Qemu-devel] [PATCH v3 07/19] vpc, vhdx: add get_info, Paolo Bonzini, 2013/11/22
- [Qemu-devel] [PATCH v3 09/19] block drivers: expose requirement for write same alignment from formats, Paolo Bonzini, 2013/11/22
- [Qemu-devel] [PATCH v3 08/19] block drivers: add discard/write_zeroes properties to bdrv_get_info implementation,
Paolo Bonzini <=
- [Qemu-devel] [PATCH v3 10/19] block/iscsi: remove .bdrv_has_zero_init, Paolo Bonzini, 2013/11/22
- [Qemu-devel] [PATCH v3 06/19] block: make bdrv_co_do_write_zeroes stricter in producing aligned requests, Paolo Bonzini, 2013/11/22
- [Qemu-devel] [PATCH v3 11/19] block/iscsi: updated copyright, Paolo Bonzini, 2013/11/22
- [Qemu-devel] [PATCH v3 12/19] block/iscsi: check WRITE SAME support differently depending on MAY_UNMAP, Paolo Bonzini, 2013/11/22
- [Qemu-devel] [PATCH v3 13/19] raw-posix: implement write_zeroes with MAY_UNMAP for files, Paolo Bonzini, 2013/11/22
- [Qemu-devel] [PATCH v3 14/19] raw-posix: implement write_zeroes with MAY_UNMAP for block devices, Paolo Bonzini, 2013/11/22