Don't export state variable
[fio.git] / ioengines.c
index 07d1d5678986cbe86fd3c87eae1c3a413526ba2a..b42e2c48c7a5d4fe9f660b49a136fc88b69aa06f 100644 (file)
@@ -294,13 +294,20 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u)
                                        sizeof(struct timeval));
        }
 
-       if (ddir_rw(acct_ddir(io_u)))
+       if (ddir_rw(acct_ddir(io_u))) {
                td->io_issues[acct_ddir(io_u)]++;
+               td->io_issue_bytes[acct_ddir(io_u)] += io_u->xfer_buflen;
+       }
 
        ret = td->io_ops->queue(td, io_u);
 
        unlock_file(td, io_u->file);
 
+       if (ret == FIO_Q_BUSY && ddir_rw(acct_ddir(io_u))) {
+               td->io_issues[acct_ddir(io_u)]--;
+               td->io_issue_bytes[acct_ddir(io_u)] -= io_u->xfer_buflen;
+       }
+
        /*
         * If an error was seen and the io engine didn't propagate it
         * back to 'td', do so.
@@ -321,7 +328,7 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u)
                         "support direct IO, or iomem_align= is bad.\n");
        }
 
-       if (!td->io_ops->commit || ddir_trim(io_u->ddir)) {
+       if (!td->io_ops->commit || io_u->ddir == DDIR_TRIM) {
                io_u_mark_submit(td, 1);
                io_u_mark_complete(td, 1);
        }
@@ -461,6 +468,17 @@ int td_io_open_file(struct thread_data *td, struct fio_file *f)
                        goto err;
                }
        }
+#ifdef FIO_HAVE_STREAMID
+       if (td->o.fadvise_stream &&
+           (f->filetype == FIO_TYPE_BD || 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) {
+                       td_verror(td, errno, "fadvise streamid");
+                       goto err;
+               }
+       }
+#endif
 
 #ifdef FIO_OS_DIRECTIO
        /*