qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

qcow2: List autoclear bit names in header

The feature table is supposed to advertise the name of all feature
bits that we support; however, we forgot to update the table for
autoclear bits. While at it, move the table to read-only memory in
code, and tweak the qcow2 spec to name the second autoclear bit.
Update iotests that are affected by the longer header length.

Fixes: 88ddffae
Fixes: 93c24936
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20200324174233.1622067-3-eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>

authored by

Eric Blake and committed by
Max Reitz
bb40ebce a951a631

+26 -15
+11 -1
block/qcow2.c
··· 2825 2825 2826 2826 /* Feature table */ 2827 2827 if (s->qcow_version >= 3) { 2828 - Qcow2Feature features[] = { 2828 + static const Qcow2Feature features[] = { 2829 2829 { 2830 2830 .type = QCOW2_FEAT_TYPE_INCOMPATIBLE, 2831 2831 .bit = QCOW2_INCOMPAT_DIRTY_BITNR, ··· 2845 2845 .type = QCOW2_FEAT_TYPE_COMPATIBLE, 2846 2846 .bit = QCOW2_COMPAT_LAZY_REFCOUNTS_BITNR, 2847 2847 .name = "lazy refcounts", 2848 + }, 2849 + { 2850 + .type = QCOW2_FEAT_TYPE_AUTOCLEAR, 2851 + .bit = QCOW2_AUTOCLEAR_BITMAPS_BITNR, 2852 + .name = "bitmaps", 2853 + }, 2854 + { 2855 + .type = QCOW2_FEAT_TYPE_AUTOCLEAR, 2856 + .bit = QCOW2_AUTOCLEAR_DATA_FILE_RAW_BITNR, 2857 + .name = "raw external data", 2848 2858 }, 2849 2859 }; 2850 2860
+2 -1
docs/interop/qcow2.txt
··· 143 143 bit is unset, the bitmaps extension data must be 144 144 considered inconsistent. 145 145 146 - Bit 1: If this bit is set, the external data file can 146 + Bit 1: Raw external data bit 147 + If this bit is set, the external data file can 147 148 be read as a consistent standalone raw image 148 149 without looking at the qcow2 metadata. 149 150
+4 -4
tests/qemu-iotests/031.out
··· 117 117 118 118 Header extension: 119 119 magic 0x6803f857 120 - length 192 120 + length 288 121 121 data <binary> 122 122 123 123 Header extension: ··· 150 150 151 151 Header extension: 152 152 magic 0x6803f857 153 - length 192 153 + length 288 154 154 data <binary> 155 155 156 156 Header extension: ··· 164 164 165 165 magic 0x514649fb 166 166 version 3 167 - backing_file_offset 0x178 167 + backing_file_offset 0x1d8 168 168 backing_file_size 0x17 169 169 cluster_bits 16 170 170 size 67108864 ··· 188 188 189 189 Header extension: 190 190 magic 0x6803f857 191 - length 192 191 + length 288 192 192 data <binary> 193 193 194 194 Header extension:
+2 -2
tests/qemu-iotests/036.out
··· 26 26 autoclear_features [63] 27 27 Header extension: 28 28 magic 0x6803f857 29 - length 192 29 + length 288 30 30 data <binary> 31 31 32 32 ··· 38 38 autoclear_features [] 39 39 Header extension: 40 40 magic 0x6803f857 41 - length 192 41 + length 288 42 42 data <binary> 43 43 44 44 *** done
+7 -7
tests/qemu-iotests/061.out
··· 26 26 27 27 Header extension: 28 28 magic 0x6803f857 29 - length 192 29 + length 288 30 30 data <binary> 31 31 32 32 magic 0x514649fb ··· 84 84 85 85 Header extension: 86 86 magic 0x6803f857 87 - length 192 87 + length 288 88 88 data <binary> 89 89 90 90 magic 0x514649fb ··· 140 140 141 141 Header extension: 142 142 magic 0x6803f857 143 - length 192 143 + length 288 144 144 data <binary> 145 145 146 146 ERROR cluster 5 refcount=0 reference=1 ··· 195 195 196 196 Header extension: 197 197 magic 0x6803f857 198 - length 192 198 + length 288 199 199 data <binary> 200 200 201 201 magic 0x514649fb ··· 264 264 265 265 Header extension: 266 266 magic 0x6803f857 267 - length 192 267 + length 288 268 268 data <binary> 269 269 270 270 read 65536/65536 bytes at offset 44040192 ··· 298 298 299 299 Header extension: 300 300 magic 0x6803f857 301 - length 192 301 + length 288 302 302 data <binary> 303 303 304 304 ERROR cluster 5 refcount=0 reference=1 ··· 327 327 328 328 Header extension: 329 329 magic 0x6803f857 330 - length 192 330 + length 288 331 331 data <binary> 332 332 333 333 read 131072/131072 bytes at offset 0