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:
} else if (f->filetype != FIO_TYPE_FILE)
continue;
- snprintf(buf, ARRAY_SIZE(buf), "%s", f->file_name);
+ snprintf(buf, FIO_ARRAY_SIZE(buf), "%s", f->file_name);
if (stat(buf, &sb) < 0) {
if (errno != ENOENT)
continue;
fm = calloc(1, sizeof(*fm));
- snprintf(fm->__base, ARRAY_SIZE(fm->__base), "%s", buf);
+ snprintf(fm->__base, FIO_ARRAY_SIZE(fm->__base), "%s", buf);
fm->base = basename(fm->__base);
fm->key = sb.st_dev;
flist_add(&fm->list, &list);
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 &&
o->size = total_size;
if (o->size < td_min_bs(td)) {
- log_err("fio: blocksize too large for data set\n");
+ log_err("fio: blocksize is larger than data set range\n");
goto err_out;
}
td_restore_runstate(td, old_state);
if (td->o.zone_mode == ZONE_MODE_ZBD) {
- err = zbd_init(td);
+ err = zbd_setup_files(td);
if (err)
goto err_out;
}
}
}
+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");
td_io_unlink_file(td, f);
}
- zbd_free_zone_info(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);
+ zbd_close_file(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;
}