X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=filesetup.c;h=93cddb1f467b3aea77cfc3b858c1164e89da8964;hp=85141dc3725a26b870fe8afe83876199e2142163;hb=97af62cec418cd722fb43c6010d6430534e12353;hpb=661598287ecc3b8987f312cf8403936552ce686a diff --git a/filesetup.c b/filesetup.c index 85141dc3..93cddb1f 100644 --- a/filesetup.c +++ b/filesetup.c @@ -209,6 +209,12 @@ int generic_open_file(struct thread_data *td, struct fio_file *f) return 1; } is_std = 1; + + /* + * move output logging to stderr, if we are writing to stdout + */ + if (td_write(td)) + f_out = stderr; } if (td->o.odirect) @@ -216,7 +222,7 @@ int generic_open_file(struct thread_data *td, struct fio_file *f) if (td->o.sync_io) flags |= O_SYNC; - if (td_write(td) || td_rw(td)) { + if (td_write(td)) { flags |= O_RDWR; if (f->filetype == FIO_TYPE_FILE) @@ -468,8 +474,7 @@ void close_files(struct thread_data *td) unsigned int i; for_each_file(td, f, i) { - if ((f->flags & FIO_FILE_UNLINK) && - f->filetype == FIO_TYPE_FILE) + if (td->o.unlink && f->filetype == FIO_TYPE_FILE) unlink(f->file_name); td_io_close_file(td, f); @@ -542,6 +547,7 @@ void add_file(struct thread_data *td, const char *fname) void get_file(struct fio_file *f) { + assert(f->flags & FIO_FILE_OPEN); f->references++; } @@ -554,8 +560,7 @@ void put_file(struct thread_data *td, struct fio_file *f) if (--f->references) return; - if (should_fsync(td) && td->o.fsync_on_close && - (f->filetype == FIO_TYPE_FILE || f->filetype == FIO_TYPE_BD)) + if (should_fsync(td) && td->o.fsync_on_close) fsync(f->fd); if (td->io_ops->close_file)