fio: add function to check for serialize_overlap with offload submission
authorVincent Fu <vincent.fu@wdc.com>
Wed, 17 Oct 2018 16:03:22 +0000 (12:03 -0400)
committerJens Axboe <axboe@kernel.dk>
Fri, 19 Oct 2018 17:08:47 +0000 (11:08 -0600)
In multiple places fio needs to check whether it is carrying out overlap
checking in offload submission mode. Make this check a function to
improve code readability.

Reviewed-by: Sebastien Boisvert <sboisvert@gydle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
backend.c
fio.h
ioengines.c

index cc3c4e78e9d8ae6b8fd9cdc245272fc395369f34..f0a45bc82bee24ab40321d880a7f790f18a4f3e2 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -1874,10 +1874,10 @@ static void *thread_main(void *data)
                         "perhaps try --debug=io option for details?\n",
                         td->o.name, td->io_ops->name);
 
-       if (td->o.serialize_overlap && td->o.io_submit_mode == IO_MODE_OFFLOAD)
+       if (td_offload_overlap(td))
                pthread_mutex_lock(&overlap_check);
        td_set_runstate(td, TD_FINISHING);
-       if (td->o.serialize_overlap && td->o.io_submit_mode == IO_MODE_OFFLOAD)
+       if (td_offload_overlap(td))
                pthread_mutex_unlock(&overlap_check);
 
        update_rusage_stat(td);
diff --git a/fio.h b/fio.h
index e394e165078a4fa3da53d397cae2791e8e9fe195..b3ba5db2e95ac9e16cd0633bc8912b125c08e333 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -772,6 +772,11 @@ static inline bool td_async_processing(struct thread_data *td)
        return (td->flags & TD_F_NEED_LOCK) != 0;
 }
 
+static inline bool td_offload_overlap(struct thread_data *td)
+{
+       return td->o.serialize_overlap && td->o.io_submit_mode == IO_MODE_OFFLOAD;
+}
+
 /*
  * We currently only need to do locking if we have verifier threads
  * accessing our internal structures too
index 47f606a75409c9a2679443ad02ba7f818e6f6ed4..56723addc5af2f57348d2b3784c4594a5c8e88b1 100644 (file)
@@ -288,7 +288,7 @@ enum fio_q_status td_io_queue(struct thread_data *td, struct io_u *io_u)
 
        assert((io_u->flags & IO_U_F_FLIGHT) == 0);
        io_u_set(td, io_u, IO_U_F_FLIGHT);
-       if (td->o.serialize_overlap && td->o.io_submit_mode == IO_MODE_OFFLOAD)
+       if (td_offload_overlap(td))
                pthread_mutex_unlock(&overlap_check);
 
        assert(fio_file_open(io_u->file));