diff options
Diffstat (limited to 'ioengines.c')
-rw-r--r-- | ioengines.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ioengines.c b/ioengines.c index f8c52e57..4e059a81 100644 --- a/ioengines.c +++ b/ioengines.c @@ -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 +} |