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;
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);