Rename FIO_TYPE_BD to FIO_TYPE_BLOCK
[fio.git] / ioengines.c
index ae55f951d413fbaeaf92dae3c8eb0746167d4c9d..315432dae468eeee8469f8944229b9fadaad98f5 100644 (file)
@@ -298,6 +298,7 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u)
                td->io_issues[ddir]--;
                td->io_issue_bytes[ddir] -= buflen;
                td->rate_io_issue_bytes[ddir] -= buflen;
+               io_u_clear(td, io_u, IO_U_F_FLIGHT);
        }
 
        /*
@@ -447,14 +448,24 @@ int td_io_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 &&
-           (f->filetype == FIO_TYPE_BD || f->filetype == FIO_TYPE_FILE)) {
+       if (td->o.fadvise_hint != F_ADV_NONE &&
+           (f->filetype == FIO_TYPE_BLOCK || f->filetype == FIO_TYPE_FILE)) {
                int flags;
 
-               if (td_random(td))
+               if (td->o.fadvise_hint == F_ADV_TYPE) {
+                       if (td_random(td))
+                               flags = POSIX_FADV_RANDOM;
+                       else
+                               flags = POSIX_FADV_SEQUENTIAL;
+               } else if (td->o.fadvise_hint == F_ADV_RANDOM)
                        flags = POSIX_FADV_RANDOM;
-               else
+               else if (td->o.fadvise_hint == F_ADV_SEQUENTIAL)
                        flags = POSIX_FADV_SEQUENTIAL;
+               else {
+                       log_err("fio: unknown fadvise type %d\n",
+                                                       td->o.fadvise_hint);
+                       flags = POSIX_FADV_NORMAL;
+               }
 
                if (posix_fadvise(f->fd, f->file_offset, f->io_size, flags) < 0) {
                        td_verror(td, errno, "fadvise");
@@ -463,7 +474,7 @@ int td_io_open_file(struct thread_data *td, struct fio_file *f)
        }
 #ifdef FIO_HAVE_STREAMID
        if (td->o.fadvise_stream &&
-           (f->filetype == FIO_TYPE_BD || f->filetype == FIO_TYPE_FILE)) {
+           (f->filetype == FIO_TYPE_BLOCK || f->filetype == FIO_TYPE_FILE)) {
                off_t stream = td->o.fadvise_stream;
 
                if (posix_fadvise(f->fd, stream, f->io_size, POSIX_FADV_STREAMID) < 0) {
@@ -483,7 +494,12 @@ int td_io_open_file(struct thread_data *td, struct fio_file *f)
 
                if (ret) {
                        td_verror(td, ret, "fio_set_odirect");
-                       log_err("fio: the file system does not seem to support direct IO\n");
+                       if (ret == ENOTTY) { /* ENOTTY suggests RAW device or ZFS */
+                               log_err("fio: doing directIO to RAW devices or ZFS not supported\n");
+                       } else {
+                               log_err("fio: the file system does not seem to support direct IO\n");
+                       }
+
                        goto err;
                }
        }