qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Add a for_commit option to qemu-img measure
@ 2025-04-16  7:16 Jean-Louis Dupond
  2025-04-16  7:16 ` [PATCH 1/3] block: add for_commit option to measure Jean-Louis Dupond
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jean-Louis Dupond @ 2025-04-16  7:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eric Blake, Markus Armbruster, Kevin Wolf, Hanna Reitz,
	qemu-block, Jean-Louis Dupond

This fixed bug #2369 [1]

This patch is a new implementation for a previous (non-merged) patch to make measure useful to calculate
the new size of the target image after commit.
It is very useful to have this kind of calculation if you do qcow2 on block storage (like iSCSi).
This because you need to be able to size the target volume big enough to handle the committed image.

Instead of modifying the existing measure logic, a new logic was added that really looks into the allocated
clusters and use the (local) next_cluster_index to calculate the target image size.
It also takes into account discards from the top into base to lower the index when a cluster is freed.

New test was added to verify the code.

When testing the new code on the impacted images in bug #2369 [1], this gives the following results:

Start:
<filesize>  <image>
 6174015488 top
13421772800 base

calculate with discard-no-unref=on:
required -> 13624475648
Commited image size: 13610385408

When calculating with discard-no-unref=off:
required -> 13520404480
Commited image size: 13504806912

Let me know if I made some mistakes :)

[1]: https://gitlab.com/qemu-project/qemu/-/issues/2369

Jean-Louis Dupond (3):
  block: add for_commit option to measure
  qcow2: make measure for_commit aware
  iotests/290: add test case for for_commit measure

 block/qcow2.c                    | 137 +++++++++++++++++++++++++++++--
 include/block/block_int-common.h |   4 +
 qapi/block-core.json             |  28 +++++++
 qemu-img.c                       |  40 +++++++--
 tests/qemu-iotests/290           |  45 ++++++++++
 tests/qemu-iotests/290.out       |  61 ++++++++++++++
 6 files changed, 304 insertions(+), 11 deletions(-)

-- 
2.49.0



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-08-30 15:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-16  7:16 [PATCH 0/3] Add a for_commit option to qemu-img measure Jean-Louis Dupond
2025-04-16  7:16 ` [PATCH 1/3] block: add for_commit option to measure Jean-Louis Dupond
2025-05-12 11:16   ` Hanna Czenczek
2025-05-13 14:10     ` Jean-Louis Dupond
2025-08-29  9:44       ` Jean-Louis Dupond
2025-04-16  7:16 ` [PATCH 2/3] qcow2: make measure for_commit aware Jean-Louis Dupond
2025-04-16  7:16 ` [PATCH 3/3] iotests/290: add test case for for_commit measure Jean-Louis Dupond

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).