X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=io_u.c;h=6ae3eae817782bd2d82c408b7b74f6dec6d59cf2;hp=87b80191c30e3530bc531f525a45c4e2ec47977f;hb=97ac992c99d89eed8cdf9249bb038ac4d7b709b9;hpb=1ae83d45ed853cd73b95b89ae14cacac5b97187e diff --git a/io_u.c b/io_u.c index 87b80191..6ae3eae8 100644 --- a/io_u.c +++ b/io_u.c @@ -16,7 +16,7 @@ struct io_completion_data { int nr; /* input */ int error; /* output */ - unsigned long bytes_done[DDIR_RWDIR_CNT]; /* output */ + uint64_t bytes_done[DDIR_RWDIR_CNT]; /* output */ struct timeval time; /* output */ }; @@ -172,18 +172,31 @@ static int get_off_from_method(struct thread_data *td, struct fio_file *f, return 1; } +/* + * Sort the reads for a verify phase in batches of verifysort_nr, if + * specified. + */ +static inline int should_sort_io(struct thread_data *td) +{ + if (!td->o.verifysort_nr || !td->o.do_verify) + return 0; + if (!td_random(td)) + return 0; + if (td->runstate != TD_VERIFYING) + return 0; + if (td->o.random_generator == FIO_RAND_GEN_TAUSWORTHE) + return 0; + + return 1; +} + static int get_next_rand_offset(struct thread_data *td, struct fio_file *f, enum fio_ddir ddir, uint64_t *b) { struct rand_off *r; int i, ret = 1; - /* - * If sort not enabled, or not a pure random read workload without - * any stored write metadata, just return a random offset - */ - if (!td->o.verifysort_nr || !(ddir == READ && td->o.do_verify && - td->o.verify != VERIFY_NONE && td_random(td))) + if (!should_sort_io(td)) return get_off_from_method(td, f, ddir, b); if (!flist_empty(&td->next_rand_list)) { @@ -223,7 +236,7 @@ static int get_next_rand_block(struct thread_data *td, struct fio_file *f, return 0; if (td->o.time_based) { - fio_file_reset(f); + fio_file_reset(td, f); if (!get_next_rand_offset(td, f, ddir, b)) return 0; } @@ -292,7 +305,7 @@ static int get_next_block(struct thread_data *td, struct io_u *io_u, ret = 1; } } - + if (!ret) { if (offset != -1ULL) io_u->offset = offset; @@ -599,7 +612,7 @@ static enum fio_ddir get_rw_ddir(struct thread_data *td) static void set_rw_ddir(struct thread_data *td, struct io_u *io_u) { - io_u->ddir = get_rw_ddir(td); + io_u->ddir = io_u->acct_ddir = get_rw_ddir(td); if (io_u->ddir == DDIR_WRITE && (td->io_ops->flags & FIO_BARRIER) && td->o.barrier_blocks && @@ -643,14 +656,15 @@ void clear_io_u(struct thread_data *td, struct io_u *io_u) void requeue_io_u(struct thread_data *td, struct io_u **io_u) { struct io_u *__io_u = *io_u; + enum fio_ddir ddir = acct_ddir(__io_u); dprint(FD_IO, "requeue %p\n", __io_u); td_io_u_lock(td); __io_u->flags |= IO_U_F_FREE; - if ((__io_u->flags & IO_U_F_FLIGHT) && ddir_rw(__io_u->ddir)) - td->io_issues[__io_u->ddir]--; + if ((__io_u->flags & IO_U_F_FLIGHT) && ddir_rw(ddir)) + td->io_issues[ddir]--; __io_u->flags &= ~IO_U_F_FLIGHT; if (__io_u->flags & IO_U_F_IN_CUR_DEPTH) @@ -712,13 +726,9 @@ static int fill_io_u(struct thread_data *td, struct io_u *io_u) if (td_random(td) && file_randommap(td, io_u->file)) mark_random_map(td, io_u); - /* - * If using a write iolog, store this entry. - */ out: dprint_io_u(io_u, "fill_io_u"); td->zone_bytes += io_u->buflen; - log_io_u(td, io_u); return 0; } @@ -1084,6 +1094,7 @@ again: io_u->flags &= ~IO_U_F_VER_LIST; io_u->error = 0; + io_u->acct_ddir = -1; flist_del(&io_u->list); flist_add_tail(&io_u->list, &td->io_u_busylist); td->cur_depth++; @@ -1418,7 +1429,8 @@ static void io_completed(struct thread_data *td, struct io_u *io_u, if (td_write(td) && idx == DDIR_WRITE && td->o.do_verify && - td->o.verify != VERIFY_NONE) + td->o.verify != VERIFY_NONE && + !td->o.experimental_verify) log_io_piece(td, io_u); icd->bytes_done[idx] += bytes; @@ -1481,7 +1493,7 @@ static void ios_completed(struct thread_data *td, * Complete a single io_u for the sync engines. */ int io_u_sync_complete(struct thread_data *td, struct io_u *io_u, - unsigned long *bytes) + uint64_t *bytes) { struct io_completion_data icd; @@ -1510,7 +1522,7 @@ int io_u_sync_complete(struct thread_data *td, struct io_u *io_u, * Called to complete min_events number of io for the async engines. */ int io_u_queued_complete(struct thread_data *td, int min_evts, - unsigned long *bytes) + uint64_t *bytes) { struct io_completion_data icd; struct timespec *tvp = NULL;