X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=iolog.c;h=31d674c24dab7dc607bd7c43b120f524e7ae5ab9;hb=0225849f62ec1bb0ca92465476fe909df6fc2393;hp=2bc3e3a1ca9961d0d2ac1f88fb40f0afcafe18b7;hpb=af2fde1961fe6847b7f3dbbc74aa46ec09d0e129;p=fio.git diff --git a/iolog.c b/iolog.c index 2bc3e3a1..31d674c2 100644 --- a/iolog.c +++ b/iolog.c @@ -109,6 +109,11 @@ static int ipo_special(struct thread_data *td, struct io_piece *ipo) switch (ipo->file_action) { case FIO_LOG_OPEN_FILE: + if (td->o.replay_redirect && fio_file_open(f)) { + dprint(FD_FILE, "iolog: ignoring re-open of file %s\n", + f->file_name); + break; + } ret = td_io_open_file(td, f); if (!ret) break; @@ -272,7 +277,7 @@ restart: overlap = 1; if (overlap) { - dprint(FD_IO, "iolog: overlap %llu/%lu, %llu/%lu", + dprint(FD_IO, "iolog: overlap %llu/%lu, %llu/%lu\n", __ipo->offset, __ipo->len, ipo->offset, ipo->len); td->io_hist_len--; @@ -396,8 +401,14 @@ static int read_iolog2(struct thread_data *td, FILE *f) } else if (r == 2) { rw = DDIR_INVAL; if (!strcmp(act, "add")) { - fileno = add_file(td, fname, 0, 1); - file_action = FIO_LOG_ADD_FILE; + if (td->o.replay_redirect && + get_fileno(td, fname) != -1) { + dprint(FD_FILE, "iolog: ignoring" + " re-add of file %s\n", fname); + } else { + fileno = add_file(td, fname, 0, 1); + file_action = FIO_LOG_ADD_FILE; + } continue; } else if (!strcmp(act, "open")) { fileno = get_fileno(td, fname); @@ -411,7 +422,7 @@ static int read_iolog2(struct thread_data *td, FILE *f) continue; } } else { - log_err("bad iolog2: %s", p); + log_err("bad iolog2: %s\n", p); continue; } @@ -443,7 +454,12 @@ static int read_iolog2(struct thread_data *td, FILE *f) if (rw == DDIR_WAIT) { ipo->delay = offset; } else { - ipo->offset = offset; + if (td->o.replay_scale) + ipo->offset = offset / td->o.replay_scale; + else + ipo->offset = offset; + ipo_bytes_align(td->o.replay_align, ipo); + ipo->len = bytes; if (rw != DDIR_INVAL && bytes > td->o.max_bs[rw]) td->o.max_bs[rw] = bytes; @@ -680,7 +696,7 @@ void free_log(struct io_log *log) sfree(log); } -inline unsigned long hist_sum(int j, int stride, unsigned int *io_u_plat, +unsigned long hist_sum(int j, int stride, unsigned int *io_u_plat, unsigned int *io_u_plat_last) { unsigned long sum;