[Qemu-devel] [PATCH 2/8] block/cor: Drop cor_co_truncate()

Max Reitz posted 8 patches 6 years, 1 month ago
Maintainers: "Denis V. Lunev" <den@openvz.org>, Stefan Hajnoczi <stefanha@redhat.com>, Kevin Wolf <kwolf@redhat.com>, John Snow <jsnow@redhat.com>, Fam Zheng <fam@euphon.net>, Max Reitz <mreitz@redhat.com>, Peter Lieven <pl@kamp.de>, Markus Armbruster <armbru@redhat.com>, Ronnie Sahlberg <ronniesahlberg@gmail.com>, Paolo Bonzini <pbonzini@redhat.com>, Jeff Cody <codyprime@gmail.com>, "Richard W.M. Jones" <rjones@redhat.com>, Jason Dillaman <dillaman@redhat.com>, Liu Yuan <namei.unix@gmail.com>, Stefan Weil <sw@weilnetz.de>
[Qemu-devel] [PATCH 2/8] block/cor: Drop cor_co_truncate()
Posted by Max Reitz 6 years, 1 month ago
No other filter driver has a .bdrv_co_truncate() implementation, and
there is no need to because the general block layer code can handle it
just as well.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 block/copy-on-read.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/block/copy-on-read.c b/block/copy-on-read.c
index 6631f30205..e95223d3cb 100644
--- a/block/copy-on-read.c
+++ b/block/copy-on-read.c
@@ -73,13 +73,6 @@ static int64_t cor_getlength(BlockDriverState *bs)
 }
 
 
-static int coroutine_fn cor_co_truncate(BlockDriverState *bs, int64_t offset,
-                                        PreallocMode prealloc, Error **errp)
-{
-    return bdrv_co_truncate(bs->file, offset, prealloc, errp);
-}
-
-
 static int coroutine_fn cor_co_preadv(BlockDriverState *bs,
                                       uint64_t offset, uint64_t bytes,
                                       QEMUIOVector *qiov, int flags)
@@ -139,7 +132,6 @@ static BlockDriver bdrv_copy_on_read = {
     .bdrv_child_perm                    = cor_child_perm,
 
     .bdrv_getlength                     = cor_getlength,
-    .bdrv_co_truncate                   = cor_co_truncate,
 
     .bdrv_co_preadv                     = cor_co_preadv,
     .bdrv_co_pwritev                    = cor_co_pwritev,
-- 
2.21.0


Re: [Qemu-devel] [PATCH 2/8] block/cor: Drop cor_co_truncate()
Posted by Maxim Levitsky 6 years, 1 month ago
On Wed, 2019-09-18 at 11:51 +0200, Max Reitz wrote:
> No other filter driver has a .bdrv_co_truncate() implementation, and
> there is no need to because the general block layer code can handle it
> just as well.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  block/copy-on-read.c | 8 --------
>  1 file changed, 8 deletions(-)
> 
> diff --git a/block/copy-on-read.c b/block/copy-on-read.c
> index 6631f30205..e95223d3cb 100644
> --- a/block/copy-on-read.c
> +++ b/block/copy-on-read.c
> @@ -73,13 +73,6 @@ static int64_t cor_getlength(BlockDriverState *bs)
>  }
>  
>  
> -static int coroutine_fn cor_co_truncate(BlockDriverState *bs, int64_t offset,
> -                                        PreallocMode prealloc, Error **errp)
> -{
> -    return bdrv_co_truncate(bs->file, offset, prealloc, errp);
> -}
> -
> -
>  static int coroutine_fn cor_co_preadv(BlockDriverState *bs,
>                                        uint64_t offset, uint64_t bytes,
>                                        QEMUIOVector *qiov, int flags)
> @@ -139,7 +132,6 @@ static BlockDriver bdrv_copy_on_read = {
>      .bdrv_child_perm                    = cor_child_perm,
>  
>      .bdrv_getlength                     = cor_getlength,
> -    .bdrv_co_truncate                   = cor_co_truncate,
>  
>      .bdrv_co_preadv                     = cor_co_preadv,
>      .bdrv_co_pwritev                    = cor_co_pwritev,
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
	Maxim Levitsky