]> git.proxmox.com Git - mirror_qemu.git/commit
block/qcow2: Generalize preallocate()
authorMax Reitz <mreitz@redhat.com>
Tue, 13 Jun 2017 20:21:00 +0000 (22:21 +0200)
committerMax Reitz <mreitz@redhat.com>
Tue, 11 Jul 2017 15:45:02 +0000 (17:45 +0200)
commit7bc45dc17265772abe5dd1d4649c7bb42e1c6df1
tree20eb5257447445a6fa7cc1f445f1ff83619a12b1
parent35d72602ec5709b5078ff0e6361eee57fb652f98
block/qcow2: Generalize preallocate()

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: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20170613202107.10125-10-mreitz@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/qcow2.c