break;
log_info("fio: ENOSPC on laying out "
"file, stopping\n");
- break;
}
td_verror(td, errno, "write");
} else
td_verror(td, EIO, "write");
- break;
+ goto err;
}
}
}
flags |= OS_O_DIRECT | FIO_O_ATOMIC;
}
- if (td->o.sync_io)
- flags |= O_SYNC;
+ flags |= td->o.sync_io;
if (td->o.create_on_open && td->o.allow_create)
flags |= O_CREAT;
skip_flags:
if (f->io_size == -1ULL)
total_size = -1ULL;
else {
+ uint64_t io_size;
+
if (o->size_percent && o->size_percent != 100) {
uint64_t file_size;
f->io_size -= (f->io_size % td_min_bs(td));
}
- total_size += f->io_size;
+
+ io_size = f->io_size;
+ if (o->io_size_percent && o->io_size_percent != 100) {
+ io_size *= o->io_size_percent;
+ io_size /= 100;
+ }
+
+ total_size += io_size;
}
if (f->filetype == FIO_TYPE_FILE &&
}
}
+void fio_file_free(struct fio_file *f)
+{
+ if (fio_file_axmap(f))
+ axmap_free(f->io_axmap);
+ if (!fio_file_smalloc(f)) {
+ free(f->file_name);
+ free(f);
+ } else {
+ sfree(f->file_name);
+ sfree(f);
+ }
+}
+
void close_and_free_files(struct thread_data *td)
{
struct fio_file *f;
unsigned int i;
- bool use_free = td_ioengine_flagged(td, FIO_NOFILEHASH);
dprint(FD_FILE, "close files\n");
}
zbd_close_file(f);
-
- if (use_free)
- free(f->file_name);
- else
- sfree(f->file_name);
- f->file_name = NULL;
- if (fio_file_axmap(f)) {
- axmap_free(f->io_axmap);
- f->io_axmap = NULL;
- }
- if (use_free)
- free(f);
- else
- sfree(f);
+ fio_file_free(f);
}
td->o.filename = NULL;
f->fd = -1;
f->shadow_fd = -1;
fio_file_reset(td, f);
+ if (!td_ioengine_flagged(td, FIO_NOFILEHASH))
+ fio_file_set_smalloc(f);
return f;
}