aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2017-08-04 18:10:13 +0300
committerKevin Wolf <kwolf@redhat.com>2017-08-08 15:19:16 +0200
commite5e6268348972aaf415d7931bbd808b3fdba6cb1 (patch)
treeb16ad4431a5205398cdd584a213282590e764668
parentd8b83e37c381cf86ecd907301b7dcc65baaa0aea (diff)
downloadqemu-e5e6268348972aaf415d7931bbd808b3fdba6cb1.zip
qemu-e5e6268348972aaf415d7931bbd808b3fdba6cb1.tar.gz
qemu-e5e6268348972aaf415d7931bbd808b3fdba6cb1.tar.bz2
parallels: drop check that bdrv_truncate() is working
This would be actually strange and error prone. If truncate() nowadays will fail, there is something fatally wrong. Let's check for that during the actual work. The only fallback case is when the file is not zero initialized. In this case we should switch to preallocation via fallocate(). Signed-off-by: Denis V. Lunev <den@openvz.org> CC: Markus Armbruster <armbru@redhat.com> CC: Kevin Wolf <kwolf@redhat.com> CC: Max Reitz <mreitz@redhat.com> CC: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--block/parallels.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/block/parallels.c b/block/parallels.c
index 6794e53..e1e06d2 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -703,9 +703,7 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags,
goto fail_options;
}
- if (!(flags & BDRV_O_RESIZE) || !bdrv_has_zero_init(bs->file->bs) ||
- bdrv_truncate(bs->file, bdrv_getlength(bs->file->bs),
- PREALLOC_MODE_OFF, NULL) != 0) {
+ if (!bdrv_has_zero_init(bs->file->bs)) {
s->prealloc_mode = PRL_PREALLOC_MODE_FALLOCATE;
}