Add create_on_open option
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Please enter the commit message for your changes. Lines starting
diff --git a/filesetup.c b/filesetup.c
index cfcfa9a..088b77c 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -314,6 +314,8 @@
flags |= O_SYNC;
if (f->filetype != FIO_TYPE_FILE)
flags |= FIO_O_NOATIME;
+ if (td->o.create_on_open)
+ flags |= O_CREAT;
open_again:
if (td_write(td)) {
@@ -534,8 +536,11 @@
if (f->filetype == FIO_TYPE_FILE &&
(f->io_size + f->file_offset) > f->real_file_size &&
!(td->io_ops->flags & FIO_DISKLESSIO)) {
- need_extend++;
- extend_size += (f->io_size + f->file_offset);
+ if (!td->o.create_on_open) {
+ need_extend++;
+ extend_size += (f->io_size + f->file_offset);
+ } else
+ f->real_file_size = f->io_size + f->file_offset;
f->flags |= FIO_FILE_EXTEND;
}
}