mbox series

[0/3] qemu-img: map: implement support for compressed clusters

Message ID 20230607152627.468786-1-andrey.drobyshev@virtuozzo.com (mailing list archive)
Headers show
Series qemu-img: map: implement support for compressed clusters | expand

Message

Andrey Drobyshev June 7, 2023, 3:26 p.m. UTC
This series adds "compressed" field to the output of "qemu-img map"
command, specifying whether or not data block is compressed.  Only
JSON output mode is affected.  With this applied, output looks like so:

# qemu-img create -f qcow2 img.qcow2 192K
# qemu-io -c "write -c -P 0xaa 0 64K" img.qcow2
# qemu-io -c "write -P 0xbb 64K 64K" img.qcow2
# qemu-img map --output=json img.qcow2

[{ "start": 0, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
{ "start": 65536, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": 393216},
{ "start": 131072, "length": 65536, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false}]

Only formats supporting compression are affected (qcow, qcow2).

Andrey Drobyshev (3):
  block: add BDRV_BLOCK_COMPRESSED flag for bdrv_block_status()
  qemu-img: map: report compressed data blocks
  qemu-iotests: update expected tests output to contain "compressed"
    field

 block/qcow.c                                  |   5 +-
 block/qcow2.c                                 |   3 +
 include/block/block-common.h                  |   3 +
 qapi/block-core.json                          |   7 +-
 qemu-img.c                                    |  16 +-
 tests/qemu-iotests/122.out                    |  84 ++++----
 tests/qemu-iotests/154.out                    | 194 +++++++++---------
 tests/qemu-iotests/179.out                    | 178 ++++++++--------
 tests/qemu-iotests/244.out                    |  24 +--
 tests/qemu-iotests/252.out                    |  10 +-
 tests/qemu-iotests/274.out                    |  48 ++---
 .../tests/nbd-qemu-allocation.out             |   6 +-
 12 files changed, 300 insertions(+), 278 deletions(-)