From: Jens Axboe Date: Sun, 14 Jan 2007 04:56:44 +0000 (+0100) Subject: [PATCH] Unlink write file if !overwrite and it exists X-Git-Tag: fio-1.12~145 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=eff6861d99c1e20ef24d5ab9eef1ac0bbfa655d3;p=fio.git [PATCH] Unlink write file if !overwrite and it exists Repeatability across runs, unlink the file so that the job runs like it wasn't there to begin with. Signed-off-by: Jens Axboe --- diff --git a/filesetup.c b/filesetup.c index 75288706..2af6c2fc 100644 --- a/filesetup.c +++ b/filesetup.c @@ -103,9 +103,18 @@ static int create_files(struct thread_data *td) return 0; need_create = 0; - if (td->filetype == FIO_TYPE_FILE) - for_each_file(td, f, i) - need_create += file_ok(td, f); + if (td->filetype == FIO_TYPE_FILE) { + for_each_file(td, f, i) { + int file_there = !file_ok(td, f); + + if (file_there && td->ddir == WRITE && !td->overwrite) { + unlink(f->file_name); + file_there = 0; + } + + need_create += !file_there; + } + } if (!need_create) return 0;