]> git.proxmox.com Git - mirror_qemu.git/commit - block/mirror.c
block/mirror: determine copy_to_target only once
authorFiona Ebner <f.ebner@proxmox.com>
Tue, 31 Oct 2023 13:54:25 +0000 (14:54 +0100)
committerKevin Wolf <kwolf@redhat.com>
Tue, 31 Oct 2023 17:20:29 +0000 (18:20 +0100)
commit7b32ad2242d6bcb1d5840466bf846fada8ca42e8
tree5b05081e1d64e35490b87b6828e2ce40c6aa7ac9
parent058cfca5645a9ed7cb2bdb77d15f2eacaf343694
block/mirror: determine copy_to_target only once

In preparation to allow changing the copy_mode via QMP. When running
in an iothread, it could be that copy_mode is changed from the main
thread in between reading copy_mode in bdrv_mirror_top_pwritev() and
reading copy_mode in bdrv_mirror_top_do_write(), so they might end up
disagreeing about whether copy_to_target is true or false. Avoid that
scenario by determining copy_to_target only once and passing it to
bdrv_mirror_top_do_write() as an argument.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Message-ID: <20231031135431.393137-5-f.ebner@proxmox.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/mirror.c