From: Fiona Ebner <f.ebner@proxmox.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>,
qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, armbru@redhat.com, eblake@redhat.com,
hreitz@redhat.com, kwolf@redhat.com, jsnow@redhat.com,
f.gruenbichler@proxmox.com, t.lamprecht@proxmox.com,
mahaocong@didichuxing.com
Subject: Re: [RFC 0/4] mirror: implement incremental and bitmap modes
Date: Wed, 6 Mar 2024 14:44:37 +0100 [thread overview]
Message-ID: <7b21c91b-5d33-4d84-aa61-cd69bbb78ccd@proxmox.com> (raw)
In-Reply-To: <0a3b3d62-5374-4219-a5fa-f087f93d85d8@proxmox.com>
Am 29.02.24 um 13:47 schrieb Fiona Ebner:
> Am 29.02.24 um 12:48 schrieb Vladimir Sementsov-Ogievskiy:
>> On 29.02.24 13:11, Fiona Ebner wrote:
>>>
>>> The iotest creates a new target image for each incremental sync which
>>> only records the diff relative to the previous mirror and those diff
>>> images are later rebased onto each other to get the full picture.
>>>
>>> Thus, it can be that a previous mirror job (not just background process
>>> or previous write) already copied a cluster, and in particular, copied
>>> it to a different target!
>>
>> Aha understand.
>>
>> For simplicity, let's consider case, when source "cluster size" = "job
>> cluster size" = "bitmap granularity" = "target cluster size".
>>
>> Which types of clusters we should consider, when we want to handle guest
>> write?
>>
>> 1. Clusters, that should be copied by background process
>>
>> These are dirty clusters from user-given bitmap, or if we do a full-disk
>> mirror, all clusters, not yet copied by background process.
>>
>> For such clusters we simply ignore the unaligned write. We can even
>> ignore the aligned write too: less disturbing the guest by delays.
>>
>
> Since do_sync_target_write() currently doesn't ignore aligned writes, I
> wouldn't change it. Of course they can count towards the "done_bitmap"
> you propose below.
>
>> 2. Clusters, already copied by background process during this mirror job
>> and not dirtied by guest since this time.
>>
>> For such clusters we are safe to do unaligned write, as target cluster
>> must be allocated.
>>
>
> Right.
>
>> 3. Clusters, not marked initially by dirty bitmap.
>>
>> What to do with them? We can't do unaligned write. I see two variants:
>>
>> - do additional read from source, to fill the whole cluster, which seems
>> a bit too heavy
>>
>
> Yes, I'd rather only do that as a last resort.
>
>> - just mark the cluster as dirty for background job. So we behave like
>> in "background" mode. But why not? The maximum count of such "hacks" is
>> limited to number of "clear" clusters at start of mirror job, which
>> means that we don't seriously affect the convergence. Mirror is
>> guaranteed to converge anyway. And the whole sense of "write-blocking"
>> mode is to have a guaranteed convergence. What do you think?
>>
>
> It could lead to a lot of flips between job->actively_synced == true and
> == false. AFAIU, currently, we only switch back from true to false when
> an error happens. While I don't see a concrete issue with it, at least
> it might be unexpected to users, so it better be documented.
>
> I'll try going with this approach, thanks!
>
These flips are actually a problem. When using live-migration with disk
mirroring, it's good that an actively synced image stays actively
synced. Otherwise, migration could finish at an inconvenient time and
try to inactivate the block device while mirror still got something to
do which would lead to an assertion failure [0].
The IO test added by this series is what uses the possibility to sync to
"diff images" which contain only the delta. In production, we are only
syncing to a previously mirrored target image. Non-aligned writes are
not an issue later like with a diff image. (Even if the initial
mirroring happened via ZFS replication outside of QEMU).
So copy-mode=write-blocking would work fine for our use case, but if I
go with the "mark clusters for unaligned writes dirty"-approach, it
would not work fine anymore.
Should I rather just document the limitation for the combination "target
is a diff image" and copy-mode=write-blocking?
I'd still add the check for the granularity and target cluster size.
While also only needed for diff images, it would allow using background
mode safely for those.
Best Regards,
Fiona
[0]:
https://lore.kernel.org/qemu-devel/1db7f571-cb7f-c293-04cc-cd856e060c3f@proxmox.com/
next prev parent reply other threads:[~2024-03-06 13:45 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-16 10:55 [RFC 0/4] mirror: implement incremental and bitmap modes Fiona Ebner
2024-02-16 10:55 ` [RFC 1/4] drive-mirror: add support for sync=bitmap mode=never Fiona Ebner
2024-02-21 6:55 ` Markus Armbruster
2024-02-21 9:21 ` Fiona Ebner
2024-02-16 10:55 ` [RFC 2/4] drive-mirror: add support for conditional and always bitmap sync modes Fiona Ebner
2024-02-16 10:55 ` [RFC 3/4] mirror: move some checks to qmp Fiona Ebner
2024-02-16 10:55 ` [RFC 4/4] iotests: add test for bitmap mirror Fiona Ebner
2024-02-28 16:00 ` [RFC 0/4] mirror: implement incremental and bitmap modes Vladimir Sementsov-Ogievskiy
2024-02-28 16:06 ` Vladimir Sementsov-Ogievskiy
2024-02-29 10:11 ` Fiona Ebner
2024-02-29 11:48 ` Vladimir Sementsov-Ogievskiy
2024-02-29 12:47 ` Fiona Ebner
2024-03-06 13:44 ` Fiona Ebner [this message]
2024-03-07 9:20 ` Vladimir Sementsov-Ogievskiy
2024-02-28 16:24 ` Vladimir Sementsov-Ogievskiy
2024-02-29 10:41 ` Fiona Ebner
2024-02-29 12:00 ` Vladimir Sementsov-Ogievskiy
2024-02-29 14:50 ` Fiona Ebner
2024-03-01 14:14 ` Vladimir Sementsov-Ogievskiy
2024-03-01 14:52 ` Fiona Ebner
2024-03-01 15:02 ` Vladimir Sementsov-Ogievskiy
2024-03-01 15:14 ` Fiona Ebner
2024-03-01 15:46 ` Vladimir Sementsov-Ogievskiy
2024-03-04 7:50 ` Fiona Ebner
2024-03-04 9:02 ` Fabian Grünbichler
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=7b21c91b-5d33-4d84-aa61-cd69bbb78ccd@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=f.gruenbichler@proxmox.com \
--cc=hreitz@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mahaocong@didichuxing.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=t.lamprecht@proxmox.com \
--cc=vsementsov@yandex-team.ru \
/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).