PRL_PREALLOC_MODE_TRUNCATE can be set only through command line. Remove
the check that bdrv_truncate() is working on, this is almost always the
case, while the check could lead to serious consequences during migration
etc when we should not even try to API which technically could change the
image (asserts are possible).

Let us keep this simple.

Signed-off-by: Denis V. Lunev <[email protected]>
CC: Stefan Hajnoczi <[email protected]>
---
 block/parallels.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/block/parallels.c b/block/parallels.c
index 9dea09e..e805034 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -695,8 +695,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)) != 0) {
+    if (!bdrv_has_zero_init(bs->file->bs) != 0) {
         s->prealloc_mode = PRL_PREALLOC_MODE_FALLOCATE;
     }
 
-- 
2.7.4


Reply via email to