struct V3HeaderBase {
incompatible_features: u64,
compatible_features: u64,
autoclear_features: u64,
refcount_order: u32,
header_length: u32,
}
Expand description
Qcow2 v3 header.
Fields§
§incompatible_features: u64
Bitmask of incompatible features. An implementation must fail to open an image if an unknown bit is set.
- Dirty bit. If this bit is set then refcounts may be inconsistent, make sure to scan L1/L2 tables to repair refcounts before accessing the image.
- Corrupt bit. If this bit is set then any data structure may be corrupt and the image must not be written to (unless for regaining consistency).
- External data file bit. If this bit is set, an external data file is used. Guest clusters are then stored in the external data file. For such images, clusters in the external data file are not refcounted. The offset field in the Standard Cluster Descriptor must match the guest offset and neither compressed clusters nor internal snapshots are supported. An External Data File Name header extension may be present if this bit is set.
- Compression type bit. If this bit is set, a non-default compression is used for compressed clusters. The compression_type field must be present and not zero.
- Extended L2 Entries. If this bit is set then L2 table entries use an extended format that allows subcluster-based allocation. See the Extended L2 Entries section for more details.
Bits 5-63 are reserved (set to 0).
compatible_features: u64
Bitmask of compatible features. An implementation can safely ignore any unknown bits that are set.
- Lazy refcounts bit. If this bit is set then lazy refcount updates can be used. This means marking the image file dirty and postponing refcount metadata updates.
Bits 1-63 are reserved (set to 0).
autoclear_features: u64
Bitmask of auto-clear features. An implementation may only write to an image with unknown auto-clear features if it clears the respective bits from this field first.
- Bitmaps extension bit. This bit indicates consistency for the bitmaps extension data. It is an error if this bit is set without the bitmaps extension present. If the bitmaps extension is present but this bit is unset, the bitmaps extension data must be considered inconsistent.
- Raw external data bit. If this bit is set, the external data file can be read as a consistent standalone raw image without looking at the qcow2 metadata. Setting this bit has a performance impact for some operations on the image (e.g. writing zeros requires writing to the data file instead of only setting the zero flag in the L2 table entry) and conflicts with backing files. This bit may only be set if the External Data File bit (incompatible feature bit 1) is also set.
Bits 2-63 are reserved (set to 0).
refcount_order: u32
Describes the width of a reference count block entry (width in bits: refcount_bits = 1 << refcount_order
). For version 2 images, the order is always assumed to be 4 (i.e.
refcount_bits = 16
). This value may not exceed 6 (i.e. refcount_bits = 64
).
header_length: u32
Length of the header structure in bytes. For version 2 images, the length is always assumed to be 72 bytes. For version 3 it’s at least 104 bytes and must be a multiple of 8.