qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 2/8] block-backend: Introduce blk_get_guest_block_size()


From: Stefan Hajnoczi
Subject: Re: [PATCH v5 2/8] block-backend: Introduce blk_get_guest_block_size()
Date: Wed, 18 May 2022 14:16:51 +0100

On Wed, May 04, 2022 at 03:40:45PM +0800, Xie Yongji wrote:
> Support getting the guest block size for the block backend.
> It's needed for the following commit.
> 
> Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
> ---
>  block/block-backend.c             | 6 ++++++
>  include/sysemu/block-backend-io.h | 1 +
>  2 files changed, 7 insertions(+)
> 
> diff --git a/block/block-backend.c b/block/block-backend.c
> index 35457a6a1d..1582ff81c9 100644
> --- a/block/block-backend.c
> +++ b/block/block-backend.c
> @@ -2106,6 +2106,12 @@ void blk_set_guest_block_size(BlockBackend *blk, int 
> align)
>      blk->guest_block_size = align;
>  }
>  
> +int blk_get_guest_block_size(BlockBackend *blk)
> +{
> +    IO_CODE();
> +    return blk->guest_block_size;

I have sent a patch to remove blk->guest_block_size because this field
is currently unused.

I think there is a cleaner way for this patch series to store the guest
logical_block_size (see next patch). Stashing it in BlockBackend was
attractive because virtio-blk-handler.c lacks a struct to store its
parameters (writable, serial, logical_block_size), but if such a struct
is introduced then there's no need to stash it in BlockBackend.

Stefan

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]