Add missing types to log_io_u()
[fio.git] / ioengines.c
index 7ab356add79f32629a6fc9a2c8fa543d81d597af..4e059a8159b3cc59f15b5bd414eb5dd85e5ac7fb 100644 (file)
@@ -208,7 +208,7 @@ out:
        if (r >= 0)
                io_u_mark_complete(td, r);
        else
-               td_verror(td, -r, "get_events");
+               td_verror(td, r, "get_events");
 
        dprint(FD_IO, "getevents: %d\n", r);
        return r;
@@ -478,3 +478,21 @@ int do_io_u_sync(struct thread_data *td, struct io_u *io_u)
 
        return ret;
 }
+
+int do_io_u_trim(struct thread_data *td, struct io_u *io_u)
+{
+#ifndef FIO_HAVE_TRIM
+       io_u->error = EINVAL;
+       return io_u->xfer_buflen;
+#else
+       struct fio_file *f = io_u->file;
+       int ret;
+
+       ret = os_trim(f->fd, io_u->offset + f->file_offset, io_u->xfer_buflen);
+       if (!ret)
+               return 0;
+
+       io_u->error = errno;
+       return io_u->xfer_buflen;
+#endif
+}