• M
    block/qcow2: Generalize preallocate() · 7bc45dc1
    Max Reitz 提交于
    This patch adds two new parameters to the preallocate() function so we
    will be able to use it not just for preallocating a new image but also
    for preallocated image growth.
    
    The offset parameter allows the caller to specify a virtual offset from
    which to start preallocating. For newly created images this is always 0,
    but for preallocating growth this will be the old image length.
    
    The new_length parameter specifies the supposed new length of the image
    (basically the "end offset" for preallocation). During image truncation,
    bdrv_getlength() will return the old image length so we cannot rely on
    its return value then.
    Signed-off-by: NMax Reitz <mreitz@redhat.com>
    Reviewed-by: NEric Blake <eblake@redhat.com>
    Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
    Message-id: 20170613202107.10125-10-mreitz@redhat.com
    Signed-off-by: NMax Reitz <mreitz@redhat.com>
    7bc45dc1
qcow2.c 136.5 KB