struct io_u *last_io_u;
};
-static int fio_syncio_sync(struct thread_data fio_unused *td,
- struct fio_file *f)
-{
- return fsync(f->fd);
-}
-
static int fio_syncio_getevents(struct thread_data *td, int fio_unused min,
int max, struct timespec fio_unused *t)
{
{
struct fio_file *f = io_u->file;
+ if (io_u->ddir == DDIR_SYNC)
+ return 0;
+
if (lseek(f->fd, io_u->offset, SEEK_SET) == -1) {
td_verror(td, errno);
return 1;
{
struct syncio_data *sd = td->io_ops->data;
struct fio_file *f = io_u->file;
- int ret;
+ unsigned int ret;
if (io_u->ddir == DDIR_READ)
ret = read(f->fd, io_u->buf, io_u->buflen);
- else
+ else if (io_u->ddir == DDIR_WRITE)
ret = write(f->fd, io_u->buf, io_u->buflen);
+ else
+ ret = fsync(f->fd);
- if ((unsigned int) ret != io_u->buflen) {
+ if (ret != io_u->buflen) {
if (ret > 0) {
io_u->resid = io_u->buflen - ret;
io_u->error = EIO;
.getevents = fio_syncio_getevents,
.event = fio_syncio_event,
.cleanup = fio_syncio_cleanup,
- .sync = fio_syncio_sync,
.flags = FIO_SYNCIO,
};