/*
* Generate a value, v, between 1 and 100, both inclusive
*/
- v = rand_between(&td->zone_state, 1, 100);
+ v = rand32_between(&td->zone_state, 1, 100);
zsi = &td->zone_state_index[ddir][v - 1];
stotal = zsi->size_perc_prev;
if (td->o.perc_rand[ddir] == 100)
return true;
- v = rand_between(&td->seq_rand_state[ddir], 1, 100);
+ v = rand32_between(&td->seq_rand_state[ddir], 1, 100);
return v <= td->o.perc_rand[ddir];
}
buflen = bsp->bs;
perc += bsp->perc;
- if ((r <= ((frand_max / 100L) * perc)) &&
+ if ((r * 100UL <= frand_max * perc) &&
io_u_fits(td, io_u, buflen))
break;
}
{
unsigned int v;
- v = rand_between(&td->rwmix_state, 1, 100);
+ v = rand32_between(&td->rwmix_state, 1, 100);
if (v <= td->o.rwmix[DDIR_READ])
return DDIR_READ;
}
}
- if (!td->o.disable_clat) {
- add_clat_sample(td, idx, lusec, bytes, io_u->offset);
- io_u_mark_latency(td, lusec);
- }
+ if (ddir_rw(idx)) {
+ if (!td->o.disable_clat) {
+ add_clat_sample(td, idx, lusec, bytes, io_u->offset);
+ io_u_mark_latency(td, lusec);
+ }
- if (!td->o.disable_bw)
- add_bw_sample(td, idx, bytes, &icd->time);
+ if (!td->o.disable_bw && per_unit_log(td->bw_log))
+ add_bw_sample(td, io_u, bytes, lusec);
- if (no_reduce)
- add_iops_sample(td, idx, bytes, &icd->time);
+ if (no_reduce && per_unit_log(td->iops_log))
+ add_iops_sample(td, io_u, bytes);
+ }
if (td->ts.nr_block_infos && io_u->ddir == DDIR_TRIM) {
uint32_t *info = io_u_block_info(td, io_u);
}
}
+static void file_log_write_comp(const struct thread_data *td, struct fio_file *f,
+ uint64_t offset, unsigned int bytes)
+{
+ int idx;
+
+ if (!f)
+ return;
+
+ if (f->first_write == -1ULL || offset < f->first_write)
+ f->first_write = offset;
+ if (f->last_write == -1ULL || ((offset + bytes) > f->last_write))
+ f->last_write = offset + bytes;
+
+ if (!f->last_write_comp)
+ return;
+
+ idx = f->last_write_idx++;
+ f->last_write_comp[idx] = offset;
+ if (f->last_write_idx == td->o.iodepth)
+ f->last_write_idx = 0;
+}
+
static void io_completed(struct thread_data *td, struct io_u **io_u_ptr,
struct io_completion_data *icd)
{
if (!(io_u->flags & IO_U_F_VER_LIST))
td->this_io_bytes[ddir] += bytes;
- if (ddir == DDIR_WRITE) {
- if (f) {
- if (f->first_write == -1ULL ||
- io_u->offset < f->first_write)
- f->first_write = io_u->offset;
- if (f->last_write == -1ULL ||
- ((io_u->offset + bytes) > f->last_write))
- f->last_write = io_u->offset + bytes;
- }
- if (td->last_write_comp) {
- int idx = td->last_write_idx++;
-
- td->last_write_comp[idx] = io_u->offset;
- if (td->last_write_idx == td->o.iodepth)
- td->last_write_idx = 0;
- }
- }
+ 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))
return &td->buf_state;
}
- v = rand_between(&td->dedupe_state, 1, 100);
+ v = rand32_between(&td->dedupe_state, 1, 100);
if (v <= td->o.dedupe_percentage)
return &td->buf_state_prev;