[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 2/5] virtio-blk: add "discard-wzeroes" boolea
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PATCH v2 2/5] virtio-blk: add "discard-wzeroes" boolean property |
Date: |
Thu, 31 Jan 2019 11:43:07 -0500 |
On Thu, Jan 31, 2019 at 04:50:46PM +0100, Stefano Garzarella wrote:
> On Thu, Jan 31, 2019 at 03:40:38PM +0000, Dr. David Alan Gilbert wrote:
> > * Stefano Garzarella (address@hidden) wrote:
> > > In order to avoid migration issues, we enable DISCARD and
> > > WRITE ZEROES features only for machine type >= 4.0
> > >
> > > Suggested-by: Dr. David Alan Gilbert <address@hidden>
> > > Signed-off-by: Stefano Garzarella <address@hidden>
> > > ---
> > > hw/block/virtio-blk.c | 2 ++
> > > hw/core/machine.c | 1 +
> > > include/hw/virtio/virtio-blk.h | 1 +
> > > 3 files changed, 4 insertions(+)
> > >
> > > diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
> > > index 8a6754d9a2..542ec52536 100644
> > > --- a/hw/block/virtio-blk.c
> > > +++ b/hw/block/virtio-blk.c
> > > @@ -1026,6 +1026,8 @@ static Property virtio_blk_properties[] = {
> > > DEFINE_PROP_UINT16("queue-size", VirtIOBlock, conf.queue_size, 128),
> > > DEFINE_PROP_LINK("iothread", VirtIOBlock, conf.iothread,
> > > TYPE_IOTHREAD,
> > > IOThread *),
> > > + DEFINE_PROP_BIT("discard-wzeroes", VirtIOBlock,
> > > conf.discard_wzeroes, 0,
> > > + true),
> >
> > I think that's OK, but do you really want a DEFINE_PROP_BOOL and
> > a bool discard_wzeroes?
> > I think DEFINE_PROP_BIT is mostly used for a flag word where each
> > property is one more bit in the field.
> >
> > Dave
> >
>
> Hi Dave,
> I was in doubt if to use DEFINE_PROP_BIT or DEFINE_PROP_BOOL, but
> looking in the virtio-blk.c, I found that also other boolean like
> "config-wce", "scsi", and "request-merging" was defined with
> DEFINE_PROP_BIT, so I followed this trand.
>
> But I agree with you, DEFINE_PROP_BOOL should be better, so I will change it!
>
> Thanks,
> Stefano
I wonder why doesn't virtio-blk set bits directly in host_features?
For example this is how virtio-net does it.
This would remove the need for virtio_add_feature calls.
--
MST
[Qemu-devel] [PATCH v2 1/5] virtio-blk: add acct_failed param to virtio_blk_handle_rw_error(), Stefano Garzarella, 2019/01/31
[Qemu-devel] [PATCH v2 3/5] virtio-blk: add DISCARD and WRITE ZEROES features, Stefano Garzarella, 2019/01/31
Re: [Qemu-devel] [PATCH v2 3/5] virtio-blk: add DISCARD and WRITE ZEROES features, Stefan Hajnoczi, 2019/01/31
[Qemu-devel] [PATCH v2 4/5] tests/virtio-blk: change assert on data_size in virtio_blk_request(), Stefano Garzarella, 2019/01/31
[Qemu-devel] [PATCH v2 5/5] tests/virtio-blk: add test for WRITE_ZEROES command, Stefano Garzarella, 2019/01/31