X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=filesetup.c;h=a14cd9503a68dbab9a656b78a3fd92726d46b07c;hb=ee88470c001012d08ae37bfc31741a935be2e7a1;hp=50434e641b7af1cbc9617c50c75e27e1a2cde0f1;hpb=7abf833d25ab6cc866308fe37483dfe2fde28efc;p=fio.git diff --git a/filesetup.c b/filesetup.c index 50434e64..a14cd950 100644 --- a/filesetup.c +++ b/filesetup.c @@ -117,14 +117,19 @@ static int create_files(struct thread_data *td) } temp_stall_ts = 1; - fprintf(f_out, "%s: Laying out IO file(s) (%d x %LuMiB == %LuMiB)\n", + fprintf(f_out, "%s: Laying out IO file(s) (%u x %LuMiB == %LuMiB)\n", 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) { + /* + * Only unlink files that we created. + */ + f->unlink = 0; if (file_ok(td, f)) { + f->unlink = td->unlink; err = create_file(td, f); if (err) break; @@ -151,7 +156,7 @@ static int file_size(struct thread_data *td, struct fio_file *f) f->file_size = f->real_file_size; } - f->file_size -= f->file_offset; + f->file_size = f->real_file_size - f->file_offset; return 0; } @@ -434,7 +439,8 @@ void close_files(struct thread_data *td) int i; for_each_file(td, f, i) { - if (td->unlink && td->filetype == FIO_TYPE_FILE) { + if (!td->filename && f->unlink && + td->filetype == FIO_TYPE_FILE) { unlink(f->file_name); free(f->file_name); f->file_name = NULL;