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 <[email protected]> > --- > 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 <[email protected]>
> ret = -EIO;
> goto out_unlocked;
signature.asc
Description: OpenPGP digital signature
