From: Jens Axboe Date: Fri, 15 Dec 2006 15:01:54 +0000 (+0100) Subject: [PATCH] Only unlink for created files X-Git-Tag: fio-1.10~11 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=9b031dc82192e884c1d6da9c86f047ecb9ef5c3a;hp=178d11f29ffc50c46d907129ee81c3b41f48c926 [PATCH] Only unlink for created files If the file was already there, don't unlink it. Signed-off-by: Jens Axboe --- diff --git a/filesetup.c b/filesetup.c index 2e8821c5..cc89b7e6 100644 --- a/filesetup.c +++ b/filesetup.c @@ -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 16d5523f..f0b4e6a1 100644 --- a/fio.h +++ b/fio.h @@ -160,6 +160,8 @@ struct fio_file { unsigned long *file_map; unsigned int num_maps; + + unsigned int unlink; }; /*