if (td->o.zone_range)
max_size = td->o.zone_range;
+ if (td->o.min_bs[ddir] > td->o.ba[ddir])
+ max_size -= td->o.min_bs[ddir] - td->o.ba[ddir];
+
max_blocks = max_size / (uint64_t) td->o.ba[ddir];
if (!max_blocks)
return 0;
} else {
uint64_t off = 0;
+ assert(fio_file_lfsr(f));
+
if (lfsr_next(&f->lfsr, &off))
return 1;
}
dprint(FD_IO, "%s: rand offset failed, last=%llu, size=%llu\n",
- f->file_name, (unsigned long long) f->last_pos,
+ f->file_name, (unsigned long long) f->last_pos[ddir],
(unsigned long long) f->real_file_size);
return 1;
}
assert(ddir_rw(ddir));
- if (f->last_pos >= f->io_size + get_start_offset(td, f) &&
+ if (f->last_pos[ddir] >= f->io_size + get_start_offset(td, f) &&
o->time_based)
- f->last_pos = f->last_pos - f->io_size;
+ f->last_pos[ddir] = f->last_pos[ddir] - f->io_size;
- if (f->last_pos < f->real_file_size) {
+ if (f->last_pos[ddir] < f->real_file_size) {
uint64_t pos;
- if (f->last_pos == f->file_offset && o->ddir_seq_add < 0)
- f->last_pos = f->real_file_size;
+ if (f->last_pos[ddir] == f->file_offset && o->ddir_seq_add < 0)
+ f->last_pos[ddir] = f->real_file_size;
- pos = f->last_pos - f->file_offset;
+ pos = f->last_pos[ddir] - f->file_offset;
if (pos && o->ddir_seq_add) {
pos += o->ddir_seq_add;
*is_random = 0;
}
} else if (td->o.rw_seq == RW_SEQ_IDENT) {
- if (f->last_start != -1ULL)
- offset = f->last_start - f->file_offset;
+ if (f->last_start[ddir] != -1ULL)
+ offset = f->last_start[ddir] - f->file_offset;
else
offset = 0;
ret = 0;
* io's that have been actually submitted to an async engine,
* and cur_depth is meaningless for sync engines.
*/
+ if (td->io_u_queued || td->cur_depth) {
+ int fio_unused ret;
+
+ ret = td_io_commit(td);
+ }
+
while (td->io_u_in_flight) {
int fio_unused ret;
static enum fio_ddir rate_ddir(struct thread_data *td, enum fio_ddir ddir)
{
enum fio_ddir odir = ddir ^ 1;
- struct timeval t;
long usec;
assert(ddir_rw(ddir));
io_u_quiesce(td);
- fio_gettime(&t, NULL);
- usec_sleep(td, usec);
- usec = utime_since_now(&t);
+ usec = usec_sleep(td, usec);
td->rate_pending_usleep[ddir] -= usec;
if (td_rw(td) && __should_check_rate(td, odir))
td->rate_pending_usleep[odir] -= usec;
- if (ddir == DDIR_TRIM)
- return DDIR_TRIM;
-
return ddir;
}
*/
if (f->file_offset >= f->real_file_size)
f->file_offset = f->real_file_size - f->file_offset;
- f->last_pos = f->file_offset;
+ f->last_pos[io_u->ddir] = f->file_offset;
td->io_skip_bytes += td->o.zone_skip;
}
goto err_put;
}
- f->last_start = io_u->offset;
- f->last_pos = io_u->offset + io_u->buflen;
+ f->last_start[io_u->ddir] = io_u->offset;
+ f->last_pos[io_u->ddir] = io_u->offset + io_u->buflen;
if (io_u->ddir == DDIR_WRITE) {
if (td->flags & TD_F_REFILL_BUFFERS) {
{
struct thread_options *o = &td->o;
- if (o->compress_percentage) {
+ if (o->compress_percentage || o->dedupe_percentage) {
unsigned int perc = td->o.compress_percentage;
struct frand_state *rs;
unsigned int left = max_bs;
} while (left);
} else if (o->buffer_pattern_bytes)
fill_buffer_pattern(td, buf, max_bs);
- else
+ else if (o->zero_buffers)
memset(buf, 0, max_bs);
+ else
+ fill_random_buf(get_buf_state(td), buf, max_bs);
}
/*