• E
    qcow2: Catch more unaligned write_zero into zero cluster · ebb718a5
    Eric Blake 提交于
    is_zero_cluster() and is_zero_cluster_top_locked() are used only
    by qcow2_co_write_zeroes().  The former is too broad (we don't
    care if the sectors we are about to overwrite are non-zero, only
    that all other sectors in the cluster are zero), so it needs to
    be called up to twice but with smaller limits - rename it along
    with adding the neeeded parameter.  The latter can be inlined for
    more compact code.
    
    The testsuite change shows that we now have a sparser top file
    when an unaligned write_zeroes overwrites the only portion of
    the backing file with data.
    
    Based on a patch proposal by Denis V. Lunev.
    
    CC: Denis V. Lunev <den@openvz.org>
    Signed-off-by: NEric Blake <eblake@redhat.com>
    Reviewed-by: NDenis V. Lunev <den@openvz.org>
    Signed-off-by: NKevin Wolf <kwolf@redhat.com>
    ebb718a5
qcow2.c 109.6 KB