From 99952ca7747d2ec56b4ff4771ddfaa03fb0e8407 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 24 Aug 2018 11:31:24 -0700 Subject: [PATCH] Introduce the io_u.post_submit callback function pointer This patch does not change any functionality. The code introduced by this patch will be used by the zoned block device code. Signed-off-by: Bart Van Assche Signed-off-by: Jens Axboe --- io_u.c | 10 ++++++++++ io_u.h | 6 ++++++ ioengines.c | 4 ++++ 3 files changed, 20 insertions(+) diff --git a/io_u.c b/io_u.c index e050d9f7..29a360a9 100644 --- a/io_u.c +++ b/io_u.c @@ -761,6 +761,11 @@ void put_file_log(struct thread_data *td, struct fio_file *f) void put_io_u(struct thread_data *td, struct io_u *io_u) { + if (io_u->post_submit) { + io_u->post_submit(io_u, io_u->error == 0); + io_u->post_submit = NULL; + } + if (td->parent) td = td->parent; @@ -1304,6 +1309,11 @@ static long set_io_u_file(struct thread_data *td, struct io_u *io_u) if (!fill_io_u(td, io_u)) break; + if (io_u->post_submit) { + io_u->post_submit(io_u, false); + io_u->post_submit = NULL; + } + put_file_log(td, f); td_io_close_file(td, f); io_u->file = NULL; diff --git a/io_u.h b/io_u.h index 2e0fd3fe..97270c94 100644 --- a/io_u.h +++ b/io_u.h @@ -92,6 +92,12 @@ struct io_u { struct workqueue_work work; }; + /* + * Post-submit callback. Used by the ZBD code. @success == true means + * that the I/O operation has been queued or completed successfully. + */ + void (*post_submit)(const struct io_u *, bool success); + /* * Callback for io completion */ diff --git a/ioengines.c b/ioengines.c index 433da604..18219161 100644 --- a/ioengines.c +++ b/ioengines.c @@ -319,6 +319,10 @@ enum fio_q_status td_io_queue(struct thread_data *td, struct io_u *io_u) } ret = td->io_ops->queue(td, io_u); + if (ret != FIO_Q_BUSY && io_u->post_submit) { + io_u->post_submit(io_u, io_u->error == 0); + io_u->post_submit = NULL; + } unlock_file(td, io_u->file); -- 2.25.1