if (td_random(td) && (td->o.ddir_nr && !--td->ddir_nr)) {
td->ddir_nr = td->o.ddir_nr;
- if (get_next_rand_offset(td, f, ddir, &b))
+ if (get_next_rand_offset(td, f, ddir, &b)) {
+ dprint(FD_IO, "%s: getting rand offset failed\n",
+ f->file_name);
return 1;
+ }
} else {
if (f->last_pos >= f->real_file_size) {
if (!td_random(td) ||
- get_next_rand_offset(td, f, ddir, &b))
+ get_next_rand_offset(td, f, ddir, &b)) {
+ dprint(FD_IO, "%s: pos %llu > size %llu\n",
+ f->file_name, f->last_pos,
+ f->real_file_size);
return 1;
+ }
} else
b = (f->last_pos - f->file_offset) / td->o.min_bs[ddir];
}
}
f = td->file_service_file;
- if (f && (f->flags & FIO_FILE_OPEN) && td->file_service_left--)
- goto out;
+ if (f && (f->flags & FIO_FILE_OPEN) && !(f->flags & FIO_FILE_CLOSING)) {
+ if (td->o.file_service_type == FIO_FSERVICE_SEQ)
+ goto out;
+ if (td->file_service_left--)
+ goto out;
+ }
- if (td->o.file_service_type == FIO_FSERVICE_RR)
+ if (td->o.file_service_type == FIO_FSERVICE_RR ||
+ td->o.file_service_type == FIO_FSERVICE_SEQ)
f = get_next_file_rr(td, FIO_FILE_OPEN, FIO_FILE_CLOSING);
else
f = get_next_file_rand(td, FIO_FILE_OPEN, FIO_FILE_CLOSING);
td->file_service_file = f;
td->file_service_left = td->file_service_nr - 1;
out:
- dprint(FD_FILE, "get_next_file: %p\n", f);
+ dprint(FD_FILE, "get_next_file: %p [%s]\n", f, f->file_name);
return f;
}
* td_io_close() does a put_file() as well, so no need to
* do that here.
*/
+ dprint(FD_FILE, "%s: is done\n", f->file_name);
io_u->file = NULL;
td_io_close_file(td, f);
f->flags |= FIO_FILE_DONE;
out:
if (!td_io_prep(td, io_u)) {
- fio_gettime(&io_u->start_time, NULL);
+ if (!td->o.disable_slat)
+ fio_gettime(&io_u->start_time, NULL);
return io_u;
}
err_put:
static void io_completed(struct thread_data *td, struct io_u *io_u,
struct io_completion_data *icd)
{
- unsigned long usec;
+ /*
+ * Older gcc's are too dumb to realize that usec is always used
+ * initialized, silence that warning.
+ */
+ unsigned long uninitialized_var(usec);
dprint_io_u(io_u, "io complete");
td->this_io_bytes[idx] += bytes;
if (ramp_time_over(td)) {
- usec = utime_since(&io_u->issue_time, &icd->time);
+ if (!td->o.disable_clat || !td->o.disable_bw)
+ usec = utime_since(&io_u->issue_time,
+ &icd->time);
- add_clat_sample(td, idx, usec);
- add_bw_sample(td, idx, &icd->time);
- io_u_mark_latency(td, usec);
+ if (!td->o.disable_clat) {
+ add_clat_sample(td, idx, usec);
+ io_u_mark_latency(td, usec);
+ }
+ if (!td->o.disable_bw)
+ add_bw_sample(td, idx, &icd->time);
}
if (td_write(td) && idx == DDIR_WRITE &&
}
}
-static void init_icd(struct io_completion_data *icd, int nr)
+static void init_icd(struct thread_data *td, struct io_completion_data *icd,
+ int nr)
{
- fio_gettime(&icd->time, NULL);
+ if (!td->o.disable_clat || !td->o.disable_bw)
+ fio_gettime(&icd->time, NULL);
icd->nr = nr;
{
struct io_completion_data icd;
- init_icd(&icd, 1);
+ init_icd(td, &icd, 1);
io_completed(td, io_u, &icd);
put_io_u(td, io_u);
} else if (!ret)
return ret;
- init_icd(&icd, ret);
+ init_icd(td, &icd, ret);
ios_completed(td, &icd);
if (!icd.error)
return icd.bytes_done[0] + icd.bytes_done[1];
*/
void io_u_queued(struct thread_data *td, struct io_u *io_u)
{
- unsigned long slat_time;
+ if (!td->o.disable_slat) {
+ unsigned long slat_time;
- slat_time = utime_since(&io_u->start_time, &io_u->issue_time);
- add_slat_sample(td, io_u->ddir, slat_time);
+ slat_time = utime_since(&io_u->start_time, &io_u->issue_time);
+ add_slat_sample(td, io_u->ddir, slat_time);
+ }
}
/*