Improve precision of the io_limit setting
authorJens Axboe <axboe@fb.com>
Fri, 16 Jan 2015 17:03:11 +0000 (10:03 -0700)
committerJens Axboe <axboe@fb.com>
Fri, 16 Jan 2015 17:03:11 +0000 (10:03 -0700)
For async engines, we look only at completions. But we could have
a bunch inflight with a high queue depth, making us go higher than
we should.

Signed-off-by: Jens Axboe <axboe@fb.com>
backend.c
fio.h
ioengines.c

index efabfa79f9a66fe42b0d7270122bb44b795d7dce..9012140de35bc33b8e9c555d03943cbc94a54f06 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -667,13 +667,13 @@ static int io_bytes_exceeded(struct thread_data *td)
        unsigned long long bytes, limit;
 
        if (td_rw(td))
-               bytes = td->this_io_bytes[DDIR_READ] + td->this_io_bytes[DDIR_WRITE];
+               bytes = td->io_issue_bytes[DDIR_READ] + td->io_issue_bytes[DDIR_WRITE];
        else if (td_write(td))
-               bytes = td->this_io_bytes[DDIR_WRITE];
+               bytes = td->io_issue_bytes[DDIR_WRITE];
        else if (td_read(td))
-               bytes = td->this_io_bytes[DDIR_READ];
+               bytes = td->io_issue_bytes[DDIR_READ];
        else
-               bytes = td->this_io_bytes[DDIR_TRIM];
+               bytes = td->io_issue_bytes[DDIR_TRIM];
 
        if (td->o.io_limit)
                limit = td->o.io_limit;
diff --git a/fio.h b/fio.h
index be2f23aa9f7662f448c9b1f63b6f087333bdb9a2..d28f8ce59cf15cee75c86d13f95099894dd2b547 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -235,7 +235,15 @@ struct thread_data {
        uint64_t total_io_size;
        uint64_t fill_device_size;
 
+       /*
+        * Issue side
+        */
        uint64_t io_issues[DDIR_RWDIR_CNT];
+       uint64_t io_issue_bytes[DDIR_RWDIR_CNT];
+
+       /*
+        * Completions
+        */
        uint64_t io_blocks[DDIR_RWDIR_CNT];
        uint64_t this_io_blocks[DDIR_RWDIR_CNT];
        uint64_t io_bytes[DDIR_RWDIR_CNT];
index 6370a562059a48b92360acab31202ef1e4d6d60f..88f67d51dbaede8438a0a589073e816887a8fb6b 100644 (file)
@@ -294,8 +294,10 @@ 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);