if (!max_blocks)
return 0;
- return max_blocks - 1;
+ return max_blocks;
}
/*
b = (f->last_pos - f->file_offset) / td->o.min_bs[ddir];
}
- io_u->offset = (b * td->o.min_bs[ddir]) + f->file_offset;
+ io_u->offset = b * td->o.min_bs[ddir];
+ if (io_u->offset >= f->io_size) {
+ dprint(FD_IO, "get_next_offset: offset %llu >= io_size %llu\n",
+ io_u->offset, f->io_size);
+ return 1;
+ }
+
+ io_u->offset += f->file_offset;
if (io_u->offset >= f->real_file_size) {
dprint(FD_IO, "get_next_offset: offset %llu >= size %llu\n",
io_u->offset, f->real_file_size);
return 0;
}
-void io_u_mark_depth(struct thread_data *td, struct io_u *io_u,
- unsigned int nr)
+void io_u_mark_depth(struct thread_data *td, unsigned int nr)
{
int index = 0;
- if (io_u->ddir == DDIR_SYNC)
- return;
-
switch (td->cur_depth) {
default:
index = 6;
}
td->ts.io_u_map[index] += nr;
- td->ts.total_io_u[io_u->ddir] += nr;
}
static void io_u_mark_lat_usec(struct thread_data *td, unsigned long usec)
if (!fill_io_u(td, io_u))
break;
+ /*
+ * optimization to prevent close/open of the same file. This
+ * way we preserve queueing etc.
+ */
+ if (td->o.nr_files == 1 && td->o.time_based) {
+ put_file(td, f);
+ fio_file_reset(f);
+ goto set_file;
+ }
+
/*
* td_io_close() does a put_file() as well, so no need to
* do that here.