qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 01/30] qcow2: Make Qcow2AioTask store the full host offset


From: Max Reitz
Subject: Re: [PATCH v4 01/30] qcow2: Make Qcow2AioTask store the full host offset
Date: Wed, 8 Apr 2020 12:23:20 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

On 17.03.20 19:15, Alberto Garcia wrote:
> The file_cluster_offset field of Qcow2AioTask stores a cluster-aligned
> host offset. In practice this is not very useful because all users(*)
> of this structure need the final host offset into the cluster, which
> they calculate using
> 
>    host_offset = file_cluster_offset + offset_into_cluster(s, offset)
> 
> There is no reason why Qcow2AioTask cannot store host_offset directly
> and that is what this patch does.
> 
> (*) compressed clusters are the exception: in this case what
>     file_cluster_offset was storing was the full compressed cluster
>     descriptor (offset + size). This does not change with this patch
>     but it is documented now.
> 
> Signed-off-by: Alberto Garcia <address@hidden>
> ---
>  block/qcow2.c | 68 +++++++++++++++++++++++++--------------------------
>  1 file changed, 33 insertions(+), 35 deletions(-)
> 
> diff --git a/block/qcow2.c b/block/qcow2.c
> index d44b45633d..a00b0c8e45 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c

[...]

> @@ -2409,8 +2410,7 @@ static coroutine_fn int 
> qcow2_co_pwritev_task(BlockDriverState *bs,
>          }
>          qemu_iovec_to_buf(qiov, qiov_offset, crypt_buf, bytes);
>  
> -        if (qcow2_co_encrypt(bs, file_cluster_offset + offset_in_cluster,
> -                             offset, crypt_buf, bytes) < 0)
> +        if (qcow2_co_encrypt(bs, host_offset, offset, crypt_buf, bytes) < 0)
>          {

This { should now go on the preceding line; with that fixed:

Reviewed-by: Max Reitz <address@hidden>

>              ret = -EIO;
>              goto out_unlocked;

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]