From: Kevin Wolf <kwolf@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
qemu block <qemu-block@nongnu.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Max Reitz <mreitz@redhat.com>, John Snow <jsnow@redhat.com>
Subject: Re: [Qemu-devel] mirror questions
Date: Tue, 26 Feb 2019 10:28:58 +0100 [thread overview]
Message-ID: <20190226092858.GB4598@linux.fritz.box> (raw)
In-Reply-To: <d1ee3263-17df-f488-7603-3ed6924f178a@virtuozzo.com>
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
next prev parent reply other threads:[~2019-02-26 9:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-26 8:48 [Qemu-devel] mirror questions Vladimir Sementsov-Ogievskiy
2019-02-26 9:28 ` Kevin Wolf [this message]
2019-02-26 12:07 ` Vladimir Sementsov-Ogievskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190226092858.GB4598@linux.fritz.box \
--to=kwolf@redhat.com \
--cc=jsnow@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).