[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 9/9] block: vhdx write support
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [PATCH 9/9] block: vhdx write support |
Date: |
Tue, 30 Jul 2013 12:10:14 +0800 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Wed, 07/24 13:54, Jeff Cody wrote:
> This adds support for writing to VHDX image files, using coroutines.
> Writes into the BAT table goes through the VHDX log. Currently, BAT
> table writes occur when expanding a dynamic VHDX file, and allocating a
> new BAT entry.
>
> Signed-off-by: Jeff Cody <address@hidden>
> ---
> block/vhdx.c | 149
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 147 insertions(+), 2 deletions(-)
>
> diff --git a/block/vhdx.c b/block/vhdx.c
> index a8dd6d7..791c6dc 100644
> --- a/block/vhdx.c
> +++ b/block/vhdx.c
> @@ -831,7 +831,7 @@ static int vhdx_open(BlockDriverState *bs, QDict
> *options, int flags)
> vhdx_update_headers(bs, s, false, NULL);
> }
>
> - /* TODO: differencing files, write */
> + /* TODO: differencing files */
>
> return 0;
> fail:
> @@ -963,7 +963,45 @@ exit:
> return ret;
> }
>
> +/*
> + * Allocate a new payload block at the end of the file.
> + *
> + * Allocation will happen at 1MB alignment inside the file
> + *
> + * Returns the file offset start of the new payload block
> + */
> +static int vhdx_allocate_block(BlockDriverState *bs, BDRVVHDXState *s,
> + uint64_t *new_offset)
> +{
> + *new_offset = bdrv_getlength(bs->file);
>
> + /* per the spec, the address for a block is in units of 1MB */
> + if (*new_offset % (1024*1024)) {
> + *new_offset = ((*new_offset >> 20) + 1) << 20; /* round up to 1MB */
You can use ROUND_UP() macro here:
*new_offset = ROUND_UP(*new_offset, 1 << 20);
Fam
- Re: [Qemu-devel] [PATCH 2/9] block: vhdx - add header update capability., (continued)
- [Qemu-devel] [PATCH 4/9] block: vhdx - log support struct and defines, Jeff Cody, 2013/07/24
- [Qemu-devel] [PATCH 5/9] block: vhdx - break endian translation functions out, Jeff Cody, 2013/07/24
- [Qemu-devel] [PATCH 6/9] block: vhdx - update log guid in header, and first write tracker, Jeff Cody, 2013/07/24
- [Qemu-devel] [PATCH 7/9] block: vhdx - log parsing, replay, and flush support, Jeff Cody, 2013/07/24
- [Qemu-devel] [PATCH 8/9] block: vhdx - add log write support, Jeff Cody, 2013/07/24
- [Qemu-devel] [PATCH 9/9] block: vhdx write support, Jeff Cody, 2013/07/24
- Re: [Qemu-devel] [PATCH 9/9] block: vhdx write support,
Fam Zheng <=