Skip to content
Snippets Groups Projects
  • Hanna Reitz's avatar
    cdf3bc93
    mirror: Fix bdrv_has_zero_init() use · cdf3bc93
    Hanna Reitz authored
    
    bdrv_has_zero_init() only has meaning for newly created images or image
    areas.  If the mirror job itself did not create the image, it cannot
    rely on bdrv_has_zero_init()'s result to carry any meaning.
    
    This is the case for drive-mirror with mode=existing and always for
    blockdev-mirror.
    
    Note that we only have to zero-initialize the target with sync=full,
    because other modes actually do not promise that the target will contain
    the same data as the source after the job -- sync=top only promises to
    copy anything allocated in the top layer, and sync=none will only copy
    new I/O.  (Which is how mirror has always handled it.)
    
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
    Message-id: 20190724171239.8764-3-mreitz@redhat.com
    Reviewed-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
    cdf3bc93
    History
    mirror: Fix bdrv_has_zero_init() use
    Hanna Reitz authored
    
    bdrv_has_zero_init() only has meaning for newly created images or image
    areas.  If the mirror job itself did not create the image, it cannot
    rely on bdrv_has_zero_init()'s result to carry any meaning.
    
    This is the case for drive-mirror with mode=existing and always for
    blockdev-mirror.
    
    Note that we only have to zero-initialize the target with sync=full,
    because other modes actually do not promise that the target will contain
    the same data as the source after the job -- sync=top only promises to
    copy anything allocated in the top layer, and sync=none will only copy
    new I/O.  (Which is how mirror has always handled it.)
    
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
    Message-id: 20190724171239.8764-3-mreitz@redhat.com
    Reviewed-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
blockdev.c 138.80 KiB