On 29/06/20 12:39, Stefan Hajnoczi wrote: >> I don't know which one in BDRV_BLOCK_* can be used to represent 'anchored'. >> It seems that I need to use BDRV_BLOCK_* combination to recognized >> 'anchored', >> >> I'd like to use these combinations to analyze the bdrv_block_status() return >> value: >> 'deallocated': BDRV_BLOCK_ALLOCATED | BDRV_BLOCK_OFFSET_VALID | >> BDRV_BLOCK_ZERO >> 'anchored': BDRV_BLOCK_ALLOCATED | BDRV_BLOCK_OFFSET_VALID | ! >> BDRV_BLOCK_ZERO | ! BDRV_BLOCK_DATA >> Am I right? > My understanding is that the SCSI status are mapped to QEMU block status > as follows: > > allocated: BDRV_BLOCK_DATA | !BDRV_BLOCK_ZERO | BDRV_BLOCK_OFFSET_VALID > anchored: BDRV_BLOCK_DATA | BDRV_BLOCK_ZERO | BDRV_BLOCK_OFFSET_VALID > deallocated: !BDRV_BLOCK_DATA
I agree except that I wouldn't test BDRV_BLOCK_OFFSET_VALID. For example a compressed cluster would still be reported as allocated even if BDRV_BLOCK_OFFSET_VALID is cleared. Paolo