goto err;
}
- b = malloc(td->max_bs);
- memset(b, 0, td->max_bs);
+ if (posix_fallocate(f->fd, 0, f->file_size) < 0) {
+ td_verror(td, errno);
+ goto err;
+ }
+
+ b = malloc(td->max_bs[DDIR_WRITE]);
+ memset(b, 0, td->max_bs[DDIR_WRITE]);
left = f->file_size;
while (left && !td->terminate) {
- bs = td->max_bs;
+ bs = td->max_bs[DDIR_WRITE];
if (bs > left)
bs = left;
temp_stall_ts = 1;
fprintf(f_out, "%s: Laying out IO file(s) (%d x %LuMiB == %LuMiB)\n",
- td->name, td->nr_files,
- (td->total_file_size >> 20) / td->nr_files,
+ td->name, td->nr_uniq_files,
+ (td->total_file_size >> 20) / td->nr_uniq_files,
td->total_file_size >> 20);
err = 0;
for_each_file(td, f, i) {
if (f->fd != -1) {
- if (td->unlink && td->filetype == FIO_TYPE_FILE)
+ if (td->unlink && td->filetype == FIO_TYPE_FILE &&
+ td->filename) {
unlink(f->file_name);
+ td->filename = NULL;
+ }
+ free(f->file_name);
+ f->file_name = NULL;
close(f->fd);
f->fd = -1;
}
f->mmap = NULL;
}
}
+
+ free(td->files);
+ td->files = NULL;
+ td->nr_files = 0;
}