qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v4 2/3] linux-aio: implement io plug, unplug and


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH v4 2/3] linux-aio: implement io plug, unplug and flush io queue
Date: Thu, 3 Jul 2014 12:30:12 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Am 03.07.2014 um 12:24 hat Ming Lei geschrieben:
> On Thu, Jul 3, 2014 at 6:22 PM, Kevin Wolf <address@hidden> wrote:
> > Am 03.07.2014 um 11:51 hat Ming Lei geschrieben:
> >> Hi Kevin,
> >>
> >> On Thu, Jul 3, 2014 at 5:40 PM, Kevin Wolf <address@hidden> wrote:
> >> > Am 02.07.2014 um 14:18 hat Ming Lei geschrieben:
> >> >> This patch implements .bdrv_io_plug, .bdrv_io_unplug and
> >> >> .bdrv_flush_io_queue callbacks for linux-aio Block Drivers,
> >> >> so that submitting I/O as a batch can be supported on linux-aio.
> >> >>
> >> >> Signed-off-by: Ming Lei <address@hidden>
> >> >
> >> > Just a couple of minor comments, see inline.
> >>
> >> Thanks for your review.
> >>
> >> >> +void laio_io_plug(BlockDriverState *bs, void *aio_ctx)
> >> >> +{
> >> >> +    struct qemu_laio_state *s = aio_ctx;
> >> >> +
> >> >> +    s->io_q.plugged++;
> >> >> +}
> >> >> +
> >> >> +int laio_io_unplug(BlockDriverState *bs, void *aio_ctx, bool unplug)
> >> >> +{
> >> >> +    struct qemu_laio_state *s = aio_ctx;
> >> >> +    int ret = 0;
> >> >> +
> >> >
> >> > How about an assert(s->io_q.plugged > 0); here?
> >>
> >> how about just adding a warning because flush io queue uses
> >> the function too?
> >
> > Good point, this is what the assertion should look like then:
> >
> >     assert(s->io_q.plugged > 0 || !unplug);
> 
> OK, will do it.
> 
> >> Also that is why 'plugged' is defined as signed.
> >
> > I don't understand. The flush function leaves s->io_q.plugged alone
> > (otherwise it would be buggy), so how can it ever become negative? And
> > if you say that a negative value is valid, what would it even mean?
> 
> I mean it is easy to detect bug with negative value, :-)

Ah, I see. That makes some sense then. :-)

Kevin



reply via email to

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