On 01/12/2014 10:04, Ming Lei wrote: > The 1st patch fixes batch submission. > > The 2nd one fixes -EAGAIN for non-batch case. > > The 3rd one is a cleanup. > > This patchset is splitted from previous patchset(dataplane: optimization > and multi virtqueue support), as suggested by Stefan.
I think this series needs a rewrite. Instead of removing 'node' from 'struct qemu_laiocb', each LaioQueue should actually have a list (or SIMPLEQ) of pending 'struct qemu_laiocb'. Every time you do an io_submit, you copy from the laiocb queue to the iocbs array. If it returns N, the first N elements are removed from the list. There is no need to do a memmove, the iocbs will be populated again on the next io_submit. If io_submit fails with anything but EAGAIN, just abort(). It should never happen. Every time you get a request, and the list was empty, you do an io_submit. Every time you get a bdrv_unplug and the nesting level was 1, you do an io_submit. Every time you get a completion, if the pending queue is not empty, you do an io_submit. It should be _that_ simple. Paolo