X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=ioengines.c;h=c94fcb30c23b87ccea185b88c642081864017111;hp=7b1c1bd3a3360e9feadd4def4eb8c90bd83111aa;hb=eb8bbf48e79a8c6afd3c84e3d64263d10ee45daa;hpb=6796209a7e3d39522b0f5599aba277809786335e diff --git a/ioengines.c b/ioengines.c index 7b1c1bd3..c94fcb30 100644 --- a/ioengines.c +++ b/ioengines.c @@ -15,20 +15,12 @@ #include #include #include +#include #include #include #include "fio.h" #include "os.h" -#ifdef FIO_HAVE_LIBAIO - -#define ev_to_iou(ev) (struct io_u *) ((unsigned long) (ev)->obj) - -static int fio_io_sync(struct thread_data *td) -{ - return fsync(td->fd); -} - static int fill_timespec(struct timespec *ts) { #ifdef _POSIX_TIMERS @@ -60,6 +52,15 @@ static unsigned long long ts_utime_since_now(struct timespec *t) return sec + nsec; } +static int fio_io_sync(struct thread_data *td) +{ + return fsync(td->fd); +} + +#ifdef FIO_HAVE_LIBAIO + +#define ev_to_iou(ev) (struct io_u *) ((unsigned long) (ev)->obj) + struct libaio_data { io_context_t aio_ctx; struct io_event *aio_events; @@ -374,7 +375,7 @@ static int fio_syncio_queue(struct thread_data *td, struct io_u *io_u) if ((unsigned int) ret != io_u->buflen) { if (ret > 0) { io_u->resid = io_u->buflen - ret; - io_u->error = ENODATA; + io_u->error = EIO; } else io_u->error = errno; } @@ -609,7 +610,7 @@ static int fio_sgio_prep(struct thread_data *td, struct io_u *io_u) int nr_blocks, lba; if (io_u->buflen & (sd->bs - 1)) { - fprintf(stderr, "read/write not sector aligned\n"); + fprintf(f_err, "read/write not sector aligned\n"); return EINVAL; } @@ -717,7 +718,7 @@ int fio_sgio_init(struct thread_data *td) if (ret) return ret; } else { - fprintf(stderr, "ioengine sgio only works on block devices\n"); + fprintf(f_err, "ioengine sgio only works on block devices\n"); return 1; }