X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=iolog.c;h=bfafc032f4bc63dc03964d4b050d2a0089723916;hb=a1e070c87536ad8803c04bcb60660a3ab649763d;hp=760d7b0a43d97962bb7d065c6e464c7b89a7f5f5;hpb=e6fe02651641fc64d2fa4fcfe9b1013b2947d11b;p=fio.git diff --git a/iolog.c b/iolog.c index 760d7b0a..bfafc032 100644 --- a/iolog.c +++ b/iolog.c @@ -4,7 +4,6 @@ */ #include #include -#include #include #include #include @@ -15,11 +14,11 @@ #include "flist.h" #include "fio.h" -#include "verify.h" #include "trim.h" #include "filelock.h" #include "smalloc.h" #include "blktrace.h" +#include "pshared.h" static int iolog_flush(struct io_log *log); @@ -184,7 +183,7 @@ int read_iolog_get(struct thread_data *td, struct io_u *io_u) void prune_io_piece_log(struct thread_data *td) { struct io_piece *ipo; - struct rb_node *n; + struct fio_rb_node *n; while ((n = rb_first(&td->io_hist_tree)) != NULL) { ipo = rb_entry(n, struct io_piece, rb_node); @@ -208,7 +207,7 @@ void prune_io_piece_log(struct thread_data *td) */ void log_io_piece(struct thread_data *td, struct io_u *io_u) { - struct rb_node **p, *parent; + struct fio_rb_node **p, *parent; struct io_piece *ipo, *__ipo; ipo = malloc(sizeof(struct io_piece)); @@ -694,10 +693,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) { @@ -718,8 +717,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; @@ -743,10 +742,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)); @@ -979,7 +978,7 @@ int iolog_file_inflate(const char *file) struct iolog_compress ic; z_stream stream; struct stat sb; - ssize_t ret; + size_t ret; size_t total; void *buf; FILE *f; @@ -1001,12 +1000,12 @@ int iolog_file_inflate(const char *file) ic.seq = 1; ret = fread(ic.buf, ic.len, 1, f); - if (ret < 0) { + if (ret == 0 && ferror(f)) { perror("fread"); fclose(f); free(buf); return 1; - } else if (ret != 1) { + } else if (ferror(f) || (!feof(f) && ret != 1)) { log_err("fio: short read on reading log\n"); fclose(f); free(buf); @@ -1141,8 +1140,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) @@ -1152,10 +1149,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); }