qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v7 1/3] block: include base when checking image


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [Qemu-devel] [PATCH v7 1/3] block: include base when checking image chain for block allocation
Date: Fri, 21 Jun 2019 08:34:52 +0000

19.06.2019 22:27, Max Reitz wrote:
> On 29.05.19 19:56, Andrey Shinkevich wrote:
>> This patch is used in the 'block/stream: introduce a bottom node'
>> that is following. Instead of the base node, the caller may pass
>> the node that has the base as its backing image to the function
>> bdrv_is_allocated_above() with a new parameter include_base = true
>> and get rid of the dependency on the base that may change during
>> commit/stream parallel jobs. Now, if the specified base is not
>> found in the backing image chain, the QEMU will abort.
>>
>> Suggested-by: Vladimir Sementsov-Ogievskiy <address@hidden>
>> Signed-off-by: Andrey Shinkevich <address@hidden>
>> Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
>> Reviewed-by: Alberto Garcia <address@hidden>
>> ---
>>   block/commit.c        |  2 +-
>>   block/io.c            | 21 +++++++++++++++------
>>   block/mirror.c        |  2 +-
>>   block/replication.c   |  2 +-
>>   block/stream.c        |  2 +-
>>   include/block/block.h |  3 ++-
>>   6 files changed, 21 insertions(+), 11 deletions(-)
> 
> This needs the following hunk squashed in so it still compiles:
> 
> (I can do that, if you agree.)

It will be great, thanks! (Andrey is on vocation now)

> 
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 9396d490d5..2a59eb27fe 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -2148,7 +2148,8 @@ static bool is_unallocated(BlockDriverState *bs,
> int64_t offset, int64_t bytes)
>   {
>       int64_t nr;
>       return !bytes ||
> -        (!bdrv_is_allocated_above(bs, NULL, offset, bytes, &nr) && nr
> == bytes);
> +        (!bdrv_is_allocated_above(bs, NULL, false, offset, bytes, &nr) &&
> +         nr == bytes);
>   }
> 
>   static bool is_zero_cow(BlockDriverState *bs, QCowL2Meta *m)
> diff --git a/qemu-img.c b/qemu-img.c
> index 158b3a505f..79983772de 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -3518,7 +3518,7 @@ static int img_rebase(int argc, char **argv)
>                    * to take action
>                    */
>                   ret = bdrv_is_allocated_above(backing_bs(bs),
> prefix_chain_bs,
> -                                              offset, n, &n);
> +                                              false, offset, n, &n);
>                   if (ret < 0) {
>                       error_report("error while reading image metadata: %s",
>                                    strerror(-ret));
> 


-- 
Best regards,
Vladimir

reply via email to

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