]> Git Repo - qemu.git/commitdiff
block: Use bdrv_has_zero_init_truncate()
authorMax Reitz <[email protected]>
Wed, 24 Jul 2019 17:12:33 +0000 (19:12 +0200)
committerMax Reitz <[email protected]>
Mon, 19 Aug 2019 15:13:26 +0000 (17:13 +0200)
vhdx and parallels call bdrv_has_zero_init() when they do not really
care about an image's post-create state but only about what happens when
you grow an image.  That is a bit ugly, and also overly safe when
growing preallocated images without preallocating the new areas.

Let them use bdrv_has_zero_init_truncate() instead.

Signed-off-by: Max Reitz <[email protected]>
Message-id: 20190724171239[email protected]
Reviewed-by: Maxim Levitsky <[email protected]>
Reviewed-by: Stefano Garzarella <[email protected]>
[mreitz: Added commit message]
Signed-off-by: Max Reitz <[email protected]>
block/parallels.c
block/vhdx.c

index 00fae125d14b09690149b31fa405c9d7fb51c184..7cd2714b69f567c3f2393d03ebae772dbe15901f 100644 (file)
@@ -835,7 +835,7 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags,
         goto fail_options;
     }
 
-    if (!bdrv_has_zero_init(bs->file->bs)) {
+    if (!bdrv_has_zero_init_truncate(bs->file->bs)) {
         s->prealloc_mode = PRL_PREALLOC_MODE_FALLOCATE;
     }
 
index d6070b6fa8121810e44f96845c10055c334ed31a..a02d1c99a76c192f964fc9600cc4457da6fa3def 100644 (file)
@@ -1282,7 +1282,7 @@ static coroutine_fn int vhdx_co_writev(BlockDriverState *bs, int64_t sector_num,
                 /* Queue another write of zero buffers if the underlying file
                  * does not zero-fill on file extension */
 
-                if (bdrv_has_zero_init(bs->file->bs) == 0) {
+                if (bdrv_has_zero_init_truncate(bs->file->bs) == 0) {
                     use_zero_buffers = true;
 
                     /* zero fill the front, if any */
This page took 0.024854 seconds and 4 git commands to generate.