Add fill_device option
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index b8cba547ac931fcdf7ac0b3af79b7b19a7b8af75..1c79d6823ae95079f0b445ceac9ed7507bb9be3b 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -568,6 +568,10 @@ sync_done:
                }
        }
 
+       if (td->o.fill_device && td->error == ENOSPC) {
+               td->error = 0;
+               td->terminate = 1;
+       }
        if (!td->error) {
                struct fio_file *f;
 
@@ -657,10 +661,12 @@ static int init_io_u(struct thread_data *td)
                memset(io_u, 0, sizeof(*io_u));
                INIT_LIST_HEAD(&io_u->list);
 
-               io_u->buf = p + max_bs * i;
+               if (!(td->io_ops->flags & FIO_NOIO)) {
+                       io_u->buf = p + max_bs * i;
 
-               if (td_write(td))
-                       fill_io_buf(td, io_u, max_bs);
+                       if (td_write(td))
+                               fill_io_buf(td, io_u, max_bs);
+               }
 
                io_u->index = i;
                io_u->flags = IO_U_F_FREE;
@@ -785,9 +791,8 @@ static int clear_io_state(struct thread_data *td)
  */
 static void *thread_main(void *data)
 {
-       unsigned long long runtime[2];
+       unsigned long long runtime[2], elapsed;
        struct thread_data *td = data;
-       unsigned long elapsed;
        int clear_state;
 
        if (!td->o.use_thread)
@@ -827,7 +832,7 @@ static void *thread_main(void *data)
                goto err;
        }
 
-       if (td->ioprio) {
+       if (td->ioprio_set) {
                if (ioprio_set(IOPRIO_WHO_PROCESS, 0, td->ioprio) == -1) {
                        td_verror(td, errno, "ioprio_set");
                        goto err;
@@ -901,7 +906,8 @@ static void *thread_main(void *data)
                if (td->error || td->terminate)
                        break;
 
-               if (td->o.verify == VERIFY_NONE ||
+               if (!td->o.do_verify ||
+                   td->o.verify == VERIFY_NONE ||
                    (td->io_ops->flags & FIO_UNIDIR))
                        continue;
 
@@ -986,12 +992,12 @@ static int fork_main(int shmid, int offset)
 static void reap_threads(int *nr_running, int *t_rate, int *m_rate)
 {
        struct thread_data *td;
-       int i, cputhreads, pending, status, ret;
+       int i, cputhreads, realthreads, pending, status, ret;
 
        /*
         * reap exited threads (TD_EXITED -> TD_REAPED)
         */
-       pending = cputhreads = 0;
+       realthreads = pending = cputhreads = 0;
        for_each_td(td, i) {
                int flags = 0;
 
@@ -1001,6 +1007,8 @@ static void reap_threads(int *nr_running, int *t_rate, int *m_rate)
                 */
                if (td->io_ops && !strcmp(td->io_ops->name, "cpuio"))
                        cputhreads++;
+               else
+                       realthreads++;
 
                if (!td->pid || td->runstate == TD_REAPED)
                        continue;
@@ -1067,7 +1075,7 @@ reaped:
                        exit_value++;
        }
 
-       if (*nr_running == cputhreads && !pending)
+       if (*nr_running == cputhreads && !pending && realthreads)
                terminate_threads(TERMINATE_ALL);
 }