]> git.ipfire.org Git - thirdparty/qemu.git/commit
copy-before-write: allow specifying minimum cluster size
authorFiona Ebner <f.ebner@proxmox.com>
Thu, 11 Jul 2024 12:09:14 +0000 (14:09 +0200)
committerVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Mon, 30 Sep 2024 07:52:41 +0000 (10:52 +0300)
commit9484ad6c17a735284d4ff75ed3140ded9e0065fd
tree9508da16c47ca2c107a433433e473c26ba82fa9e
parent3b14a767eaca3df5534a162851f04787b363670e
copy-before-write: allow specifying minimum cluster size

In the context of backup fleecing, discarding the source will not work
when the fleecing image has a larger granularity than the one used for
block-copy operations (can happen if the backup target has smaller
cluster size), because cbw_co_pdiscard_snapshot() will align down the
discard requests and thus effectively ignore then.

To make @discard-source work in such a scenario, allow specifying the
minimum cluster size used for block-copy operations and thus in
particular also the granularity for discard requests to the source.

The type 'size' (corresponding to uint64_t in C) is used in QAPI to
rule out negative inputs and for consistency with already existing
@cluster-size parameters. Since block_copy_calculate_cluster_size()
uses int64_t for its result, a check that the input is not too large
is added in block_copy_state_new() before calling it. The calculation
in block_copy_calculate_cluster_size() is done in the target int64_t
type.

Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Acked-by: Markus Armbruster <armbru@redhat.com> (QAPI schema)
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Message-Id: <20240711120915.310243-2-f.ebner@proxmox.com>
[vsementsov: switch version to 9.2 in QAPI doc]
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
block/block-copy.c
block/copy-before-write.c
include/block/block-copy.h
qapi/block-core.json