[PATCH 04/11] Introduce the io_u.post_submit callback function pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <bart.vanassche@xxxxxxx>
---
 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 e050d9f7c775..29a360a95424 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 2e0fd3fe789b..97270c94d171 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 433da604ae4a..1821916112cc 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.18.0




[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux