{
int ret = 0;
+ if (f->flags & FIO_SIZE_KNOWN)
+ return 0;
+
if (f->filetype == FIO_TYPE_FILE)
ret = file_size(td, f);
else if (f->filetype == FIO_TYPE_BD)
return 1;
}
+ f->flags |= FIO_SIZE_KNOWN;
return 0;
}
for_each_file(td, f, i) {
err = td_io_open_file(td, f);
- if (err)
+ if (err) {
+ if (td->error == EMFILE) {
+ log_err("fio: limited open files to: %d\n", td->nr_open_files);
+ td->o.open_files = td->nr_open_files;
+ err = 0;
+ clear_error(td);
+ }
break;
+ }
if (td->o.open_files == td->nr_open_files)
break;
unsigned int i;
for_each_file(td, f, i) {
- if (td->io_ops->open_file(td, f)) {
- td->error = 0;
- memset(td->verror, 0, sizeof(td->verror));
- } else
+ if (td->io_ops->open_file(td, f))
+ clear_error(td);
+ else
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;
}
}
/*
* device/file sizes are zero and no size given, punt
*/
- if (!total_size && !td->o.size) {
+ if ((!total_size || total_size == -1ULL) && !td->o.size) {
log_err("%s: you need to specify size=\n", td->o.name);
td_verror(td, EINVAL, "total_file_size");
return 1;
if (!(f->flags & FIO_FILE_EXTEND))
continue;
+ assert(f->filetype == FIO_TYPE_FILE);
f->flags &= ~FIO_FILE_EXTEND;
f->real_file_size = f->io_size;
err = extend_file(td, f);