[PATCH] Only unlink for created files
authorJens Axboe <jens.axboe@oracle.com>
Fri, 15 Dec 2006 15:01:54 +0000 (16:01 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 15 Dec 2006 15:01:54 +0000 (16:01 +0100)
If the file was already there, don't unlink it.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
filesetup.c
fio.h

index 2e8821c5c6d6a36ef0e840d3e9b6161f3ba5eb1f..cc89b7e626903480316052339eed9e7566a594ae 100644 (file)
@@ -124,7 +124,12 @@ static int create_files(struct thread_data *td)
 
        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;
@@ -434,7 +439,7 @@ void close_files(struct thread_data *td)
        int i;
 
        for_each_file(td, f, i) {
-               if (!td->filename && td->unlink &&
+               if (!td->filename && f->unlink &&
                    td->filetype == FIO_TYPE_FILE) {
                        unlink(f->file_name);
                        free(f->file_name);
diff --git a/fio.h b/fio.h
index 16d5523feb6bf2af4f5f3684010645ceae95ccec..f0b4e6a1d72630c64f4768fe99da6b64527ef730 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -160,6 +160,8 @@ struct fio_file {
 
        unsigned long *file_map;
        unsigned int num_maps;
+
+       unsigned int unlink;
 };
 
 /*