[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v7 11/19] block: vhdx write support
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH v7 11/19] block: vhdx write support |
Date: |
Fri, 18 Oct 2013 14:01:03 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Fri, Oct 11, 2013 at 02:17:31PM -0400, Jeff Cody wrote:
> + /* check the payload block state */
> + switch (s->bat[sinfo.bat_idx] & VHDX_BAT_STATE_BIT_MASK) {
> + case PAYLOAD_BLOCK_ZERO:
> + /* in this case, we need to preserve zero writes for
> + * data that is not part of this write, so we must pad
> + * the rest of the buffer to zeroes */
> +
> + /* if we are on a posix system with ftruncate() that extends
> + * a file, then it is zero-filled for us. On Win32, the raw
> + * layer uses SetFilePointer and SetFileEnd, which does not
> + * zero fill AFAIK */
> +
> + /* Queue another write of zero buffers if the underlying file
> + * does not zero-fill on file extension */
> +
> + if (bdrv_has_zero_init(bs->file) == 0) {
Maybe this should be done differently once Peter Lieven's thin
provisioning patches are merged. I think bdrv_has_zero_init() only
tells you whether the file is zeroed after creation. It doesn't
guarantee zeroes for other operations like growing the file.
I'm not 100% sure right now, will follow-up on this point later when
I've reviewed Peter's series and thought more about it.
> diff --git a/block/vhdx.h b/block/vhdx.h
> index 6abbf50..f331548 100644
> --- a/block/vhdx.h
> +++ b/block/vhdx.h
> @@ -217,7 +217,7 @@ typedef struct QEMU_PACKED VHDXLogDataSector {
> #define PAYLOAD_BLOCK_UNDEFINED 1
> #define PAYLOAD_BLOCK_ZERO 2
> #define PAYLOAD_BLOCK_UNMAPPED 5
> -#define PAYLOAD_BLOCK_FULL_PRESENT 6
> +#define PAYLOAD_BLOCK_FULLY_PRESENT 6
> #define PAYLOAD_BLOCK_PARTIALLY_PRESENT 7
This change should be in a separate patch.
- [Qemu-devel] [PATCH v7 03/19] block: vhdx code movement - VHDXMetadataEntries and BDRVVHDXState to header., (continued)
- [Qemu-devel] [PATCH v7 03/19] block: vhdx code movement - VHDXMetadataEntries and BDRVVHDXState to header., Jeff Cody, 2013/10/11
- [Qemu-devel] [PATCH v7 04/19] block: vhdx - log support struct and defines, Jeff Cody, 2013/10/11
- [Qemu-devel] [PATCH v7 05/19] block: vhdx - break endian translation functions out, Jeff Cody, 2013/10/11
- [Qemu-devel] [PATCH v7 07/19] block: vhdx code movement - move vhdx_close() above vhdx_open(), Jeff Cody, 2013/10/11
- [Qemu-devel] [PATCH v7 06/19] block: vhdx - update log guid in header, and first write tracker, Jeff Cody, 2013/10/11
- [Qemu-devel] [PATCH v7 08/19] block: vhdx - log parsing, replay, and flush support, Jeff Cody, 2013/10/11
- [Qemu-devel] [PATCH v7 09/19] block: vhdx - add region overlap detection for image files, Jeff Cody, 2013/10/11
- [Qemu-devel] [PATCH v7 10/19] block: vhdx - add log write support, Jeff Cody, 2013/10/11
- [Qemu-devel] [PATCH v7 11/19] block: vhdx write support, Jeff Cody, 2013/10/11
- [Qemu-devel] [PATCH v7 12/19] block: vhdx - remove BAT file offset bit shifting, Jeff Cody, 2013/10/11
- [Qemu-devel] [PATCH v7 13/19] block: vhdx - move more endian translations to vhdx-endian.c, Jeff Cody, 2013/10/11
- [Qemu-devel] [PATCH v7 14/19] block: vhdx - break out code operations to functions, Jeff Cody, 2013/10/11
- [Qemu-devel] [PATCH v7 15/19] block: vhdx - fix comment typos in header, fix incorrect struct fields, Jeff Cody, 2013/10/11
- [Qemu-devel] [PATCH v7 16/19] block: vhdx - add .bdrv_create() support, Jeff Cody, 2013/10/11
- [Qemu-devel] [PATCH v7 17/19] block: vhdx - update _make_test_img() to filter out vhdx options, Jeff Cody, 2013/10/11
- [Qemu-devel] [PATCH v7 18/19] block: qemu-iotests for vhdx, add write test support, Jeff Cody, 2013/10/11