Skip to content
Snippets Groups Projects
  • Alberto Garcia's avatar
    ef9bba14
    quorum: Implement bdrv_co_block_status() · ef9bba14
    Alberto Garcia authored
    
    The quorum driver does not implement bdrv_co_block_status() and
    because of that it always reports to contain data even if all its
    children are known to be empty.
    
    One consequence of this is that if we for example create a quorum with
    a size of 10GB and we mirror it to a new image the operation will
    write 10GB of actual zeroes to the destination image wasting a lot of
    time and disk space.
    
    Since a quorum has an arbitrary number of children of potentially
    different formats there is no way to report all possible allocation
    status flags in a way that makes sense, so this implementation only
    reports when a given region is known to contain zeroes
    (BDRV_BLOCK_ZERO) or not (BDRV_BLOCK_DATA).
    
    If all children agree that a region contains zeroes then we can return
    BDRV_BLOCK_ZERO using the smallest size reported by the children
    (because all agree that a region of at least that size contains
    zeroes).
    
    If at least one child disagrees we have to return BDRV_BLOCK_DATA.
    In this case we use the largest of the sizes reported by the children
    that didn't return BDRV_BLOCK_ZERO (because we know that there won't
    be an agreement for at least that size).
    
    Signed-off-by: default avatarAlberto Garcia <berto@igalia.com>
    Tested-by: default avatarTao Xu <tao3.xu@intel.com>
    Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
    Message-Id: <db83149afcf0f793effc8878089d29af4c46ffe1.1605286097.git.berto@igalia.com>
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
    ef9bba14
    History
    quorum: Implement bdrv_co_block_status()
    Alberto Garcia authored
    
    The quorum driver does not implement bdrv_co_block_status() and
    because of that it always reports to contain data even if all its
    children are known to be empty.
    
    One consequence of this is that if we for example create a quorum with
    a size of 10GB and we mirror it to a new image the operation will
    write 10GB of actual zeroes to the destination image wasting a lot of
    time and disk space.
    
    Since a quorum has an arbitrary number of children of potentially
    different formats there is no way to report all possible allocation
    status flags in a way that makes sense, so this implementation only
    reports when a given region is known to contain zeroes
    (BDRV_BLOCK_ZERO) or not (BDRV_BLOCK_DATA).
    
    If all children agree that a region contains zeroes then we can return
    BDRV_BLOCK_ZERO using the smallest size reported by the children
    (because all agree that a region of at least that size contains
    zeroes).
    
    If at least one child disagrees we have to return BDRV_BLOCK_DATA.
    In this case we use the largest of the sizes reported by the children
    that didn't return BDRV_BLOCK_ZERO (because we know that there won't
    be an agreement for at least that size).
    
    Signed-off-by: default avatarAlberto Garcia <berto@igalia.com>
    Tested-by: default avatarTao Xu <tao3.xu@intel.com>
    Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
    Message-Id: <db83149afcf0f793effc8878089d29af4c46ffe1.1605286097.git.berto@igalia.com>
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>