X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=blktrace.c;h=8a246613d43338d2f715dca0031dafbf164bcbef;hp=e18047658953f718fdded2212bee42237c42ac9a;hb=refs%2Fheads%2Fmaster;hpb=52a0b9ed71c3e929461e64b39059281948107071 diff --git a/blktrace.c b/blktrace.c index e1804765..ef9ce6bf 100644 --- a/blktrace.c +++ b/blktrace.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "flist.h" #include "fio.h" @@ -297,6 +298,10 @@ static bool handle_trace_flush(struct thread_data *td, struct blk_io_trace *t, ios[DDIR_SYNC]++; dprint(FD_BLKTRACE, "store flush delay=%lu\n", ipo->delay); + + if (!(td->flags & TD_F_SYNCS)) + td->flags |= TD_F_SYNCS; + queue_io_piece(td, ipo); return true; } @@ -309,25 +314,14 @@ static bool queue_trace(struct thread_data *td, struct blk_io_trace *t, unsigned long *ios, unsigned long long *bs, struct file_cache *cache) { - unsigned long long *last_ttime = &td->io_log_blktrace_last_ttime; + unsigned long long *last_ttime = &td->io_log_last_ttime; unsigned long long delay = 0; if ((t->action & 0xffff) != __BLK_TA_QUEUE) return false; if (!(t->action & BLK_TC_ACT(BLK_TC_NOTIFY))) { - if (!*last_ttime || td->o.no_stall || t->time < *last_ttime) - delay = 0; - else if (td->o.replay_time_scale == 100) - delay = t->time - *last_ttime; - else { - double tmp = t->time - *last_ttime; - double scale; - - scale = (double) 100.0 / (double) td->o.replay_time_scale; - tmp *= scale; - delay = tmp; - } + delay = delay_since_ttime(td, t->time); *last_ttime = t->time; } @@ -418,7 +412,7 @@ bool init_blktrace_read(struct thread_data *td, const char *filename, int need_s goto err; } td->io_log_blktrace_swap = need_swap; - td->io_log_blktrace_last_ttime = 0; + td->io_log_last_ttime = 0; td->o.size = 0; free_release_files(td); @@ -449,7 +443,10 @@ err: bool read_blktrace(struct thread_data* td) { struct blk_io_trace t; - struct file_cache cache = { }; + struct file_cache cache = { + .maj = ~0U, + .min = ~0U, + }; unsigned long ios[DDIR_RWDIR_SYNC_CNT] = { }; unsigned long long rw_bs[DDIR_RWDIR_CNT] = { }; unsigned long skipped_writes; @@ -549,7 +546,8 @@ bool read_blktrace(struct thread_data* td) td->o.max_bs[DDIR_TRIM] = max(td->o.max_bs[DDIR_TRIM], rw_bs[DDIR_TRIM]); io_u_quiesce(td); free_io_mem(td); - init_io_u_buffers(td); + if (init_io_u_buffers(td)) + return false; } return true; }