Am 31.10.2018 um 22:56 hat Kevin Wolf geschrieben:
> aio_worker() for reads and writes isn't boring enough yet. It still does
> some postprocessing for handling short reads and turning the result into
> the right return value.
> 
> However, there is no reason why handle_aiocb_rw() couldn't do the same,
> and even without duplicating code between the read and write path. So
> move the code there.
> 
> Signed-off-by: Kevin Wolf <kw...@redhat.com>

> @@ -1354,7 +1356,21 @@ static ssize_t handle_aiocb_rw(RawPosixAIOData *aiocb)
>      }
>      qemu_vfree(buf);
>  
> -    return nbytes;
> +out:
> +    if (nbytes == aiocb->aio_nbytes) {
> +        return 0;
> +    } else if (nbytes >= 0 && nbytes < aiocb->aio_nbytes) {
> +        if (aiocb->aio_type & QEMU_AIO_WRITE) {
> +            return -EINVAL;
> +        } else {
> +            iov_memset(aiocb->io.iov, aiocb->io.niov, nbytes,
> +                      0, aiocb->aio_nbytes - nbytes);
> +            return aiocb->aio_nbytes;

While reviewing Eric's patches, I noticed that this should be return 0.
Fixing it in my queue.

Kevin

Reply via email to