Fio 1.16.9
[fio.git] / filesetup.c
index 6ccd357ec4f5d0b9dde6cb92d2691139eeb2aa34..93cddb1f467b3aea77cfc3b858c1164e89da8964 100644 (file)
@@ -222,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)
@@ -474,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);
@@ -548,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++;
 }