fio.h: Grow td->verror
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index 978771e1370378ada310bc303b686f20fd7a2763..fa6302e6934ba502b30a68afbba2489ea137ca50 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -329,11 +329,12 @@ static void io_u_mark_latency(struct thread_data *td, unsigned long msec)
  */
 static struct fio_file *get_next_file_rand(struct thread_data *td)
 {
-       long r = os_random_long(&td->next_file_state);
        unsigned int fileno;
        struct fio_file *f;
 
        do {
+               long r = os_random_long(&td->next_file_state);
+
                fileno = (unsigned int) ((double) (td->nr_files - 1) * r / (RAND_MAX + 1.0));
                f = &td->files[fileno];
                if (f->fd != -1)
@@ -570,6 +571,7 @@ long io_u_sync_complete(struct thread_data *td, struct io_u *io_u)
        if (!icd.error)
                return icd.bytes_done[0] + icd.bytes_done[1];
 
+       td_verror(td, icd.error, "io_u_sync_complete");
        return -1;
 }
 
@@ -600,6 +602,7 @@ long io_u_queued_complete(struct thread_data *td, int min_events)
        if (!icd.error)
                return icd.bytes_done[0] + icd.bytes_done[1];
 
+       td_verror(td, icd.error, "io_u_queued_complete");
        return -1;
 }