Initial suppor for sync_file_range()
[fio.git] / ioengines.c
index 7f0a5c4520bab954d1e8eaa4df04ee115f8290e1..0e8953404f7e4339572f44aad104f58b2c1a052e 100644 (file)
@@ -431,3 +431,16 @@ int td_io_get_file_size(struct thread_data *td, struct fio_file *f)
 
        return td->io_ops->get_file_size(td, f);
 }
+
+int do_sync_file_range(struct thread_data *td, struct fio_file *f)
+{
+       off64_t offset, nbytes;
+
+       offset = f->first_write;
+       nbytes = f->last_write - f->first_write;
+
+       if (nbytes)
+               return sync_file_range(f->fd, offset, nbytes, 0);
+
+       return 0;
+}