X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=backend.c;h=f0a45bc82bee24ab40321d880a7f790f18a4f3e2;hb=1368d95b060802f3032bb662144faa99bd521b56;hp=76e456f1295da2d827269c27716ef63cbd33af43;hpb=f1867a7f9e588acf67cf8fa96eab8a6e2fdedcf6;p=fio.git diff --git a/backend.c b/backend.c index 76e456f1..f0a45bc8 100644 --- a/backend.c +++ b/backend.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "fio.h" #include "smalloc.h" @@ -65,6 +66,7 @@ unsigned int stat_number = 0; int shm_id = 0; int temp_stall_ts; unsigned long done_secs = 0; +pthread_mutex_t overlap_check = PTHREAD_MUTEX_INITIALIZER; #define JOB_START_TIMEOUT (5 * 1000) @@ -567,7 +569,7 @@ static int unlink_all_files(struct thread_data *td) /* * Check if io_u will overlap an in-flight IO in the queue */ -static bool in_flight_overlap(struct io_u_queue *q, struct io_u *io_u) +bool in_flight_overlap(struct io_u_queue *q, struct io_u *io_u) { bool overlap; struct io_u *check_io_u; @@ -1872,7 +1874,11 @@ static void *thread_main(void *data) "perhaps try --debug=io option for details?\n", td->o.name, td->io_ops->name); + if (td_offload_overlap(td)) + pthread_mutex_lock(&overlap_check); td_set_runstate(td, TD_FINISHING); + if (td_offload_overlap(td)) + pthread_mutex_unlock(&overlap_check); update_rusage_stat(td); td->ts.total_run_time = mtime_since_now(&td->epoch);