X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=io_u.c;h=1e9018c4f6ee85bc5362aea312b9b2ec15a15978;hp=27014c8aad503b4cb8ed7eba374a954b6b7c6a2d;hb=b0f65863844b4de92d10fefaabde80ea5bc3e5cc;hpb=b5696bfc783ea3a762a73fa62d8b1a8d1fa67840 diff --git a/io_u.c b/io_u.c index 27014c8a..1e9018c4 100644 --- a/io_u.c +++ b/io_u.c @@ -95,7 +95,7 @@ static unsigned long long last_block(struct thread_data *td, struct fio_file *f, if (max_size > f->real_file_size) max_size = f->real_file_size; - max_blocks = max_size / (unsigned long long) td->o.min_bs[ddir]; + max_blocks = max_size / (unsigned long long) td->o.ba[ddir]; if (!max_blocks) return 0; @@ -113,7 +113,8 @@ static int get_next_free_block(struct thread_data *td, struct fio_file *f, i = f->last_free_lookup; *b = (i * BLOCKS_PER_MAP); - while ((*b) * min_bs < f->real_file_size) { + while ((*b) * min_bs < f->real_file_size && + (*b) * min_bs < f->io_size) { if (f->file_map[i] != (unsigned int) -1) { *b += ffz(f->file_map[i]); if (*b > last_block(td, f, ddir)) @@ -212,7 +213,7 @@ static int get_next_offset(struct thread_data *td, struct io_u *io_u) b = (f->last_pos - f->file_offset) / td->o.min_bs[ddir]; } - io_u->offset = b * td->o.min_bs[ddir]; + io_u->offset = b * td->o.ba[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); @@ -248,7 +249,7 @@ static unsigned int get_next_buflen(struct thread_data *td, struct io_u *io_u) buflen = minbs; else { r = os_random_long(&td->bsrange_state); - if (!td->o.bssplit_nr) { + if (!td->o.bssplit_nr[ddir]) { buflen = 1 + (unsigned int) ((double) maxbs * (r / (OS_RAND_MAX + 1.0))); if (buflen < minbs) @@ -257,8 +258,8 @@ static unsigned int get_next_buflen(struct thread_data *td, struct io_u *io_u) long perc = 0; unsigned int i; - for (i = 0; i < td->o.bssplit_nr; i++) { - struct bssplit *bsp = &td->o.bssplit[i]; + for (i = 0; i < td->o.bssplit_nr[ddir]; i++) { + struct bssplit *bsp = &td->o.bssplit[ddir][i]; buflen = bsp->bs; perc += bsp->perc; @@ -685,6 +686,7 @@ static struct fio_file *get_next_file_rr(struct thread_data *td, int goodf, if (err) { dprint(FD_FILE, "error %d on open of %s\n", err, f->file_name); + f = NULL; continue; } opened = 1; @@ -748,23 +750,12 @@ static int set_io_u_file(struct thread_data *td, struct io_u *io_u) if (!f) return 1; -set_file: io_u->file = f; get_file(f); 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_log(td, f); - fio_file_reset(f); - goto set_file; - } - put_file_log(td, f); td_io_close_file(td, f); io_u->file = NULL; @@ -848,7 +839,7 @@ struct io_u *get_io_u(struct thread_data *td) f->last_pos = io_u->offset + io_u->buflen; - if (td->o.verify != VERIFY_NONE) + if (td->o.verify != VERIFY_NONE && io_u->ddir == DDIR_WRITE) populate_verify_io_u(td, io_u); else if (td->o.refill_buffers && io_u->ddir == DDIR_WRITE) io_u_fill_buffer(td, io_u, io_u->xfer_buflen); @@ -927,11 +918,11 @@ static void io_completed(struct thread_data *td, struct io_u *io_u, &icd->time); if (!td->o.disable_clat) { - add_clat_sample(td, idx, usec); + add_clat_sample(td, idx, usec, bytes); io_u_mark_latency(td, usec); } if (!td->o.disable_bw) - add_bw_sample(td, idx, &icd->time); + add_bw_sample(td, idx, bytes, &icd->time); } if (td_write(td) && idx == DDIR_WRITE && @@ -1036,7 +1027,7 @@ void io_u_queued(struct thread_data *td, struct io_u *io_u) 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); + add_slat_sample(td, io_u->ddir, io_u->xfer_buflen, slat_time); } }