X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=ioengines.c;h=7f4e104e927aeee75fa04d51c699d41460c49ae0;hp=f976efbf693ec1b502041933442e70ab0b6d2852;hb=01be038efc66ea1b49b4471f2ba9dd2d7121cfe7;hpb=ff58fcede39d16a2c642897cbe5a7f28b2da1950 diff --git a/ioengines.c b/ioengines.c index f976efbf..7f4e104e 100644 --- a/ioengines.c +++ b/ioengines.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include "fio.h" @@ -269,7 +270,8 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u) if (ddir_rw(io_u->ddir)) { io_u_mark_depth(td, 1); td->ts.total_io_u[io_u->ddir]++; - } + } else if (io_u->ddir == DDIR_TRIM) + td->ts.total_io_u[2]++; } else if (ret == FIO_Q_QUEUED) { int r; @@ -310,6 +312,8 @@ int td_io_init(struct thread_data *td) log_err("fio: io engine init failed. Perhaps try" " reducing io depth?\n"); } + if (!td->error) + td->error = ret; } return ret; @@ -385,7 +389,7 @@ int td_io_open_file(struct thread_data *td, struct fio_file *f) else flags = POSIX_FADV_SEQUENTIAL; - if (fadvise(f->fd, f->file_offset, f->io_size, flags) < 0) { + if (posix_fadvise(f->fd, f->file_offset, f->io_size, flags) < 0) { td_verror(td, errno, "fadvise"); goto err; } @@ -401,6 +405,7 @@ int td_io_open_file(struct thread_data *td, struct fio_file *f) if (ret) { td_verror(td, ret, "fio_set_odirect"); + log_err("fio: the file system does not seem to support direct IO\n"); goto err; } } @@ -488,7 +493,7 @@ int do_io_u_trim(struct thread_data *td, struct io_u *io_u) struct fio_file *f = io_u->file; int ret; - ret = os_trim(f->fd, io_u->offset + f->file_offset, io_u->xfer_buflen); + ret = os_trim(f->fd, io_u->offset, io_u->xfer_buflen); if (!ret) return io_u->xfer_buflen;;