From 39f56400f63e43fbe33e391d52f24eb6c79d0098 Mon Sep 17 00:00:00 2001 From: Vincent Fu Date: Tue, 14 Jun 2022 15:58:29 +0000 Subject: [PATCH] ioengines: update last_issue if we set issue_time If we're not updating issue_time it doesn't make sense to update last_issue. We should also be updating last_issue in libaio and io_uring when we record issue_time. Signed-off-by: Vincent Fu Link: https://lore.kernel.org/r/20220614155822.307771-5-vincent.fu@samsung.com Signed-off-by: Jens Axboe --- engines/io_uring.c | 6 ++++++ engines/libaio.c | 6 ++++++ ioengines.c | 30 ++++++++++++++++-------------- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/engines/io_uring.c b/engines/io_uring.c index 474d215c27..cffc73710d 100644 --- a/engines/io_uring.c +++ b/engines/io_uring.c @@ -608,6 +608,12 @@ static void fio_ioring_queued(struct thread_data *td, int start, int nr) start++; } + + /* + * only used for iolog + */ + if (td->o.read_iolog_file) + memcpy(&td->last_issue, &now, sizeof(now)); } static int fio_ioring_commit(struct thread_data *td) diff --git a/engines/libaio.c b/engines/libaio.c index da5279f485..33b8c12f96 100644 --- a/engines/libaio.c +++ b/engines/libaio.c @@ -368,6 +368,12 @@ static void fio_libaio_queued(struct thread_data *td, struct io_u **io_us, memcpy(&io_u->issue_time, &now, sizeof(now)); io_u_queued(td, io_u); } + + /* + * only used for iolog + */ + if (td->o.read_iolog_file) + memcpy(&td->last_issue, &now, sizeof(now)); } static int fio_libaio_commit(struct thread_data *td) diff --git a/ioengines.c b/ioengines.c index e4ad698c67..e2316ee4e3 100644 --- a/ioengines.c +++ b/ioengines.c @@ -358,15 +358,16 @@ enum fio_q_status td_io_queue(struct thread_data *td, struct io_u *io_u) if (td_ioengine_flagged(td, FIO_SYNCIO) || async_ioengine_sync_trim(td, io_u)) { - if (fio_fill_issue_time(td)) + if (fio_fill_issue_time(td)) { fio_gettime(&io_u->issue_time, NULL); - /* - * only used for iolog - */ - if (td->o.read_iolog_file) - memcpy(&td->last_issue, &io_u->issue_time, - sizeof(io_u->issue_time)); + /* + * only used for iolog + */ + if (td->o.read_iolog_file) + memcpy(&td->last_issue, &io_u->issue_time, + sizeof(io_u->issue_time)); + } } @@ -443,15 +444,16 @@ enum fio_q_status td_io_queue(struct thread_data *td, struct io_u *io_u) if (!td_ioengine_flagged(td, FIO_SYNCIO) && !async_ioengine_sync_trim(td, io_u)) { if (fio_fill_issue_time(td) && - !td_ioengine_flagged(td, FIO_ASYNCIO_SETS_ISSUE_TIME)) + !td_ioengine_flagged(td, FIO_ASYNCIO_SETS_ISSUE_TIME)) { fio_gettime(&io_u->issue_time, NULL); - /* - * only used for iolog - */ - if (td->o.read_iolog_file) - memcpy(&td->last_issue, &io_u->issue_time, - sizeof(io_u->issue_time)); + /* + * only used for iolog + */ + if (td->o.read_iolog_file) + memcpy(&td->last_issue, &io_u->issue_time, + sizeof(io_u->issue_time)); + } } return ret;