Skip to content
  • Vladimir Sementsov-Ogievskiy's avatar
    67c095c8
    block/io: fix bdrv_co_block_status_above · 67c095c8
    Vladimir Sementsov-Ogievskiy authored
    
    
    bdrv_co_block_status_above has several design problems with handling
    short backing files:
    
    1. With want_zeros=true, it may return ret with BDRV_BLOCK_ZERO but
    without BDRV_BLOCK_ALLOCATED flag, when actually short backing file
    which produces these after-EOF zeros is inside requested backing
    sequence.
    
    2. With want_zero=false, it may return pnum=0 prior to actual EOF,
    because of EOF of short backing file.
    
    Fix these things, making logic about short backing files clearer.
    
    With fixed bdrv_block_status_above we also have to improve is_zero in
    qcow2 code, otherwise iotest 154 will fail, because with this patch we
    stop to merge zeros of different types (produced by fully unallocated
    in the whole backing chain regions vs produced by short backing files).
    
    Note also, that this patch leaves for another day the general problem
    around block-status: misuse of BDRV_BLOCK_ALLOCATED as is-fs-allocated
    vs go-to-backing.
    
    Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
    Reviewed-by: default avatarAlberto Garcia <berto@igalia.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Message-id: 20200924194003.22080-2-vsementsov@virtuozzo.com
    [Fix s/comes/come/ as suggested by Eric Blake
    --Stefan]
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    67c095c8
    block/io: fix bdrv_co_block_status_above
    Vladimir Sementsov-Ogievskiy authored
    
    
    bdrv_co_block_status_above has several design problems with handling
    short backing files:
    
    1. With want_zeros=true, it may return ret with BDRV_BLOCK_ZERO but
    without BDRV_BLOCK_ALLOCATED flag, when actually short backing file
    which produces these after-EOF zeros is inside requested backing
    sequence.
    
    2. With want_zero=false, it may return pnum=0 prior to actual EOF,
    because of EOF of short backing file.
    
    Fix these things, making logic about short backing files clearer.
    
    With fixed bdrv_block_status_above we also have to improve is_zero in
    qcow2 code, otherwise iotest 154 will fail, because with this patch we
    stop to merge zeros of different types (produced by fully unallocated
    in the whole backing chain regions vs produced by short backing files).
    
    Note also, that this patch leaves for another day the general problem
    around block-status: misuse of BDRV_BLOCK_ALLOCATED as is-fs-allocated
    vs go-to-backing.
    
    Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
    Reviewed-by: default avatarAlberto Garcia <berto@igalia.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Message-id: 20200924194003.22080-2-vsementsov@virtuozzo.com
    [Fix s/comes/come/ as suggested by Eric Blake
    --Stefan]
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
Loading