[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: |
Dr. David Alan Gilbert |
Subject: |
Re: [Qemu-devel] [PATCH v2 2/5] virtio-blk: add "discard-wzeroes" boolean property |
Date: |
Thu, 31 Jan 2019 15:59:17 +0000 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
* Stefano Garzarella (address@hidden) 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.
Oh odd, I don't see why it's done like that - unless that's visible to
the guest somehow directly. The _BIT version is more commonly used
when you have a flag word that's got multiple bits defined in it.
> But I agree with you, DEFINE_PROP_BOOL should be better, so I will change it!
Thanks!
Dave
> Thanks,
> Stefano
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK
[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