]> git.proxmox.com Git - mirror_qemu.git/commit
block/file-posix: Generalize raw_regular_truncate
authorMax Reitz <mreitz@redhat.com>
Tue, 13 Jun 2017 20:20:58 +0000 (22:20 +0200)
committerMax Reitz <mreitz@redhat.com>
Tue, 11 Jul 2017 15:45:01 +0000 (17:45 +0200)
commitd0bc9e5d5e86d5dd566e2d967af8476cee351c93
tree75c91a5e626e33e7273bfead569e9adf13ec1686
parent9f63b07ee7feefd5f5a1175614b6948264e9d7e0
block/file-posix: Generalize raw_regular_truncate

Currently, raw_regular_truncate() is intended for setting the size of a
newly created file. However, we also want to use it for truncating an
existing file in which case only the newly added space (when growing)
should be preallocated.

This also means that if resizing failed, we should try to restore the
original file size. This is important when using preallocation.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20170613202107.10125-8-mreitz@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/file-posix.c