From: Jens Axboe Date: Wed, 26 Mar 2008 08:18:14 +0000 (+0100) Subject: Make sure that file is created for FIO_NOEXTEND engines X-Git-Tag: fio-1.20-rc4~9^2~5 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=ffdfabd48d0edfba9cb53cfd27a2f12ad887c211 Make sure that file is created for FIO_NOEXTEND engines This fixes a SIGBUS with the mmap engine. Reported by "Zhang, Yanmin" Signed-off-by: Jens Axboe --- diff --git a/filesetup.c b/filesetup.c index e8472769..bb43ee58 100644 --- a/filesetup.c +++ b/filesetup.c @@ -30,7 +30,8 @@ static int extend_file(struct thread_data *td, struct fio_file *f) * does that for operations involving reads, or for writes * where overwrite is set */ - if (td_read(td) || (td_write(td) && td->o.overwrite)) + if (td_read(td) || (td_write(td) && td->o.overwrite) || + (td_write(td) && td->io_ops->flags & FIO_NOEXTEND)) new_layout = 1; if (td_write(td) && !td->o.overwrite) unlink_file = 1; @@ -94,9 +95,10 @@ static int extend_file(struct thread_data *td, struct fio_file *f) } } - if (td->terminate) + if (td->terminate) { + dprint(FD_FILE, "terminate unlink %s\n", f->file_name); unlink(f->file_name); - else if (td->o.create_fsync) { + } else if (td->o.create_fsync) { if (fsync(f->fd) < 0) { td_verror(td, errno, "fsync"); goto err; @@ -114,6 +116,7 @@ err: return 1; } + dprint(FD_FILE, "layout unlink %s\n", f->file_name); static unsigned long long get_rand_file_size(struct thread_data *td) { unsigned long long ret, size_d; @@ -601,8 +604,10 @@ void close_and_free_files(struct thread_data *td) dprint(FD_FILE, "close files\n"); for_each_file(td, f, i) { - if (td->o.unlink && f->filetype == FIO_TYPE_FILE) + if (td->o.unlink && f->filetype == FIO_TYPE_FILE) { + dprint(FD_FILE, "free unlink %s\n", f->file_name); unlink(f->file_name); + } td_io_close_file(td, f);