[Qemu-devel] [PATCH v2 05/11] block: Use bdrv_has_zero_init_truncate()

Max Reitz posted 11 patches 6 years, 6 months ago
Maintainers: "Denis V. Lunev" <den@openvz.org>, Kevin Wolf <kwolf@redhat.com>, Peter Lieven <pl@kamp.de>, Jeff Cody <codyprime@gmail.com>, Stefan Weil <sw@weilnetz.de>, Max Reitz <mreitz@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, John Snow <jsnow@redhat.com>, Markus Armbruster <armbru@redhat.com>, Jason Dillaman <dillaman@redhat.com>, "Richard W.M. Jones" <rjones@redhat.com>, Liu Yuan <namei.unix@gmail.com>
[Qemu-devel] [PATCH v2 05/11] block: Use bdrv_has_zero_init_truncate()
Posted by Max Reitz 6 years, 6 months ago
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 block/parallels.c | 2 +-
 block/vhdx.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/parallels.c b/block/parallels.c
index 00fae125d1..7cd2714b69 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -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;
     }
 
diff --git a/block/vhdx.c b/block/vhdx.c
index d6070b6fa8..a02d1c99a7 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -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 */
-- 
2.21.0


Re: [Qemu-devel] [PATCH v2 05/11] block: Use bdrv_has_zero_init_truncate()
Posted by Maxim Levitsky 6 years, 6 months ago
On Wed, 2019-07-24 at 19:12 +0200, Max Reitz wrote:
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  block/parallels.c | 2 +-
>  block/vhdx.c      | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/block/parallels.c b/block/parallels.c
> index 00fae125d1..7cd2714b69 100644
> --- a/block/parallels.c
> +++ b/block/parallels.c
> @@ -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;
>      }
>  
> diff --git a/block/vhdx.c b/block/vhdx.c
> index d6070b6fa8..a02d1c99a7 100644
> --- a/block/vhdx.c
> +++ b/block/vhdx.c
> @@ -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 */

Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Best regards,
	Maxim Levitsky


Re: [Qemu-devel] [PATCH v2 05/11] block: Use bdrv_has_zero_init_truncate()
Posted by Stefano Garzarella 6 years, 6 months ago
On Wed, Jul 24, 2019 at 07:12:33PM +0200, Max Reitz wrote:
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  block/parallels.c | 2 +-
>  block/vhdx.c      | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/block/parallels.c b/block/parallels.c
> index 00fae125d1..7cd2714b69 100644
> --- a/block/parallels.c
> +++ b/block/parallels.c
> @@ -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;
>      }
>  
> diff --git a/block/vhdx.c b/block/vhdx.c
> index d6070b6fa8..a02d1c99a7 100644
> --- a/block/vhdx.c
> +++ b/block/vhdx.c
> @@ -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 */
> -- 
> 2.21.0
> 

What about describing in the commit message why we are using
bdrv_has_zero_init_truncate() like in the cover letter?

With or without:
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>

Thanks,
Stefano

Re: [Qemu-devel] [PATCH v2 05/11] block: Use bdrv_has_zero_init_truncate()
Posted by Max Reitz 6 years, 6 months ago
On 26.07.19 11:43, Stefano Garzarella wrote:
> On Wed, Jul 24, 2019 at 07:12:33PM +0200, Max Reitz wrote:
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>> ---
>>  block/parallels.c | 2 +-
>>  block/vhdx.c      | 2 +-
>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/block/parallels.c b/block/parallels.c
>> index 00fae125d1..7cd2714b69 100644
>> --- a/block/parallels.c
>> +++ b/block/parallels.c
>> @@ -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;
>>      }
>>  
>> diff --git a/block/vhdx.c b/block/vhdx.c
>> index d6070b6fa8..a02d1c99a7 100644
>> --- a/block/vhdx.c
>> +++ b/block/vhdx.c
>> @@ -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 */
>> -- 
>> 2.21.0
>>
> 
> What about describing in the commit message why we are using
> bdrv_has_zero_init_truncate() like in the cover letter?

Sure.  (Not sure why I didn’t do it in the first place.)

> With or without:
> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>

Thanks for reviewing!

Max