filesetup: keep OS_O_DIRECT flag when pre-allocating file
[fio.git] / filesetup.c
index 3b2ebd9c1ec70a3b3361bf15dabe7d56b19c979c..0e5599ab16502e9541023af6028e9814f366a844 100644 (file)
@@ -67,7 +67,7 @@ static void fallocate_file(struct thread_data *td, struct fio_file *f)
        switch (td->o.fallocate_mode) {
        case FIO_FALLOCATE_NATIVE:
                r = native_fallocate(td, f);
-               if (r != 0)
+               if (r != 0 && errno != ENOSYS)
                        log_err("fio: native_fallocate call failed: %s\n",
                                        strerror(errno));
                break;
@@ -100,7 +100,6 @@ static void fallocate_file(struct thread_data *td, struct fio_file *f)
                log_err("fio: unknown fallocate mode: %d\n", td->o.fallocate_mode);
                assert(0);
        }
-
 }
 
 /*
@@ -147,6 +146,8 @@ static int extend_file(struct thread_data *td, struct fio_file *f)
                flags |= O_CREAT;
        if (new_layout)
                flags |= O_TRUNC;
+       if (td->o.odirect)
+               flags |= OS_O_DIRECT;
 
 #ifdef WIN32
        flags |= _O_BINARY;