[libvirt] [PATCH] storage: fix file allocation behavior in file cloning

Michal Privoznik mprivozn at redhat.com
Fri Oct 4 14:45:35 UTC 2013


On 30.09.2013 18:57, Oskari Saarenmaa wrote:
> 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 at ohmu.fi>
> ---
>  the safezero mmap issue fixed in my previous patch never showed up because
>  all safezero calls previously had 0 offset (or maybe everyone's using
>  posix_fallocate)
> 
>  configure.ac                  |  8 ++++----
>  src/storage/storage_backend.c | 35 ++++++++++++++++++++++++++++++-----
>  2 files changed, 34 insertions(+), 9 deletions(-)

ACKed and pushed.

Michal




More information about the libvir-list mailing list