From b31d826c22878c533dcf1ca0bcdb43ce705d5994 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 29 Nov 2005 10:41:00 +0100 Subject: [PATCH] [PATCH] fio: unlink the file if terminated during file creation --- fio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fio.c b/fio.c index 569d3c9..f2ec8bb 100644 --- a/fio.c +++ b/fio.c @@ -1275,7 +1275,7 @@ static int create_file(struct thread_data *td) memset(b, 0, td->max_bs); left = td->file_size; - while (left) { + while (left && !td->terminate) { bs = td->max_bs; if (bs > left) bs = left; @@ -1295,7 +1295,9 @@ static int create_file(struct thread_data *td) } } - if (td->create_fsync) + if (td->terminate) + unlink(td->file_name); + else if (td->create_fsync) fsync(td->fd); close(td->fd); -- 2.25.1