X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=io_u.c;h=efe838998d7a0d2dccecefab2e04c0f4ea430673;hb=683023e8e29e99f9d5cbd255b8595917cd7ce4fc;hp=62a76b9db9c4b98759fbb46f86231ea0c9ac9539;hpb=9520ebb9f4dd88d086e313ae97e37ebb6d4f240b;p=fio.git diff --git a/io_u.c b/io_u.c index 62a76b9d..efe83899 100644 --- a/io_u.c +++ b/io_u.c @@ -194,13 +194,20 @@ static int get_next_offset(struct thread_data *td, struct io_u *io_u) 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]; } @@ -681,10 +688,15 @@ static struct fio_file *get_next_file(struct thread_data *td) } 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); @@ -692,7 +704,7 @@ static struct fio_file *get_next_file(struct thread_data *td) 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; } @@ -741,6 +753,7 @@ set_file: * 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; @@ -851,7 +864,8 @@ struct io_u *get_io_u(struct thread_data *td) 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: @@ -881,7 +895,11 @@ void io_u_log_error(struct thread_data *td, struct io_u *io_u) 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");