+err:
+ disk_util_dec(f->du);
+ if (td->io_ops->close_file)
+ td->io_ops->close_file(td, f);
+ return 1;
+}
+
+int td_io_close_file(struct thread_data *td, struct fio_file *f)
+{
+ if (!fio_file_closing(f))
+ log_file(td, f, FIO_LOG_CLOSE_FILE);
+
+ /*
+ * mark as closing, do real close when last io on it has completed
+ */
+ fio_file_set_closing(f);
+
+ disk_util_dec(f->du);
+ unlock_file_all(td, f);
+
+ return put_file(td, f);
+}
+
+int td_io_get_file_size(struct thread_data *td, struct fio_file *f)
+{
+ if (!td->io_ops->get_file_size)
+ return 0;
+
+ return td->io_ops->get_file_size(td, f);
+}
+
+static 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 0;
+
+ return sync_file_range(f->fd, offset, nbytes, td->o.sync_file_range);