Introduce the io_u.post_submit callback function pointer
authorBart Van Assche <bart.vanassche@wdc.com>
Fri, 24 Aug 2018 18:31:24 +0000 (11:31 -0700)
committerJens Axboe <axboe@kernel.dk>
Fri, 24 Aug 2018 18:54:32 +0000 (12:54 -0600)
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@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_u.c
io_u.h
ioengines.c

diff --git a/io_u.c b/io_u.c
index e050d9f7c775e7f4fabe10b80f9add5d87f8e510..29a360a95424a72cbf1c7f0c0b753efdbcf06f18 100644 (file)
--- 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 2e0fd3fe789b49c46345bf184a7736fc83ac0d49..97270c94d1714c83064adae850e759621f58b665 100644 (file)
--- 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
         */
index 433da604ae4af03daf9fc8b8d5a81b2097ed0362..1821916112cc13d3276d44fa6d14b11569b3d04c 100644 (file)
@@ -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);