Skip to contentSkip to conversation

qemu-img: map: implement support for compressed clusters

PATCH Superseded Andrey Drobyshev via 3 participants 10 messages Jun 7, 2023 – Jul 6, 2023 Block layer

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover qemu-img: map: implement support for compressed clusters

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(-)
Signature · 1 line
2.31.1
#1 lore raw

PATCH 1/3 block: add BDRV_BLOCK_COMPRESSED flag for bdrv_block_status()

Functions qcow2_get_host_offset(), get_cluster_offset() explicitly report compressed cluster types when data is compressed. However, this information is never passed further. Let's make use of it by adding new BDRV_BLOCK_COMPRESSED flag for bdrv_block_status(), so that caller may know that the data range is compressed. In particular, we're going to use this flag to tweak "qemu-img map" output.

This new flag is only being utilized by qcow and qcow2 formats, as only these two support compression.

---
 block/qcow.c                 | 5 ++++-
 block/qcow2.c                | 3 +++
 include/block/block-common.h | 3 +++
 3 files changed, 10 insertions(+), 1 deletion(-)
block/qcow.c +4 -1
index 3644bbf5cb..8416bcc2c3 100644
@@ -549,7 +549,10 @@ qcow_co_block_status(BlockDriverState *bs, bool want_zero,
     if (!cluster_offset) {
         return 0;
     }
-    if ((cluster_offset & QCOW_OFLAG_COMPRESSED) || s->crypto) {
+    if (cluster_offset & QCOW_OFLAG_COMPRESSED) {
+        return BDRV_BLOCK_DATA | BDRV_BLOCK_COMPRESSED;
+    }
+    if (s->crypto) {
         return BDRV_BLOCK_DATA;
     }
     *map = cluster_offset | index_in_cluster;
block/qcow2.c +3 -0
index e23edd48c2..8e01adc610 100644
@@ -2162,6 +2162,9 @@ qcow2_co_block_status(BlockDriverState *bs, bool want_zero, int64_t offset,
     {
         status |= BDRV_BLOCK_RECURSE;
     }
+    if (type == QCOW2_SUBCLUSTER_COMPRESSED) {
+        status |= BDRV_BLOCK_COMPRESSED;
+    }
     return status;
 }
 
include/block/block-common.h +3 -0
index e15395f2cb..f7a4e7d4db 100644
@@ -282,6 +282,8 @@ typedef enum {
  *                       layer rather than any backing, set by block layer
  * BDRV_BLOCK_EOF: the returned pnum covers through end of file for this
  *                 layer, set by block layer
+ * BDRV_BLOCK_COMPRESSED: the underlying data is compressed; only valid for
+ *                        the formats supporting compression: qcow, qcow2
  *
  * Internal flags:
  * BDRV_BLOCK_RAW: for use by passthrough drivers, such as raw, to request
@@ -317,6 +319,7 @@ typedef enum {
 #define BDRV_BLOCK_ALLOCATED    0x10
 #define BDRV_BLOCK_EOF          0x20
 #define BDRV_BLOCK_RECURSE      0x40
+#define BDRV_BLOCK_COMPRESSED   0x80
 
 typedef QTAILQ_HEAD(BlockReopenQueue, BlockReopenQueueEntry) BlockReopenQueue;
 
Signature · 1 line
2.31.1
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] block: add BDRV_BLOCK_COMPRESSED flag for bdrv_block_status()

Quoted 61 lines · Andrey Drobyshev

Functions qcow2_get_host_offset(), get_cluster_offset() explicitly report compressed cluster types when data is compressed. However, this information is never passed further. Let's make use of it by adding new BDRV_BLOCK_COMPRESSED flag for bdrv_block_status(), so that caller may know that the data range is compressed. In particular, we're going to use this flag to tweak "qemu-img map" output.

This new flag is only being utilized by qcow and qcow2 formats, as only these two support compression.

---
  block/qcow.c                 | 5 ++++-
  block/qcow2.c                | 3 +++
  include/block/block-common.h | 3 +++
  3 files changed, 10 insertions(+), 1 deletion(-)
block/qcow.c +4 -1
index 3644bbf5cb..8416bcc2c3 100644
@@ -549,7 +549,10 @@ qcow_co_block_status(BlockDriverState *bs, bool want_zero,
      if (!cluster_offset) {
          return 0;
      }
-    if ((cluster_offset & QCOW_OFLAG_COMPRESSED) || s->crypto) {
+    if (cluster_offset & QCOW_OFLAG_COMPRESSED) {
+        return BDRV_BLOCK_DATA | BDRV_BLOCK_COMPRESSED;
+    }
+    if (s->crypto) {
          return BDRV_BLOCK_DATA;
      }
      *map = cluster_offset | index_in_cluster;
block/qcow2.c +3 -0
index e23edd48c2..8e01adc610 100644
@@ -2162,6 +2162,9 @@ qcow2_co_block_status(BlockDriverState *bs, bool want_zero, int64_t offset,
      {
          status |= BDRV_BLOCK_RECURSE;
      }
+    if (type == QCOW2_SUBCLUSTER_COMPRESSED) {
+        status |= BDRV_BLOCK_COMPRESSED;
+    }
      return status;
  }
 
include/block/block-common.h +2 -0
index e15395f2cb..f7a4e7d4db 100644
@@ -282,6 +282,8 @@ typedef enum {
   *                       layer rather than any backing, set by block layer
   * BDRV_BLOCK_EOF: the returned pnum covers through end of file for this
   *                 layer, set by block layer
+ * BDRV_BLOCK_COMPRESSED: the underlying data is compressed; only valid for
+ *                        the formats supporting compression: qcow, qcow2
   *
   * Internal flags:
   * BDRV_BLOCK_RAW: for use by passthrough drivers, such as raw, to request

include/block/block-common.h typedef enum { · line 325

Quoted 7 lines
include/block/block-common.h +1 -0
@@ -317,6 +319,7 @@ typedef enum {
  #define BDRV_BLOCK_ALLOCATED    0x10
  #define BDRV_BLOCK_EOF          0x20
  #define BDRV_BLOCK_RECURSE      0x40
+#define BDRV_BLOCK_COMPRESSED   0x80
 
  typedef QTAILQ_HEAD(BlockReopenQueue, BlockReopenQueueEntry) BlockReopenQueue;
 
#3 lore raw

Re: [PATCH 1/3] block: add BDRV_BLOCK_COMPRESSED flag for bdrv_block_status()

Quoted 63 lines · Denis V. Lunev
Quoted 62 lines · Andrey Drobyshev

Functions qcow2_get_host_offset(), get_cluster_offset() explicitly report compressed cluster types when data is compressed. However, this information is never passed further.  Let's make use of it by adding new BDRV_BLOCK_COMPRESSED flag for bdrv_block_status(), so that caller may know that the data range is compressed.  In particular, we're going to use this flag to tweak "qemu-img map" output.

This new flag is only being utilized by qcow and qcow2 formats, as only these two support compression.

---
  block/qcow.c                 | 5 ++++-
  block/qcow2.c                | 3 +++
  include/block/block-common.h | 3 +++

  3 files changed, 10 insertions(+), 1 deletion(-)
block/qcow.c +4 -1
index 3644bbf5cb..8416bcc2c3 100644
@@ -549,7 +549,10 @@ qcow_co_block_status(BlockDriverState *bs, bool 
 want_zero,
       if (!cluster_offset) {
           return 0;
       }
-    if ((cluster_offset & QCOW_OFLAG_COMPRESSED) || s->crypto) {
+    if (cluster_offset & QCOW_OFLAG_COMPRESSED) {
+        return BDRV_BLOCK_DATA | BDRV_BLOCK_COMPRESSED;
+    }
+    if (s->crypto) {
           return BDRV_BLOCK_DATA;
       }

      *map = cluster_offset | index_in_cluster;

block/qcow2.c +3 -0
index e23edd48c2..8e01adc610 100644
@@ -2162,6 +2162,9 @@ qcow2_co_block_status(BlockDriverState *bs, 
 bool want_zero, int64_t offset,
       {
           status |= BDRV_BLOCK_RECURSE;
       }
+    if (type == QCOW2_SUBCLUSTER_COMPRESSED) {
+        status |= BDRV_BLOCK_COMPRESSED;
+    }
       return status;
   }

  diff --git a/include/block/block-common.h b/include/block/block-common.h index e15395f2cb..f7a4e7d4db 100644

include/block/block-common.h +1 -0
@@ -282,6 +282,8 @@ typedef enum {
    *                       layer rather than any backing, set by block layer
    * BDRV_BLOCK_EOF: the returned pnum covers through end of file for this
    *                 layer, set by block layer
+ * BDRV_BLOCK_COMPRESSED: the underlying data is compressed; only 

valid for
+ *                        the formats supporting compression: qcow, qcow2
   *
   * Internal flags:

Quoted 8 lines

include/block/block-common.h typedef enum { · line 323

Quoted 7 lines

   * BDRV_BLOCK_RAW: for use by passthrough drivers, such as raw, to request

include/block/block-common.h +1 -0
@@ -317,6 +319,7 @@ typedef enum {
   #define BDRV_BLOCK_ALLOCATED    0x10
   #define BDRV_BLOCK_EOF          0x20
   #define BDRV_BLOCK_RECURSE      0x40
+#define BDRV_BLOCK_COMPRESSED   0x80
     typedef QTAILQ_HEAD(BlockReopenQueue, BlockReopenQueueEntry) BlockReopenQueue;

Looking into the second patch I have found that I was a too fast here :)

The comment is misleading and the patch is incomplete.

static inline bool TSA_NO_TSA block_driver_can_compress(BlockDriver *drv) {
    return drv->bdrv_co_pwritev_compressed || drv->bdrv_co_pwritev_compressed_part;
}

which means that

   1    257  block/copy-on-read.c <<GLOBAL>> .bdrv_co_pwritev_compressed = cor_co_pwritev_compressed, 2   1199  block/qcow.c <<GLOBAL>> .bdrv_co_pwritev_compressed = qcow_co_pwritev_compressed, 3    255  block/throttle.c <<GLOBAL>> .bdrv_co_pwritev_compressed = throttle_co_pwritev_compressed, 4   3108  block/vmdk.c <<GLOBAL>> .bdrv_co_pwritev_compressed = vmdk_co_pwritev_compressed, 1   6121  block/qcow2.c <<GLOBAL>> .bdrv_co_pwritev_compressed_part...cow2_co_pwritev_compressed_part,

We have missed at least VMDK images.

#4 lore raw

Re: [PATCH 1/3] block: add BDRV_BLOCK_COMPRESSED flag for bdrv_block_status()

Quoted 100 lines · Denis V. Lunev
Quoted 68 lines · Denis V. Lunev
Quoted 67 lines · Andrey Drobyshev

Functions qcow2_get_host_offset(), get_cluster_offset() explicitly report compressed cluster types when data is compressed. However, this information is never passed further.  Let's make use of it by adding new BDRV_BLOCK_COMPRESSED flag for bdrv_block_status(), so that caller may know that the data range is compressed.  In particular, we're going to use this flag to tweak "qemu-img map" output.

This new flag is only being utilized by qcow and qcow2 formats, as only these two support compression.

---
  block/qcow.c                 | 5 ++++-
  block/qcow2.c                | 3 +++
  include/block/block-common.h | 3 +++

  3 files changed, 10 insertions(+), 1 deletion(-)
block/qcow.c +4 -1
index 3644bbf5cb..8416bcc2c3 100644
@@ -549,7 +549,10 @@ qcow_co_block_status(BlockDriverState *bs, bool
 want_zero,
       if (!cluster_offset) {
           return 0;
       }
-    if ((cluster_offset & QCOW_OFLAG_COMPRESSED) || s->crypto) {
+    if (cluster_offset & QCOW_OFLAG_COMPRESSED) {
+        return BDRV_BLOCK_DATA | BDRV_BLOCK_COMPRESSED;
+    }
+    if (s->crypto) {
           return BDRV_BLOCK_DATA;
       }

      *map = cluster_offset | index_in_cluster;

block/qcow2.c +3 -0
index e23edd48c2..8e01adc610 100644
@@ -2162,6 +2162,9 @@ qcow2_co_block_status(BlockDriverState *bs,
 bool want_zero, int64_t offset,
       {
           status |= BDRV_BLOCK_RECURSE;
       }
+    if (type == QCOW2_SUBCLUSTER_COMPRESSED) {
+        status |= BDRV_BLOCK_COMPRESSED;
+    }
       return status;
   }

  diff --git a/include/block/block-common.h
b/include/block/block-common.h
index e15395f2cb..f7a4e7d4db 100644

include/block/block-common.h +0 -0
@@ -282,6 +282,8 @@ typedef enum {
    *                       layer rather than any backing, set by

block layer
   * BDRV_BLOCK_EOF: the returned pnum covers through end of file for this
   *                 layer, set by block layer
+ * BDRV_BLOCK_COMPRESSED: the underlying data is compressed; only valid for
+ *                        the formats supporting compression: qcow, qcow2
   *
   * Internal flags:
   * BDRV_BLOCK_RAW: for use by passthrough drivers, such as raw, to request

Quoted 8 lines

include/block/block-common.h typedef enum { · line 324

Quoted 7 lines
include/block/block-common.h +1 -0
@@ -317,6 +319,7 @@ typedef enum {
   #define BDRV_BLOCK_ALLOCATED    0x10
   #define BDRV_BLOCK_EOF          0x20
   #define BDRV_BLOCK_RECURSE      0x40
+#define BDRV_BLOCK_COMPRESSED   0x80
     typedef QTAILQ_HEAD(BlockReopenQueue, BlockReopenQueueEntry)
 BlockReopenQueue;

Looking into the second patch I have found that I was a too fast here :)

The comment is misleading and the patch is incomplete.

static inline bool TSA_NO_TSA block_driver_can_compress(BlockDriver *drv) {
    return drv->bdrv_co_pwritev_compressed || drv->bdrv_co_pwritev_compressed_part;
}

which means that

   1    257  block/copy-on-read.c <<GLOBAL>> .bdrv_co_pwritev_compressed = cor_co_pwritev_compressed, 2   1199  block/qcow.c <<GLOBAL>> .bdrv_co_pwritev_compressed = qcow_co_pwritev_compressed, 3    255  block/throttle.c <<GLOBAL>> .bdrv_co_pwritev_compressed = throttle_co_pwritev_compressed, 4   3108  block/vmdk.c <<GLOBAL>> .bdrv_co_pwritev_compressed = vmdk_co_pwritev_compressed, 1   6121  block/qcow2.c <<GLOBAL>> .bdrv_co_pwritev_compressed_part...cow2_co_pwritev_compressed_part,

Quoted 1 line

We have missed at least VMDK images.

Thanks, my bad I didn't check that more thoroughly, I was mainly looking in the docs when making this conclusion.

man qemu-img:

Quoted 3 lines

Only the formats qcow and qcow2 support compression. The com‐ pression is read-only. It means that if a compressed sector is rewritten, then it is rewritten as uncompressed data.

Apparently man pages got a bit outdated on this.

#5 lore raw

PATCH 2/3 qemu-img: map: report compressed data blocks

In reply to Andrey Drobyshev via

Right now "qemu-img map" reports compressed blocks as containing data but having no host offset. This is not very informative. Instead, let's add another boolean field named "compressed" in case JSON output mode is specified. This is achieved by utilizing new allocation status flag BDRV_BLOCK_COMPRESSED for bdrv_block_status().

---
 qapi/block-core.json |  7 +++++--
 qemu-img.c           | 16 +++++++++++++---
 2 files changed, 18 insertions(+), 5 deletions(-)
qapi/block-core.json +5 -2
index 5dd5f7e4b0..bc6653e5d6 100644
@@ -409,6 +409,9 @@
 #
 # @zero: whether the virtual blocks read as zeroes
 #
+# @compressed: true indicates that data is stored compressed (the target
+#     format must support compression)
+#
 # @depth: number of layers (0 = top image, 1 = top image's backing
 #     file, ..., n - 1 = bottom image (where n is the number of images
 #     in the chain)) before reaching one for which the range is
@@ -426,8 +429,8 @@
 ##
 { 'struct': 'MapEntry',
   'data': {'start': 'int', 'length': 'int', 'data': 'bool',
-           'zero': 'bool', 'depth': 'int', 'present': 'bool',
-           '*offset': 'int', '*filename': 'str' } }
+           'zero': 'bool', 'compressed': 'bool', 'depth': 'int',
+           'present': 'bool', '*offset': 'int', '*filename': 'str' } }
 
 ##
 # @BlockdevCacheInfo:
qemu-img.c +13 -3
index 27f48051b0..9bb69f58f6 100644
@@ -3083,7 +3083,7 @@ static int img_info(int argc, char **argv)
 }
 
 static int dump_map_entry(OutputFormat output_format, MapEntry *e,
-                          MapEntry *next)
+                          MapEntry *next, bool can_compress)
 {
     switch (output_format) {
     case OFORMAT_HUMAN:
@@ -3112,6 +3112,9 @@ static int dump_map_entry(OutputFormat output_format, MapEntry *e,
                e->present ? "true" : "false",
                e->zero ? "true" : "false",
                e->data ? "true" : "false");
+        if (can_compress) {
+            printf(", \"compressed\": %s", e->compressed ? "true" : "false");
+        }
         if (e->has_offset) {
             printf(", \"offset\": %"PRId64"", e->offset);
         }
@@ -3172,6 +3175,7 @@ static int get_block_status(BlockDriverState *bs, int64_t offset,
         .length = bytes,
         .data = !!(ret & BDRV_BLOCK_DATA),
         .zero = !!(ret & BDRV_BLOCK_ZERO),
+        .compressed = !!(ret & BDRV_BLOCK_COMPRESSED),
         .offset = map,
         .has_offset = has_offset,
         .depth = depth,
@@ -3189,6 +3193,7 @@ static inline bool entry_mergeable(const MapEntry *curr, const MapEntry *next)
     }
     if (curr->zero != next->zero ||
         curr->data != next->data ||
+        curr->compressed != next->compressed ||
         curr->depth != next->depth ||
         curr->present != next->present ||
         !curr->filename != !next->filename ||
@@ -3218,6 +3223,7 @@ static int img_map(int argc, char **argv)
     bool force_share = false;
     int64_t start_offset = 0;
     int64_t max_length = -1;
+    bool can_compress = false;
 
     fmt = NULL;
     output = NULL;
@@ -3313,6 +3319,10 @@ static int img_map(int argc, char **argv)
         length = MIN(start_offset + max_length, length);
     }
 
+    if (output_format == OFORMAT_JSON) {
+        can_compress = block_driver_can_compress(bs->drv);
+    }
+
     curr.start = start_offset;
     while (curr.start + curr.length < length) {
         int64_t offset = curr.start + curr.length;
@@ -3330,7 +3340,7 @@ static int img_map(int argc, char **argv)
         }
 
         if (curr.length > 0) {
-            ret = dump_map_entry(output_format, &curr, &next);
+            ret = dump_map_entry(output_format, &curr, &next, can_compress);
             if (ret < 0) {
                 goto out;
             }
@@ -3338,7 +3348,7 @@ static int img_map(int argc, char **argv)
         curr = next;
     }
 
-    ret = dump_map_entry(output_format, &curr, NULL);
+    ret = dump_map_entry(output_format, &curr, NULL, can_compress);
     if (output_format == OFORMAT_JSON) {
         puts("]");
     }
Signature · 1 line
2.31.1
#6 lore raw

Re: [PATCH 2/3] qemu-img: map: report compressed data blocks

Quoted 27 lines · Andrey Drobyshev

Right now "qemu-img map" reports compressed blocks as containing data but having no host offset. This is not very informative. Instead, let's add another boolean field named "compressed" in case JSON output mode is specified. This is achieved by utilizing new allocation status flag BDRV_BLOCK_COMPRESSED for bdrv_block_status().

---
  qapi/block-core.json |  7 +++++--
  qemu-img.c           | 16 +++++++++++++---
  2 files changed, 18 insertions(+), 5 deletions(-)
qapi/block-core.json +3 -0
index 5dd5f7e4b0..bc6653e5d6 100644
@@ -409,6 +409,9 @@
  #
  # @zero: whether the virtual blocks read as zeroes
  #
+# @compressed: true indicates that data is stored compressed (the target
+#     format must support compression)
+#
  # @depth: number of layers (0 = top image, 1 = top image's backing
  #     file, ..., n - 1 = bottom image (where n is the number of images
  #     in the chain)) before reaching one for which the range is

qapi/block-core.json line 433

Quoted 7 lines
qapi/block-core.json +2 -2
@@ -426,8 +429,8 @@
  ##
  { 'struct': 'MapEntry',
    'data': {'start': 'int', 'length': 'int', 'data': 'bool',
-           'zero': 'bool', 'depth': 'int', 'present': 'bool',
-           '*offset': 'int', '*filename': 'str' } }
+           'zero': 'bool', 'compressed': 'bool', 'depth': 'int',
+           'present': 'bool', '*offset': 'int', '*filename': 'str' } }

after some thoughts I would say that for compatibility reasons it would be beneficial to have compressed field optional.

Quoted 17 lines
qapi/block-core.json +0 -0
  ##
  # @BlockdevCacheInfo:
qemu-img.c +1 -1
index 27f48051b0..9bb69f58f6 100644
@@ -3083,7 +3083,7 @@ static int img_info(int argc, char **argv)
  }
 
  static int dump_map_entry(OutputFormat output_format, MapEntry *e,
-                          MapEntry *next)
+                          MapEntry *next, bool can_compress)
  {
      switch (output_format) {
      case OFORMAT_HUMAN:

qemu-img.c static int dump_map_entry(OutputFormat output_format, MapEntry *e, · line 3116

Quoted 5 lines
qemu-img.c +2 -0
@@ -3112,6 +3112,9 @@ static int dump_map_entry(OutputFormat output_format, MapEntry *e,
                 e->present ? "true" : "false",
                 e->zero ? "true" : "false",
                 e->data ? "true" : "false");
+        if (can_compress) {
+            printf(", \"compressed\": %s", e->compressed ? "true" : "false");

If compressed field is optional, then it would be reasonable to skip filling this field for non-compressed clusters. In that case we will not need 'can_compress' parameter of the call.

Ha! More importantly. The field (according to the metadata) is mandatory while it is reported conditionally, i.e. the field is optional in reality. There is a problem in a this or that way.

Quoted 57 lines
qemu-img.c +10 -2
+        }
          if (e->has_offset) {
              printf(", \"offset\": %"PRId64"", e->offset);
          }
@@ -3172,6 +3175,7 @@ static int get_block_status(BlockDriverState *bs, int64_t offset,
          .length = bytes,
          .data = !!(ret & BDRV_BLOCK_DATA),
          .zero = !!(ret & BDRV_BLOCK_ZERO),
+        .compressed = !!(ret & BDRV_BLOCK_COMPRESSED),
          .offset = map,
          .has_offset = has_offset,
          .depth = depth,
@@ -3189,6 +3193,7 @@ static inline bool entry_mergeable(const MapEntry *curr, const MapEntry *next)
      }
      if (curr->zero != next->zero ||
          curr->data != next->data ||
+        curr->compressed != next->compressed ||
          curr->depth != next->depth ||
          curr->present != next->present ||
          !curr->filename != !next->filename ||
@@ -3218,6 +3223,7 @@ static int img_map(int argc, char **argv)
      bool force_share = false;
      int64_t start_offset = 0;
      int64_t max_length = -1;
+    bool can_compress = false;
 
      fmt = NULL;
      output = NULL;
@@ -3313,6 +3319,10 @@ static int img_map(int argc, char **argv)
          length = MIN(start_offset + max_length, length);
      }
 
+    if (output_format == OFORMAT_JSON) {
+        can_compress = block_driver_can_compress(bs->drv);
+    }
+
      curr.start = start_offset;
      while (curr.start + curr.length < length) {
          int64_t offset = curr.start + curr.length;
@@ -3330,7 +3340,7 @@ static int img_map(int argc, char **argv)
          }
 
          if (curr.length > 0) {
-            ret = dump_map_entry(output_format, &curr, &next);
+            ret = dump_map_entry(output_format, &curr, &next, can_compress);
              if (ret < 0) {
                  goto out;
              }
@@ -3338,7 +3348,7 @@ static int img_map(int argc, char **argv)
          curr = next;
      }
 
-    ret = dump_map_entry(output_format, &curr, NULL);
+    ret = dump_map_entry(output_format, &curr, NULL, can_compress);
      if (output_format == OFORMAT_JSON) {
          puts("]");
      }
#7 lore raw

Re: [PATCH 2/3] qemu-img: map: report compressed data blocks

Quoted 63 lines · Denis V. Lunev
Quoted 27 lines · Andrey Drobyshev

Right now "qemu-img map" reports compressed blocks as containing data but having no host offset.  This is not very informative.  Instead, let's add another boolean field named "compressed" in case JSON output mode is specified.  This is achieved by utilizing new allocation status flag BDRV_BLOCK_COMPRESSED for bdrv_block_status().

---
  qapi/block-core.json |  7 +++++--
  qemu-img.c           | 16 +++++++++++++---

  2 files changed, 18 insertions(+), 5 deletions(-)
qapi/block-core.json +3 -0
index 5dd5f7e4b0..bc6653e5d6 100644
@@ -409,6 +409,9 @@
   #
   # @zero: whether the virtual blocks read as zeroes
   #
+# @compressed: true indicates that data is stored compressed (the target
+#     format must support compression)
+#
   # @depth: number of layers (0 = top image, 1 = top image's backing
   #     file, ..., n - 1 = bottom image (where n is the number of images
   #     in the chain)) before reaching one for which the range is

qapi/block-core.json line 433

Quoted 7 lines
qapi/block-core.json +2 -2
@@ -426,8 +429,8 @@
   ##
   { 'struct': 'MapEntry',
     'data': {'start': 'int', 'length': 'int', 'data': 'bool',
-           'zero': 'bool', 'depth': 'int', 'present': 'bool',
-           '*offset': 'int', '*filename': 'str' } }
+           'zero': 'bool', 'compressed': 'bool', 'depth': 'int',
+           'present': 'bool', '*offset': 'int', '*filename': 'str' } }

after some thoughts I would say that for compatibility reasons it would be beneficial to have compressed field optional.

Quoted 15 lines
qapi/block-core.json +0 -0
     ##
   # @BlockdevCacheInfo:
qemu-img.c +1 -1
index 27f48051b0..9bb69f58f6 100644
@@ -3083,7 +3083,7 @@ static int img_info(int argc, char **argv)
   }
     static int dump_map_entry(OutputFormat output_format, MapEntry *e,
-                          MapEntry *next)
+                          MapEntry *next, bool can_compress)
   {
       switch (output_format) {

      case OFORMAT_HUMAN:

qemu-img.c static int dump_map_entry(OutputFormat · line 3118

Quoted 7 lines
qemu-img.c +2 -0
@@ -3112,6 +3112,9 @@ static int dump_map_entry(OutputFormat
 output_format, MapEntry *e,
                  e->present ? "true" : "false",
                  e->zero ? "true" : "false",
                  e->data ? "true" : "false");
+        if (can_compress) {
+            printf(", \"compressed\": %s", e->compressed ? "true" :
 "false");

If compressed field is optional, then it would be reasonable to skip filling this field for non-compressed clusters. In that case we will not need 'can_compress' parameter of the call.

Quoted 4 lines

Ha! More importantly. The field (according to the metadata) is mandatory while it is reported conditionally, i.e. the field is optional in reality. There is a problem in a this or that way.

Yes, I agree that making this field optional makes sense since we do not include it for formats which don't support compression.

However, I don't think we should entirely omit it for uncompressed clusters. If we keep it present that would be more consistent with the current logic, as with '"zero": false' field which is always included.

Quoted 57 lines
Quoted 56 lines
qemu-img.c +1 -0
+        }
           if (e->has_offset) {

              printf(", \"offset\": %"PRId64"", e->offset); }

qemu-img.c +1 -0
@@ -3172,6 +3175,7 @@ static int get_block_status(BlockDriverState
 *bs, int64_t offset,
           .length = bytes,
           .data = !!(ret & BDRV_BLOCK_DATA),
           .zero = !!(ret & BDRV_BLOCK_ZERO),
+        .compressed = !!(ret & BDRV_BLOCK_COMPRESSED),
           .offset = map,
           .has_offset = has_offset,

          .depth = depth,

qemu-img.c +0 -0
@@ -3189,6 +3193,7 @@ static inline bool entry_mergeable(const
 MapEntry *curr, const MapEntry *next)
       }

      if (curr->zero != next->zero ||
          curr->data != next->data ||
+        curr->compressed != next->compressed ||
          curr->depth != next->depth ||
          curr->present != next->present ||
          !curr->filename != !next->filename ||

qemu-img.c +6 -1
@@ -3218,6 +3223,7 @@ static int img_map(int argc, char **argv)
       bool force_share = false;
       int64_t start_offset = 0;
       int64_t max_length = -1;
+    bool can_compress = false;
         fmt = NULL;
       output = NULL;
@@ -3313,6 +3319,10 @@ static int img_map(int argc, char **argv)
           length = MIN(start_offset + max_length, length);
       }
   +    if (output_format == OFORMAT_JSON) {
+        can_compress = block_driver_can_compress(bs->drv);
+    }
+
       curr.start = start_offset;
       while (curr.start + curr.length < length) {
           int64_t offset = curr.start + curr.length;
@@ -3330,7 +3340,7 @@ static int img_map(int argc, char **argv)
           }
             if (curr.length > 0) {
-            ret = dump_map_entry(output_format, &curr, &next);
+            ret = dump_map_entry(output_format, &curr, &next,
 can_compress);
               if (ret < 0) {
                   goto out;
               }
@@ -3338,7 +3348,7 @@ static int img_map(int argc, char **argv)
           curr = next;
       }
   -    ret = dump_map_entry(output_format, &curr, NULL);
+    ret = dump_map_entry(output_format, &curr, NULL, can_compress);
       if (output_format == OFORMAT_JSON) {
           puts("]");
       }
#8 lore raw

Re: [PATCH 2/3] qemu-img: map: report compressed data blocks

Quoted 68 lines · Andrey Drobyshev
Quoted 63 lines · Denis V. Lunev
Quoted 27 lines · Andrey Drobyshev

Right now "qemu-img map" reports compressed blocks as containing data but having no host offset.  This is not very informative.  Instead, let's add another boolean field named "compressed" in case JSON output mode is specified.  This is achieved by utilizing new allocation status flag BDRV_BLOCK_COMPRESSED for bdrv_block_status().

---
   qapi/block-core.json |  7 +++++--
   qemu-img.c           | 16 +++++++++++++---
   2 files changed, 18 insertions(+), 5 deletions(-)
qapi/block-core.json +3 -0
index 5dd5f7e4b0..bc6653e5d6 100644
@@ -409,6 +409,9 @@
   #
   # @zero: whether the virtual blocks read as zeroes
   #
+# @compressed: true indicates that data is stored compressed (the target
+#     format must support compression)
+#
   # @depth: number of layers (0 = top image, 1 = top image's backing
   #     file, ..., n - 1 = bottom image (where n is the number of images
   #     in the chain)) before reaching one for which the range is

qapi/block-core.json line 433

Quoted 7 lines
qapi/block-core.json +2 -2
@@ -426,8 +429,8 @@
   ##
   { 'struct': 'MapEntry',
     'data': {'start': 'int', 'length': 'int', 'data': 'bool',
-           'zero': 'bool', 'depth': 'int', 'present': 'bool',
-           '*offset': 'int', '*filename': 'str' } }
+           'zero': 'bool', 'compressed': 'bool', 'depth': 'int',
+           'present': 'bool', '*offset': 'int', '*filename': 'str' } }

after some thoughts I would say that for compatibility reasons it would be beneficial to have compressed field optional.

Quoted 15 lines
qapi/block-core.json +0 -0
     ##
   # @BlockdevCacheInfo:
qemu-img.c +1 -1
index 27f48051b0..9bb69f58f6 100644
@@ -3083,7 +3083,7 @@ static int img_info(int argc, char **argv)
   }
     static int dump_map_entry(OutputFormat output_format, MapEntry *e,
-                          MapEntry *next)
+                          MapEntry *next, bool can_compress)
   {
       switch (output_format) {
       case OFORMAT_HUMAN:

qemu-img.c static int dump_map_entry(OutputFormat · line 3118

Quoted 7 lines
qemu-img.c +2 -0
@@ -3112,6 +3112,9 @@ static int dump_map_entry(OutputFormat
 output_format, MapEntry *e,
                  e->present ? "true" : "false",
                  e->zero ? "true" : "false",
                  e->data ? "true" : "false");
+        if (can_compress) {
+            printf(", \"compressed\": %s", e->compressed ? "true" :
 "false");

If compressed field is optional, then it would be reasonable to skip filling this field for non-compressed clusters. In that case we will not need 'can_compress' parameter of the call.

Quoted 4 lines

Ha! More importantly. The field (according to the metadata) is mandatory while it is reported conditionally, i.e. the field is optional in reality. There is a problem in a this or that way.

Quoted 6 lines

Yes, I agree that making this field optional makes sense since we do not include it for formats which don't support compression.

However, I don't think we should entirely omit it for uncompressed clusters. If we keep it present that would be more consistent with the current logic, as with '"zero": false' field which is always included.

you right, that makes sense

Den

#9 lore raw

PATCH 3/3 qemu-iotests: update expected tests output to contain "compressed" field

In reply to Andrey Drobyshev via

The previous commit adds "compressed" boolean field to JSON output of "qemu-img map" command. Let's tweak expected tests output accordingly.

---
 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 +-
 7 files changed, 272 insertions(+), 272 deletions(-)
tests/qemu-iotests/122.out +42 -42
index e18766e167..6a1aa3fe2b 100644
@@ -67,12 +67,12 @@ read 65536/65536 bytes at offset 4194304
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 read 65536/65536 bytes at offset 8388608
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-[{ "start": 0, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true},
-{ "start": 65536, "length": 4128768, "depth": 0, "present": false, "zero": true, "data": false},
-{ "start": 4194304, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true},
-{ "start": 4259840, "length": 4128768, "depth": 0, "present": false, "zero": true, "data": false},
-{ "start": 8388608, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true},
-{ "start": 8454144, "length": 4128768, "depth": 0, "present": false, "zero": true, "data": false}]
+[{ "start": 0, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
+{ "start": 65536, "length": 4128768, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
+{ "start": 4194304, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
+{ "start": 4259840, "length": 4128768, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
+{ "start": 8388608, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
+{ "start": 8454144, "length": 4128768, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false}]
 read 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 read 65536/65536 bytes at offset 4194304
@@ -94,12 +94,12 @@ wrote 1024/1024 bytes at offset 1046528
 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 1024/1024 bytes at offset 0
 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-[{ "start": 0, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true},
-{ "start": 65536, "length": 65536, "depth": 0, "present": false, "zero": true, "data": false},
-{ "start": 131072, "length": 196608, "depth": 0, "present": true, "zero": false, "data": true},
-{ "start": 327680, "length": 655360, "depth": 0, "present": false, "zero": true, "data": false},
-{ "start": 983040, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true},
-{ "start": 1048576, "length": 1046528, "depth": 0, "present": false, "zero": true, "data": false}]
+[{ "start": 0, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
+{ "start": 65536, "length": 65536, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
+{ "start": 131072, "length": 196608, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
+{ "start": 327680, "length": 655360, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
+{ "start": 983040, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
+{ "start": 1048576, "length": 1046528, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false}]
 read 16384/16384 bytes at offset 0
 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 read 16384/16384 bytes at offset 16384
@@ -130,14 +130,14 @@ read 3145728/3145728 bytes at offset 0
 3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 read 63963136/63963136 bytes at offset 3145728
 61 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET}]
+[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": OFFSET}]
 
 convert -c -S 0:
 read 3145728/3145728 bytes at offset 0
 3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 read 63963136/63963136 bytes at offset 3145728
 61 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true}]
+[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true}]
 Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864
 wrote 33554432/33554432 bytes at offset 0
 32 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
@@ -152,7 +152,7 @@ read 30408704/30408704 bytes at offset 3145728
 29 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 read 33554432/33554432 bytes at offset 33554432
 32 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET}]
+[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": OFFSET}]
 
 convert -c -S 0 with source backing file:
 read 3145728/3145728 bytes at offset 0
@@ -161,7 +161,7 @@ read 30408704/30408704 bytes at offset 3145728
 29 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 read 33554432/33554432 bytes at offset 33554432
 32 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true}]
+[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true}]
 
 convert -S 0 -B ...
 read 3145728/3145728 bytes at offset 0
@@ -170,7 +170,7 @@ read 30408704/30408704 bytes at offset 3145728
 29 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 read 33554432/33554432 bytes at offset 33554432
 32 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET}]
+[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": OFFSET}]
 
 convert -c -S 0 -B ...
 read 3145728/3145728 bytes at offset 0
@@ -179,7 +179,7 @@ read 30408704/30408704 bytes at offset 3145728
 29 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 read 33554432/33554432 bytes at offset 33554432
 32 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true}]
+[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true}]
 
 === Non-zero -S ===
 
@@ -196,32 +196,32 @@ wrote 1024/1024 bytes at offset 66560
 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 
 convert -S 4k
-[{ "start": 0, "length": 4096, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET},
-{ "start": 4096, "length": 4096, "depth": 0, "present": false, "zero": true, "data": false},
-{ "start": 8192, "length": 4096, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET},
-{ "start": 12288, "length": 4096, "depth": 0, "present": false, "zero": true, "data": false},
-{ "start": 16384, "length": 4096, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET},
-{ "start": 20480, "length": 67088384, "depth": 0, "present": false, "zero": true, "data": false}]
+[{ "start": 0, "length": 4096, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": OFFSET},
+{ "start": 4096, "length": 4096, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
+{ "start": 8192, "length": 4096, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": OFFSET},
+{ "start": 12288, "length": 4096, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
+{ "start": 16384, "length": 4096, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": OFFSET},
+{ "start": 20480, "length": 67088384, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false}]
 
 convert -c -S 4k
-[{ "start": 0, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true},
-{ "start": 1024, "length": 7168, "depth": 0, "present": false, "zero": true, "data": false},
-{ "start": 8192, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true},
-{ "start": 9216, "length": 8192, "depth": 0, "present": false, "zero": true, "data": false},
-{ "start": 17408, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true},
-{ "start": 18432, "length": 67090432, "depth": 0, "present": false, "zero": true, "data": false}]
+[{ "start": 0, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
+{ "start": 1024, "length": 7168, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
+{ "start": 8192, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
+{ "start": 9216, "length": 8192, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
+{ "start": 17408, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
+{ "start": 18432, "length": 67090432, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false}]
 
 convert -S 8k
-[{ "start": 0, "length": 24576, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET},
-{ "start": 24576, "length": 67084288, "depth": 0, "present": false, "zero": true, "data": false}]
+[{ "start": 0, "length": 24576, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": OFFSET},
+{ "start": 24576, "length": 67084288, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false}]
 
 convert -c -S 8k
-[{ "start": 0, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true},
-{ "start": 1024, "length": 7168, "depth": 0, "present": false, "zero": true, "data": false},
-{ "start": 8192, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true},
-{ "start": 9216, "length": 8192, "depth": 0, "present": false, "zero": true, "data": false},
-{ "start": 17408, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true},
-{ "start": 18432, "length": 67090432, "depth": 0, "present": false, "zero": true, "data": false}]
+[{ "start": 0, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
+{ "start": 1024, "length": 7168, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
+{ "start": 8192, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
+{ "start": 9216, "length": 8192, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
+{ "start": 17408, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
+{ "start": 18432, "length": 67090432, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false}]
 
 === -n to a non-zero image ===
 
@@ -235,18 +235,18 @@ Images are identical.
 
 Formatting 'TEST_DIR/t.IMGFMT.orig', fmt=IMGFMT size=67108864
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
-[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": true, "data": false}]
+[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": true, "data": false, "compressed": false}]
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
-[{ "start": 0, "length": 67108864, "depth": 0, "present": false, "zero": true, "data": false}]
+[{ "start": 0, "length": 67108864, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false}]
 
 === -n to an empty image with a backing file ===
 
 Formatting 'TEST_DIR/t.IMGFMT.orig', fmt=IMGFMT size=67108864
 Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=IMGFMT
-[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": true, "data": false}]
+[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": true, "data": false, "compressed": false}]
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=IMGFMT
-[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "offset": 327680}]
+[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": 327680}]
 
 === -n -B to an image without a backing file ===
 
tests/qemu-iotests/154.out +97 -97

334 lines not on this page · raw message

tests/qemu-iotests/179.out +89 -89

214 lines not on this page · raw message

tests/qemu-iotests/244.out +12 -12
index 5e03add054..38ffbd7e1e 100644
@@ -57,12 +57,12 @@ wrote 3145728/3145728 bytes at offset 3145728
 3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 No errors were found on the image.
 
-[{ "start": 0, "length": 1048576, "depth": 0, "present": false, "zero": true, "data": false},
-{ "start": 1048576, "length": 1048576, "depth": 0, "present": true, "zero": false, "data": true, "offset": 1048576},
-{ "start": 2097152, "length": 2097152, "depth": 0, "present": true, "zero": true, "data": false},
-{ "start": 4194304, "length": 1048576, "depth": 0, "present": true, "zero": true, "data": false, "offset": 4194304},
-{ "start": 5242880, "length": 1048576, "depth": 0, "present": true, "zero": true, "data": false},
-{ "start": 6291456, "length": 60817408, "depth": 0, "present": false, "zero": true, "data": false}]
+[{ "start": 0, "length": 1048576, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
+{ "start": 1048576, "length": 1048576, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": 1048576},
+{ "start": 2097152, "length": 2097152, "depth": 0, "present": true, "zero": true, "data": false, "compressed": false},
+{ "start": 4194304, "length": 1048576, "depth": 0, "present": true, "zero": true, "data": false, "compressed": false, "offset": 4194304},
+{ "start": 5242880, "length": 1048576, "depth": 0, "present": true, "zero": true, "data": false, "compressed": false},
+{ "start": 6291456, "length": 60817408, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false}]
 
 read 1048576/1048576 bytes at offset 0
 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
@@ -94,10 +94,10 @@ wrote 3145728/3145728 bytes at offset 3145728
 3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 No errors were found on the image.
 
-[{ "start": 0, "length": 2097152, "depth": 0, "present": true, "zero": false, "data": true, "offset": 0},
-{ "start": 2097152, "length": 2097152, "depth": 0, "present": true, "zero": true, "data": false},
-{ "start": 4194304, "length": 2097152, "depth": 0, "present": true, "zero": true, "data": false, "offset": 4194304},
-{ "start": 6291456, "length": 60817408, "depth": 0, "present": true, "zero": false, "data": true, "offset": 6291456}]
+[{ "start": 0, "length": 2097152, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": 0},
+{ "start": 2097152, "length": 2097152, "depth": 0, "present": true, "zero": true, "data": false, "compressed": false},
+{ "start": 4194304, "length": 2097152, "depth": 0, "present": true, "zero": true, "data": false, "compressed": false, "offset": 4194304},
+{ "start": 6291456, "length": 60817408, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": 6291456}]
 
 read 1048576/1048576 bytes at offset 0
 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
@@ -123,8 +123,8 @@ read 1048576/1048576 bytes at offset 0
 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 Offset          Length          Mapped to       File
 0               0x100000        0               TEST_DIR/t.qcow2.data
-[{ "start": 0, "length": 1048576, "depth": 0, "present": true, "zero": false, "data": true, "offset": 0},
-{ "start": 1048576, "length": 66060288, "depth": 0, "present": false, "zero": true, "data": false}]
+[{ "start": 0, "length": 1048576, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": 0},
+{ "start": 1048576, "length": 66060288, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false}]
 
 === Copy offloading ===
 
tests/qemu-iotests/252.out +5 -5
index c578129c25..b1aa94cb05 100644
@@ -23,8 +23,8 @@ read 131072/131072 bytes at offset 131072
 read 131072/131072 bytes at offset 262144
 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 
-[{ "start": 0, "length": 262144, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET},
-{ "start": 262144, "length": 131072, "depth": 0, "present": false, "zero": true, "data": false}]
+[{ "start": 0, "length": 262144, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": OFFSET},
+{ "start": 262144, "length": 131072, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false}]
 
 read 131072/131072 bytes at offset 0
 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
@@ -33,7 +33,7 @@ read 131072/131072 bytes at offset 131072
 read 131072/131072 bytes at offset 262144
 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 
-[{ "start": 0, "length": 262144, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET},
-{ "start": 262144, "length": 65536, "depth": 0, "present": true, "zero": true, "data": false},
-{ "start": 327680, "length": 65536, "depth": 1, "present": false, "zero": true, "data": false}]
+[{ "start": 0, "length": 262144, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": OFFSET},
+{ "start": 262144, "length": 65536, "depth": 0, "present": true, "zero": true, "data": false, "compressed": false},
+{ "start": 327680, "length": 65536, "depth": 1, "present": false, "zero": true, "data": false, "compressed": false}]
 *** done
tests/qemu-iotests/274.out +24 -24

102 lines not on this page · raw message

tests/qemu-iotests/tests/nbd-qemu-allocation.out +3 -3
index 9d938db24e..c1e60277f2 100644
@@ -11,9 +11,9 @@ wrote 2097152/2097152 bytes at offset 1048576
 
 === Check allocation over NBD ===
 
-[{ "start": 0, "length": 1048576, "depth": 1, "present": true, "zero": false, "data": true, "offset": 327680},
-{ "start": 1048576, "length": 2097152, "depth": 0, "present": true, "zero": false, "data": true, "offset": 327680},
-{ "start": 3145728, "length": 1048576, "depth": 1, "present": false, "zero": true, "data": false}]
+[{ "start": 0, "length": 1048576, "depth": 1, "present": true, "zero": false, "data": true, "compressed": false, "offset": 327680},
+{ "start": 1048576, "length": 2097152, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": 327680},
+{ "start": 3145728, "length": 1048576, "depth": 1, "present": false, "zero": true, "data": false, "compressed": false}]
 exports available: 1
  export: ''
   size:  4194304
Signature · 1 line
2.31.1