- if (f->open) {
- if (td->io_ops->close_file)
- td->io_ops->close_file(td, f);
- td->nr_open_files--;
- f->open = 0;
- }
+ /*
+ * mark as closing, do real close when last io on it has completed
+ */
+ f->flags |= FIO_FILE_CLOSING;
+
+ put_file(td, f);