• E
    qemu-img: Add find_nonzero() · debb38a4
    Eric Blake 提交于
    During 'qemu-img compare', when we are checking that an allocated
    portion of one file is all zeros, we don't need to waste time
    computing how many additional sectors after the first non-zero
    byte are also non-zero.  Create a new helper find_nonzero() to do
    the check for a first non-zero sector, and rebase
    check_empty_sectors() to use it.
    
    The new interface intentionally uses bytes in its interface, even
    though it still crawls the buffer a sector at a time; it is robust
    to a partial sector at the end of the buffer.
    Signed-off-by: NEric Blake <eblake@redhat.com>
    Reviewed-by: NJohn Snow <jsnow@redhat.com>
    Signed-off-by: NKevin Wolf <kwolf@redhat.com>
    debb38a4
qemu-img.c 140.1 KB