[PATCH] Only unlink the same file once
[fio.git] / filesetup.c
index 2e81a1d10c88320e4396d625e99be1e9d9a04a9f..52d822ac4b6c8fb1bff042fd56aae96e0846c9da 100644 (file)
@@ -114,8 +114,8 @@ 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",
-                               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;
@@ -404,8 +404,11 @@ void close_files(struct thread_data *td)
 
        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);