void fio_file_reset(struct thread_data *td, struct fio_file *f)
{
- f->last_pos = f->file_offset;
- f->last_start = -1ULL;
+ int i;
+
+ for (i = 0; i < DDIR_RWDIR_CNT; i++) {
+ f->last_pos[i] = f->file_offset;
+ f->last_start[i] = -1ULL;
+ }
+
if (f->io_axmap)
axmap_reset(f->io_axmap);
if (td->o.random_generator == FIO_RAND_GEN_LFSR)
}
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;
*/
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) {