This series extends the discard operation for qcow2 driver so that it can be used to discard individial subclusters. This feature might prove useful and gain some host disk space when dealing with the guest TRIM/discard requests, especially with large clusters (1M, 2M) when subclusters are enabled.
Andrey Drobyshev (7): qcow2: make function update_refcount_discard() global qcow2: add get_sc_range_info() helper for working with subcluster ranges qcow2: zeroize the entire cluster when there're no non-zero subclusters qcow2: make subclusters discardable qcow2: zero_l2_subclusters: fall through to discard operation when requested iotests/common.rc: add disk_usage function iotests/271: check disk usage on subcluster-based discard/unmap block/qcow2-cluster.c | 217 +++++++++++++++++++++++++++++------ block/qcow2-refcount.c | 8 +- block/qcow2.c | 8 +- block/qcow2.h | 2 + tests/qemu-iotests/250 | 5 - tests/qemu-iotests/271 | 25 +++- tests/qemu-iotests/271.out | 2 + tests/qemu-iotests/common.rc | 6 + 8 files changed, 226 insertions(+), 47 deletions(-) -- 2.39.3