qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [RFC PATCH 07/11] qcow2: External file I/O


From: Max Reitz
Subject: Re: [Qemu-block] [RFC PATCH 07/11] qcow2: External file I/O
Date: Tue, 19 Feb 2019 00:36:56 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0

On 31.01.19 18:55, Kevin Wolf wrote:
> This changes the qcow2 implementation to direct all guest data I/O to
> s->data_file rather than bs->file, while metadata I/O still uses
> bs->file. At the moment, this is still always the same, but soon we'll
> add options to set s->data_file to an external data file.
> 
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
>  block/qcow2.h          |  2 +-
>  block/qcow2-bitmap.c   |  7 ++++---
>  block/qcow2-cache.c    |  6 +++---
>  block/qcow2-cluster.c  | 46 +++++++++++++++++++++++++++++++++++-------
>  block/qcow2-refcount.c | 30 +++++++++++++++++++--------
>  block/qcow2-snapshot.c |  7 ++++---
>  block/qcow2.c          | 39 +++++++++++++++++++++++++----------
>  7 files changed, 101 insertions(+), 36 deletions(-)

[...]

> diff --git a/block/qcow2.c b/block/qcow2.c
> index 2b81cf839d..ac9934b3ed 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c

[...]

> @@ -3598,6 +3598,16 @@ static int coroutine_fn 
> qcow2_co_truncate(BlockDriverState *bs, int64_t offset,
>          int64_t old_file_size, new_file_size;
>          uint64_t nb_new_data_clusters, nb_new_l2_tables;
>  
> +        /* With a data file, preallocation means just allocating the metadata
> +         * and forwarding the truncate request to the data file */

That's true, but...

> +        if (has_data_file(bs)) {
> +            ret = preallocate_co(bs, old_length, offset);
> +            if (ret < 0) {
> +                error_setg_errno(errp, -ret, "Preallocation failed");
> +                goto fail;
> +            }

...without a break here we're still going to preallocate bs->file as before.

Max

> +        }
> +
>          old_file_size = bdrv_getlength(bs->file->bs);
>          if (old_file_size < 0) {
>              error_setg_errno(errp, -old_file_size,

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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