]> xenbits.xensource.com Git - libvirt.git/commit
storage: fix file allocation behavior in file cloning
authorOskari Saarenmaa <os@ohmu.fi>
Mon, 30 Sep 2013 16:57:35 +0000 (19:57 +0300)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 4 Oct 2013 14:18:44 +0000 (16:18 +0200)
commit532fef369fffdad6b158a720e248ed21cef20478
tree84c886596d34b25567e9793e584003d1ff53ac20
parentb63a1d0e95c7d2fa46906777908ae5a1ccc4af97
storage: fix file allocation behavior in file cloning

Fixed the safezero call for allocating the rest of the file after cloning
an existing volume; it used to always use a zero offset, causing it to
only allocate the beginning of the file.

Also modified file creation to try to use fallocate(2) to pre-allocate
disk space before copying any data to make sure it fails early on if disk
is full and makes sure we can skip zero blocks when copying file contents.

If fallocate isn't available we will zero out the rest of the file after
cloning and only use sparse cloning if client requested a lower allocation
than the input volume's capacity.

Signed-off-by: Oskari Saarenmaa <os@ohmu.fi>
configure.ac
src/storage/storage_backend.c