On Wed, May 18, 2022 at 9:17 PM Stefan Hajnoczi <stefa...@redhat.com> wrote: > > 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 <xieyon...@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. >
OK. > 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. > Looks good to me. Thanks, Yongji