#include <assert.h>
#include "../fio.h"
-#include "../os.h"
#ifdef FIO_HAVE_POSIXAIO
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;
struct aiocb *aiocb = &io_u->aiocb;
int ret;
+ fio_ro_check(td, io_u);
+
if (io_u->ddir == DDIR_READ)
ret = aio_read(aiocb);
else if (io_u->ddir == DDIR_WRITE)
struct posixaio_data *pd = malloc(sizeof(*pd));
memset(pd, 0, sizeof(*pd));
- pd->aio_events = malloc(td->iodepth * sizeof(struct io_u *));
- memset(pd->aio_events, 0, td->iodepth * sizeof(struct io_u *));
+ pd->aio_events = malloc(td->o.iodepth * sizeof(struct io_u *));
+ memset(pd->aio_events, 0, td->o.iodepth * sizeof(struct io_u *));
td->io_ops->data = pd;
return 0;