Put the ->real_file_size handling into fio
Then we can remove it from the io engines, where the disk-less IO
engines provided a ->setup() hook just to set that.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/filesetup.c b/filesetup.c
index 62d048e..bd975d8 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -288,8 +288,10 @@
err = 1;
}
clear_error(td);
- } else
- td->io_ops->close_file(td, f);
+ } else {
+ if (td->io_ops->close_file)
+ td->io_ops->close_file(td, f);
+ }
if (f->real_file_size == -1ULL && td->o.size)
f->real_file_size = td->o.size / td->o.nr_files;
@@ -499,6 +501,12 @@
memset(f, 0, sizeof(*f));
f->fd = -1;
+ /*
+ * init function, io engine may not be loaded yet
+ */
+ if (td->io_ops && (td->io_ops->flags & FIO_DISKLESSIO))
+ f->real_file_size = -1ULL;
+
if (td->o.directory)
len = sprintf(file_name, "%s/", td->o.directory);