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

2014-07-04 Thread Ming Lei
On Fri, Jul 4, 2014 at 5:18 PM, Ming Lei wrote: >> >> This leaks requests when ret < len. I think the loop below should be >> used in that case to fail unsubmitted requests with -EIO. > > I thought about the problem before, but looks it may not return 'ret' > which is less than > len, follows the

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

2014-07-04 Thread Ming Lei
Hi Stefan, Sorry for missing your comments. On Thu, Jul 3, 2014 at 8:24 PM, Stefan Hajnoczi wrote: > On Wed, Jul 02, 2014 at 08:18:47PM +0800, Ming Lei wrote: >> @@ -36,9 +38,19 @@ struct qemu_laiocb { >> QLIST_ENTRY(qemu_laiocb) node; >> }; >> >> +struct laio_queue { > > This file doesn't

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

2014-07-03 Thread Stefan Hajnoczi
On Wed, Jul 02, 2014 at 08:18:47PM +0800, Ming Lei wrote: > @@ -36,9 +38,19 @@ struct qemu_laiocb { > QLIST_ENTRY(qemu_laiocb) node; > }; > > +struct laio_queue { This file doesn't follow QEMU coding style for structs but normally this should be: typedef struct { ... } LaioQueue; Up t

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

2014-07-03 Thread Ming Lei
On Thu, Jul 3, 2014 at 6:50 PM, Paolo Bonzini wrote: > Il 03/07/2014 12:45, Ming Lei ha scritto: > >> I think it may be needed: >> >> - following requests coming inside handle_notify(): >> req0, req1, req2-flush, req3 >> - both req0 and req1 queued >> - start to handle req2-flush >> - bdr

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

2014-07-03 Thread Paolo Bonzini
Il 03/07/2014 12:45, Ming Lei ha scritto: I think it may be needed: - following requests coming inside handle_notify(): req0, req1, req2-flush, req3 - both req0 and req1 queued - start to handle req2-flush - bdrv_co_flush() calls bdrv_co_flush(bs->file), which finally call raw_aio_flush

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

2014-07-03 Thread Ming Lei
On Thu, Jul 3, 2014 at 6:04 PM, Paolo Bonzini wrote: > Il 03/07/2014 11:51, Ming Lei ha scritto: > >> +int laio_io_unplug(BlockDriverState *bs, void *aio_ctx, bool unplug) >> +{ >> +struct qemu_laio_state *s = aio_ctx; >> +int ret = 0; >> + >>> >>> > >>> > How abou

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

2014-07-03 Thread Kevin Wolf
Am 03.07.2014 um 12:24 hat Ming Lei geschrieben: > On Thu, Jul 3, 2014 at 6:22 PM, Kevin Wolf 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 wrote: > >> > Am 02.07.2014 um 14:18 hat Ming Lei geschrieben: > >> >> This

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

2014-07-03 Thread Ming Lei
On Thu, Jul 3, 2014 at 6:22 PM, Kevin Wolf 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 wrote: >> > Am 02.07.2014 um 14:18 hat Ming Lei geschrieben: >> >> This patch implements .bdrv_io_plug, .bdrv_io_unplug and >> >> .bdr

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

2014-07-03 Thread Kevin Wolf
Am 03.07.2014 um 11:51 hat Ming Lei geschrieben: > Hi Kevin, > > On Thu, Jul 3, 2014 at 5:40 PM, Kevin Wolf 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, >

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

2014-07-03 Thread Paolo Bonzini
Il 03/07/2014 11:51, Ming Lei ha scritto: >> +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 qu

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

2014-07-03 Thread Ming Lei
Hi Kevin, On Thu, Jul 3, 2014 at 5:40 PM, Kevin Wolf 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-

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

2014-07-03 Thread Kevin Wolf
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 Just a couple of minor comments

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

2014-07-02 Thread Ming Lei
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 --- block/linux-aio.c | 88 +++-- block/