From: Jens Axboe Date: Wed, 14 Mar 2007 13:14:48 +0000 (+0100) Subject: posixaio engine: better handling of partial completions X-Git-Tag: fio-1.14a~3 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=3f344316b3200143f413c9a4a8fd6476ca5899cf;hp=b6b37d7f60e29fbccc9a03dafac04645579f80b9;ds=sidebyside posixaio engine: better handling of partial completions Signed-off-by: Jens Axboe --- diff --git a/engines/posixaio.c b/engines/posixaio.c index 7d9aaaf1..88dc0e90 100644 --- a/engines/posixaio.c +++ b/engines/posixaio.c @@ -98,18 +98,20 @@ restart: continue; err = aio_error(&io_u->aiocb); - switch (err) { - default: - io_u->error = err; - case ECANCELED: - io_u->resid = io_u->xfer_buflen; - case 0: - pd->aio_events[r++] = io_u; - io_u->seen = 1; - break; - case EINPROGRESS: - break; - } + if (err == EINPROGRESS) + continue; + + io_u->seen = 1; + pd->aio_events[r++] = io_u; + + if (err == ECANCELED) + io_u->resid = io_u->xfer_buflen; + else if (!err) { + ssize_t retval = aio_return(&io_u->aiocb); + + io_u->resid = io_u->xfer_buflen - retval; + } else + io_u->error = err; if (r >= max) break;