X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=iolog.c;h=fc3dade39cff50d1b058ab8cda39cb78c77095f0;hb=6cc0e5aa9eddd2487dfa9ac80be1264151058409;hp=27c14eb3630fda9179722d17bf0229374190e042;hpb=858bce7034e75e3134245c0262fa49473100dd44;p=fio.git diff --git a/iolog.c b/iolog.c index 27c14eb3..fc3dade3 100644 --- a/iolog.c +++ b/iolog.c @@ -227,21 +227,16 @@ void log_io_piece(struct thread_data *td, struct io_u *io_u) } /* - * We don't need to sort the entries, if: + * We don't need to sort the entries if we only performed sequential + * writes. In this case, just reading back data in the order we wrote + * it out is the faster but still safe. * - * Sequential writes, or - * Random writes that lay out the file as it goes along - * - * For both these cases, just reading back data in the order we - * wrote it out is the fastest. - * - * One exception is if we don't have a random map AND we are doing - * verifies, in that case we need to check for duplicate blocks and - * drop the old one, which we rely on the rb insert/lookup for - * handling. + * One exception is if we don't have a random map in which case we need + * to check for duplicate blocks and drop the old one, which we rely on + * the rb insert/lookup for handling. */ - if (((!td->o.verifysort) || !td_random(td) || !td->o.overwrite) && - (file_randommap(td, ipo->file) || td->o.verify == VERIFY_NONE)) { + if (((!td->o.verifysort) || !td_random(td)) && + file_randommap(td, ipo->file)) { INIT_FLIST_HEAD(&ipo->list); flist_add_tail(&ipo->list, &td->io_hist_list); ipo->flags |= IP_F_ONLIST; @@ -284,7 +279,8 @@ restart: td->io_hist_len--; rb_erase(parent, &td->io_hist_tree); remove_trim_entry(td, __ipo); - free(__ipo); + if (!(__ipo->flags & IP_F_IN_FLIGHT)) + free(__ipo); goto restart; } } @@ -698,10 +694,10 @@ void free_log(struct io_log *log) sfree(log); } -unsigned long hist_sum(int j, int stride, unsigned int *io_u_plat, - unsigned int *io_u_plat_last) +uint64_t hist_sum(int j, int stride, uint64_t *io_u_plat, + uint64_t *io_u_plat_last) { - unsigned long sum; + uint64_t sum; int k; if (io_u_plat_last) { @@ -722,8 +718,8 @@ static void flush_hist_samples(FILE *f, int hist_coarseness, void *samples, int log_offset; uint64_t i, j, nr_samples; struct io_u_plat_entry *entry, *entry_before; - unsigned int *io_u_plat; - unsigned int *io_u_plat_before; + uint64_t *io_u_plat; + uint64_t *io_u_plat_before; int stride = 1 << hist_coarseness; @@ -747,10 +743,10 @@ static void flush_hist_samples(FILE *f, int hist_coarseness, void *samples, fprintf(f, "%lu, %u, %u, ", (unsigned long) s->time, io_sample_ddir(s), s->bs); for (j = 0; j < FIO_IO_U_PLAT_NR - stride; j += stride) { - fprintf(f, "%lu, ", hist_sum(j, stride, io_u_plat, - io_u_plat_before)); + fprintf(f, "%llu, ", (unsigned long long) + hist_sum(j, stride, io_u_plat, io_u_plat_before)); } - fprintf(f, "%lu\n", (unsigned long) + fprintf(f, "%llu\n", (unsigned long long) hist_sum(FIO_IO_U_PLAT_NR - stride, stride, io_u_plat, io_u_plat_before)); @@ -1145,8 +1141,6 @@ size_t log_chunk_sizes(struct io_log *log) #ifdef CONFIG_ZLIB -static bool warned_on_drop; - static void iolog_put_deferred(struct io_log *log, void *ptr) { if (!ptr) @@ -1156,10 +1150,8 @@ static void iolog_put_deferred(struct io_log *log, void *ptr) if (log->deferred < IOLOG_MAX_DEFER) { log->deferred_items[log->deferred] = ptr; log->deferred++; - } else if (!warned_on_drop) { + } else if (!fio_did_warn(FIO_WARN_IOLOG_DROP)) log_err("fio: had to drop log entry free\n"); - warned_on_drop = true; - } pthread_mutex_unlock(&log->deferred_free_lock); }