X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=backend.c;h=1ff8b3f6e298adfa7f756453edf2cff1656b91f8;hp=32bc2652bd0ba93793c9b12cc27ca8b4cf81aef0;hb=632f415c8d67a1ade18834a0f56d95c508aaa8af;hpb=002fe73409d1e3d5e7dfe2885f75885bfaf506bc diff --git a/backend.c b/backend.c index 32bc2652..1ff8b3f6 100644 --- a/backend.c +++ b/backend.c @@ -346,7 +346,7 @@ static inline int runtime_exceeded(struct thread_data *td, struct timeval *t) return 0; if (!td->o.timeout) return 0; - if (mtime_since(&td->epoch, t) >= td->o.timeout * 1000) + if (utime_since(&td->epoch, t) >= td->o.timeout) return 1; return 0; @@ -623,6 +623,19 @@ reap: dprint(FD_VERIFY, "exiting loop\n"); } +static unsigned int exceeds_number_ios(struct thread_data *td) +{ + unsigned long long number_ios; + + if (!td->o.number_ios) + return 0; + + number_ios = ddir_rw_sum(td->this_io_blocks); + number_ios += td->io_u_queued + td->io_u_in_flight; + + return number_ios >= td->o.number_ios; +} + static int io_bytes_exceeded(struct thread_data *td) { unsigned long long bytes; @@ -636,7 +649,7 @@ static int io_bytes_exceeded(struct thread_data *td) else bytes = td->this_io_bytes[DDIR_TRIM]; - return bytes >= td->o.size; + return bytes >= td->o.size || exceeds_number_ios(td); } /* @@ -1127,6 +1140,8 @@ static int keep_running(struct thread_data *td) td->o.loops--; return 1; } + if (exceeds_number_ios(td)) + return 0; if (td->o.size != -1ULL && ddir_rw_sum(td->io_bytes) < td->o.size) { uint64_t diff; @@ -1196,6 +1211,12 @@ static uint64_t do_dry_run(struct thread_data *td) td->ts.total_io_u[io_u->ddir]++; } + if (td_write(td) && io_u->ddir == DDIR_WRITE && + td->o.do_verify && + td->o.verify != VERIFY_NONE && + !td->o.experimental_verify) + log_io_piece(td, io_u); + ret = io_u_sync_complete(td, io_u, bytes_done); (void) ret; } @@ -1278,6 +1299,15 @@ static void *thread_main(void *data) * allocations. */ if (o->cpumask_set) { + if (o->cpus_allowed_policy == FIO_CPUS_SPLIT) { + ret = fio_cpus_split(&o->cpumask, td->thread_number - 1); + if (!ret) { + log_err("fio: no CPUs set\n"); + log_err("fio: Try increasing number of available CPUs\n"); + td_verror(td, EINVAL, "cpus_split"); + goto err; + } + } ret = fio_setaffinity(td->pid, o->cpumask); if (ret == -1) { td_verror(td, errno, "cpu_set_affinity"); @@ -1461,6 +1491,7 @@ static void *thread_main(void *data) fio_unpin_memory(td); fio_mutex_down(writeout_mutex); + finalize_logs(td); if (td->bw_log) { if (o->bw_log_file) { finish_log_named(td, td->bw_log, @@ -1682,8 +1713,8 @@ static void do_usleep(unsigned int usecs) static void run_threads(void) { struct thread_data *td; - unsigned long spent; unsigned int i, todo, nr_running, m_rate, t_rate, nr_started; + uint64_t spent; if (fio_gtod_offload && fio_start_gtod_thread()) return; @@ -1781,9 +1812,9 @@ static void run_threads(void) } if (td->o.start_delay) { - spent = mtime_since_genesis(); + spent = utime_since_genesis(); - if (td->o.start_delay * 1000 > spent) + if (td->o.start_delay > spent) continue; }