From: Jens Axboe Date: Fri, 16 Jan 2015 17:03:11 +0000 (-0700) Subject: Improve precision of the io_limit setting X-Git-Tag: fio-2.2.5~9 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=74d6277f4e5fe2858bff01c30fb25d8c6c4215d0 Improve precision of the io_limit setting 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 --- diff --git a/backend.c b/backend.c index efabfa79..9012140d 100644 --- 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 be2f23aa..d28f8ce5 100644 --- 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]; diff --git a/ioengines.c b/ioengines.c index 6370a562..88f67d51 100644 --- a/ioengines.c +++ b/ioengines.c @@ -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);