qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] mirror questions


From: Kevin Wolf
Subject: Re: [Qemu-devel] mirror questions
Date: Tue, 26 Feb 2019 10:28:58 +0100
User-agent: Mutt/1.11.3 (2019-02-01)

Am 26.02.2019 um 09:48 hat Vladimir Sementsov-Ogievskiy geschrieben:
> Hi!
> 
> A question about s->cow_bitmap, introduced in far b812f6719c
>      "mirror: perform COW if the cluster size is bigger than the granularity"
> 
> cow_bitmap is just a bitmap which tracks, what clusters of target are 
> allocated, to
> prevent COW in target, if target backing is not ready yet. And it is done by 
> just
> aligning request to be larget and cover unaligned border clusters.
> 
> so, questions:
> 
> 1. Is it correct that we align only on COPY operation in
> mirror_co_read? Misaligned write_zero can also lead to COW, I think?
> Discard seems safe in this way, is it?

It looks a bit odd at least.

There is a bdrv_round_to_clusters() call in mirror_iteration() before
MIRROR_METHOD_ZERO is set. I think this might avoid the COW. However,
how is rounding up the range even correct for write_zeroes and discard?
Can't we destroy data in adjacent sectors this way?

Might be worth writing some test cases and trying to reproduce a bug.

> 2. I don't see, how is it handled, if we align operation so that offset is 
> decreases,
> then it may intersect with previous mirror operation request, which may be 
> not yet finished?

You mean the mirror_cow_align() in mirror_co_read()?

I think it's safe as long as the bitmap granularity is such that
rounding can never affect another bit. This seems to be the case with
default granularity and 64k cluster size in the target image.

If we can't rely on this, it might indeed be unsafe. Another thing worth
trying to reproduce.

Kevin



reply via email to

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