2.5.1.1 Payload BAT Entry States

The payload BAT entry determines the state of a virtual block and the associated offset in the VHDX file of that block. The following table summarizes the validity of the various states for the three VHDX types.

Payload BAT Entry State

Fixed

Dynamic

Differencing

PAYLOAD_BLOCK_NOT_PRESENT

Valid<6>

Valid

Valid

PAYLOAD_BLOCK_UNDEFINED

Valid<7>

Valid

Valid

PAYLOAD_BLOCK_ZERO

Valid<8>

Valid

Valid

PAYLOAD_BLOCK_UNMAPPED

Valid<9>

Valid

Valid

PAYLOAD_BLOCK_FULLY_PRESENT

Valid

Valid

Valid

PAYLOAD_BLOCK_PARTIALLY_PRESENT

Not Valid

Not Valid

Valid

Values 4 and 5 are reserved.

The behavior for the various block states for fixed VHDX is the same as that of the associated dynamic VHDX block state:

 #define   PAYLOAD_BLOCK_NOT_PRESENT                0

This is the default state for all new blocks in dynamic and differencing VHDX types.

For fixed or dynamic VHDX files, this block state specifies that the block contents are undefined and can contain arbitrary data.

For reads from blocks in this state, implement one of the following behaviors:

  1. Return arbitrary data, including data that was previously present elsewhere on the disk.

  2. Return zero data.

  3. Return the contents of the block either immediately before it was moved to this state with no modifications or immediately before some parts of it were replaced with zeroes.

For a differencing VHDX file, this block state specifies that the block contents are not present in the file and that the parent virtual disk SHOULD be inspected to determine the associated contents.

The FileOffsetMB field for entries in this state is reserved:

 #define   PAYLOAD_BLOCK_UNDEFINED                  1

For all VHDX file types, this block state indicates that the block contents are not defined in the file and can contain arbitrary data, including data that was previously present elsewhere on the disk.

When a block entry is transitioned to this block state, implement one of the following options for the FileOffsetMB field:

  1. Leave the field unmodified.

  2. Set the field to zero value.

  3. Set the field to a nonzero value that MUST point to a location in the VHDX file that MUST contain the contents of the block immediately before it was moved to this state with no modifications or some parts of it replaced with zeros.

For reads from blocks in this state, implement one of the following behaviors:<10>

  1. Return arbitrary data, including data that was previously present elsewhere on the disk.

  2. Return zero data.

  3. Return the contents of the block immediately before it was moved to this state with no modifications or some parts of it replaced with zeroes:

     #define   PAYLOAD_BLOCK_ZERO                       2
    

This block state implies that the block contents are defined to be zero.

The FileOffsetMB field for entries in this state is reserved.

For reads from the blocks in this state, implementations MUST return zeros:

 #define   PAYLOAD_BLOCK_UNMAPPED                          3

For all VHDX file types, this block state indicates that all the virtual disk sectors in the payload block were issued an UNMAP command and that the contents of this block are no longer being relied upon by the application or the system using the virtual disk. The block contents are defined to be zero data or the contents of the block immediately before the block was moved to this state with no modifications or with some parts replaced with zeros.

When a block entry is transitioned to this block state, implement one of the following options for the FileOffsetMB field:

  1. Leave the field unmodified.

  2. Set the field to zero.

  3. Set the field to a nonzero value that MUST point to a location in the VHDX file that MUST contain the contents of the block immediately before the block was moved to this state, with no modifications or with some parts of it replaced with zeros.

For reads from blocks in this state, implement one of the following behaviors:<11>

  1. Return zero data.

  2. Return the contents of that the block immediately before it was moved to this state with no modifications or with some parts of it replaced with zeros:

     #define   PAYLOAD_BLOCK_FULLY_PRESENT              6
    

This is the default state for all blocks in a fixed VHDX type.

For all VHDX file types, the block's contents are defined in the file at the location specified by the FileOffsetMB field.

The FileOffsetMB field can be modified to point to a new nonzero value that contains the contents of that block.

For reads from the blocks in this state, parsers should return the block contents defined in the file at the location specified by the FileOffsetMB field. For differencing VHDX files, the sector bitmap MUST NOT be inspected, because the block is fully present in the VHDX file:

 #define   PAYLOAD_BLOCK_PARTIALLY_PRESENT          7

This block state MUST NOT be present in a block entry for a fixed or dynamic VHDX file.

For differencing VHDX files, the block's contents are defined in the file at the location specified by the FileOffsetMB field. When the block entry is in this state, the associated sector bitmap block MUST be already allocated and valid.

The FileOffsetMB field can be modified to point to a new nonzero value that contains the contents of that block.

For reads from the blocks in this state, return the block contents defined in the file at the location specified by the FileOffsetMB field, after the associated sector bitmap for that block is inspected, to check if the sector being read is present in the VHDX file. If not, the parent VHDX file needs to be inspected for that sector.