X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;ds=sidebyside;f=backend.c;h=6198c3d9f8c7d445713c6a70fcd91b0f1ff03807;hb=2ae7a90df2d2340c4503be8a91526f80b3b96789;hp=f003761deac2f989f563a2f2af6cfb3135138fe5;hpb=38f2df4e2ece9a6db857fb6a8b5c91ddac6304fc;p=fio.git diff --git a/backend.c b/backend.c index f003761d..6198c3d9 100644 --- a/backend.c +++ b/backend.c @@ -617,6 +617,19 @@ static bool in_flight_overlap(struct io_u_queue *q, struct io_u *io_u) return overlap; } +static int io_u_submit(struct thread_data *td, struct io_u *io_u) +{ + /* + * Check for overlap if the user asked us to, and we have + * at least one IO in flight besides this one. + */ + if (td->o.serialize_overlap && td->cur_depth > 1 && + in_flight_overlap(&td->io_u_all, io_u)) + return FIO_Q_BUSY; + + return td_io_queue(td, io_u); +} + /* * The main verify engine. Runs over the writes we previously submitted, * reads the blocks back in, and checks the crc/md5 of the data. @@ -747,13 +760,7 @@ static void do_verify(struct thread_data *td, uint64_t verify_bytes) if (!td->o.disable_slat) fio_gettime(&io_u->start_time, NULL); - if (td->o.serialize_overlap && td->cur_depth > 0) { - if (in_flight_overlap(&td->io_u_all, io_u)) - ret = FIO_Q_BUSY; - else - ret = td_io_queue(td, io_u); - } else - ret = td_io_queue(td, io_u); + ret = io_u_submit(td, io_u); if (io_queue_event(td, io_u, &ret, ddir, NULL, 1, NULL)) break; @@ -1020,13 +1027,7 @@ static void do_io(struct thread_data *td, uint64_t *bytes_done) td->rate_next_io_time[ddir] = usec_for_io(td, ddir); } else { - if (td->o.serialize_overlap && td->cur_depth > 0) { - if (in_flight_overlap(&td->io_u_all, io_u)) - ret = FIO_Q_BUSY; - else - ret = td_io_queue(td, io_u); - } else - ret = td_io_queue(td, io_u); + ret = io_u_submit(td, io_u); if (should_check_rate(td)) td->rate_next_io_time[ddir] = usec_for_io(td, ddir); @@ -1390,6 +1391,8 @@ static bool keep_running(struct thread_data *td) if (td->done) return false; + if (td->terminate) + return false; if (td->o.time_based) return true; if (td->o.loops) { @@ -2041,7 +2044,10 @@ static bool __check_trigger_file(void) static bool trigger_timedout(void) { if (trigger_timeout) - return time_since_genesis() >= trigger_timeout; + if (time_since_genesis() >= trigger_timeout) { + trigger_timeout = 0; + return true; + } return false; } @@ -2050,7 +2056,7 @@ void exec_trigger(const char *cmd) { int ret; - if (!cmd) + if (!cmd || cmd[0] == '\0') return; ret = system(cmd);