Only initialize random map if we are actually going to use it
[fio.git] / filesetup.c
index 76b45a9c76af6762d73521355b031bdc38046c9c..b29db3f3f237032db28c1ec1d4fdc4cc6b6c050f 100644 (file)
@@ -33,8 +33,8 @@ static int extend_file(struct thread_data *td, struct fio_file *f)
        if (td_write(td) && !td->o.overwrite)
                unlink_file = 1;
 
-       if ((unlink_file || new_layout) && (f->flags & FIO_FILE_EXISTS)) {
-               if (unlink(f->file_name) < 0) {
+       if (unlink_file || new_layout) {
+               if ((unlink(f->file_name) < 0) && (errno != ENOENT)) {
                        td_verror(td, errno, "unlink");
                        return 1;
                }
@@ -497,7 +497,7 @@ int init_random_map(struct thread_data *td)
        struct fio_file *f;
        unsigned int i;
 
-       if (td->o.norandommap)
+       if (td->o.norandommap || !td_random(td))
                return 0;
 
        for_each_file(td, f, i) {