Add option to disable fadvise() hints
[fio.git] / filesetup.c
index 289db8781d82535e5929db7cbc8f7bd45329920d..1426b151085b1553af318cdf58ecdc47ce84fb14 100644 (file)
@@ -384,9 +384,12 @@ int generic_open_file(struct thread_data *td, struct fio_file *f)
        }
 
        if (f->fd == -1) {
+               char buf[FIO_VERROR_SIZE];
                int __e = errno;
 
-               td_verror(td, __e, "open");
+               snprintf(buf, sizeof(buf) - 1, "open(%s)", f->file_name);
+
+               td_verror(td, __e, buf);
                if (__e == EINVAL && td->o.odirect)
                        log_err("fio: destination does not support O_DIRECT\n");
                if (__e == EMFILE)
@@ -400,6 +403,9 @@ int generic_open_file(struct thread_data *td, struct fio_file *f)
        if (td->o.invalidate_cache && file_invalidate_cache(td, f))
                goto err;
 
+       if (!td->o.fadvise_hint)
+               return 0;
+
        if (!td_random(td)) {
                if (fadvise(f->fd, f->file_offset, f->file_size, POSIX_FADV_SEQUENTIAL) < 0) {
                        td_verror(td, errno, "fadvise");