Skip to content

info blockstats (block-qcow2): show highest allocated offset (bytes)

Uri Lublin qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3block-qcow2: keep highest allocated offset (bytes)block-qcow2.c+34 -00 replies
2/3block-qcow2: export highest_allocated through BlockDriverInfo and get_info()block-qcow2.c block.h+2 -00 replies
3/3info blockstats: show highest_allocated if existsblock.c+6 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH 0/3] info blockstats (block-qcow2): show highest allocated offset (bytes)

From: Uri Lublin <[email protected]>

This patchset let the user know the highest allocated byte of qcow2 images. Actually it's the first unallocated byte after the highest byte written, cluster-size aligned.

The highest allocated byte gives a maximal limit (easy to calculate)
to the number of bytes allocated for that image, and may hint how many more allocations can be done before we reach end-of-file (end of host block device). Although there may be many free blocks below that number (allocated and freed)
the file system can not deallocate those blocks, and they have to be reused
by qemu. Also note that due to fragmentation those free blocks may not
be used on next allocations.

It can be useful for truncation of backing file images (ftruncate). Also it may be useful for defragmentation later (although we'll need the number of free blocks as well).

The first patch calculates the highest byte for qcow2 images (block-qcow2.c) The second patch exposed it through a BlockDeviceInfo
The third patch term_prints it upon info blockstats (for qcow2 images)