static inline int io_u_fits(struct thread_data *td, struct io_u *io_u, unsigned int buflen) { struct fio_file *f = io_u->file; return io_u->offset + buflen <= f->io_size + get_start_offset(td); }
void clear_io_state(struct thread_data *td, int all) { struct fio_file *f; unsigned int i; reset_io_counters(td, all); close_files(td); for_each_file(td, f, i) { fio_file_clear_done(f); f->file_offset = get_start_offset(td, f); }
static int get_next_seq_offset(struct thread_data *td, struct fio_file *f, enum fio_ddir ddir, uint64_t *offset) { assert(ddir_rw(ddir)); if (f->last_pos >= f->io_size + get_start_offset(td) && td->o.time_based) f->last_pos = f->last_pos - f->io_size; if (f->last_pos < f->real_file_size) { uint64_t pos; if (f->last_pos == f->file_offset && td->o.ddir_seq_add < 0) f->last_pos = f->real_file_size; pos = f->last_pos - f->file_offset; if (pos) pos += td->o.ddir_seq_add; *offset = pos; return 0; } return 1; }