X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=io_u.c;h=b54a79c73d98af9bfac5b749d44d3e0e9d9c1273;hp=1d6872edb2876794e9c4c07d5ea5e05a726f34dd;hb=264e3d300d9aa2d9c5acdf8edbd3639fbec784a0;hpb=53bb5d9c037e842970b32bc828dbe809b42c144d diff --git a/io_u.c b/io_u.c index 1d6872ed..b54a79c7 100644 --- a/io_u.c +++ b/io_u.c @@ -163,7 +163,6 @@ static int __get_next_rand_offset_zoned_abs(struct thread_data *td, { struct zone_split_index *zsi; uint64_t lastb, send, stotal; - static int warned; unsigned int v; lastb = last_block(td, f, ddir); @@ -192,10 +191,8 @@ bail: * Should never happen */ if (send == -1U) { - if (!warned) { + if (!fio_did_warn(FIO_WARN_ZONED_BUG)) log_err("fio: bug in zoned generation\n"); - warned = 1; - } goto bail; } else if (send > lastb) { /* @@ -223,7 +220,6 @@ static int __get_next_rand_offset_zoned(struct thread_data *td, { unsigned int v, send, stotal; uint64_t offset, lastb; - static int warned; struct zone_split_index *zsi; lastb = last_block(td, f, ddir); @@ -248,10 +244,8 @@ bail: * Should never happen */ if (send == -1U) { - if (!warned) { + if (!fio_did_warn(FIO_WARN_ZONED_BUG)) log_err("fio: bug in zoned generation\n"); - warned = 1; - } goto bail; } @@ -1921,7 +1915,8 @@ static void account_io_completion(struct thread_data *td, struct io_u *io_u, if (no_reduce && per_unit_log(td->iops_log)) add_iops_sample(td, io_u, bytes); - } + } else if (ddir_sync(idx) && !td->o.disable_clat) + add_sync_clat_sample(&td->ts, llnsec); if (td->ts.nr_block_infos && io_u->ddir == DDIR_TRIM) { uint32_t *info = io_u_block_info(td, io_u); @@ -1959,6 +1954,12 @@ static void file_log_write_comp(const struct thread_data *td, struct fio_file *f f->last_write_idx = 0; } +static bool should_account(struct thread_data *td) +{ + return ramp_time_over(td) && (td->runstate == TD_RUNNING || + td->runstate == TD_VERIFYING); +} + static void io_completed(struct thread_data *td, struct io_u **io_u_ptr, struct io_completion_data *icd) { @@ -1987,15 +1988,17 @@ static void io_completed(struct thread_data *td, struct io_u **io_u_ptr, } if (ddir_sync(ddir)) { - td->last_was_sync = 1; + td->last_was_sync = true; if (f) { f->first_write = -1ULL; f->last_write = -1ULL; } + if (should_account(td)) + account_io_completion(td, io_u, icd, ddir, io_u->buflen); return; } - td->last_was_sync = 0; + td->last_was_sync = false; td->last_ddir = ddir; if (!io_u->error && ddir_rw(ddir)) { @@ -2013,8 +2016,7 @@ static void io_completed(struct thread_data *td, struct io_u **io_u_ptr, if (ddir == DDIR_WRITE) file_log_write_comp(td, f, io_u->offset, bytes); - if (ramp_time_over(td) && (td->runstate == TD_RUNNING || - td->runstate == TD_VERIFYING)) + if (should_account(td)) account_io_completion(td, io_u, icd, ddir, bytes); icd->bytes_done[ddir] += bytes;