X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=log.c;h=5b21ee224d2b7a24131563581e5ff4e019f7c118;hp=759771ae6a5d3167b7fcb36f92990164d3faf351;hb=b271fe62101e84cd6ca2a78c92299beba251db24;hpb=ea966f8188915643670fd0a13d1bf37d45936da5 diff --git a/log.c b/log.c index 759771ae..5b21ee22 100644 --- a/log.c +++ b/log.c @@ -84,6 +84,9 @@ int read_iolog_get(struct thread_data *td, struct io_u *io_u) io_u->file = &td->files[ipo->fileno]; get_file(io_u->file); + dprint(FD_IO, "iolog: get %llu/%lu/%s\n", io_u->offset, + io_u->buflen, io_u->file->file_name); + if (ipo->delay) iolog_delay(td, ipo->delay); @@ -233,9 +236,14 @@ static int read_iolog2(struct thread_data *td, FILE *f) if (rw == DDIR_READ) reads++; - else if (rw == DDIR_WRITE) + else if (rw == DDIR_WRITE) { writes++; - else if (rw != DDIR_SYNC && rw != DDIR_INVAL) { + /* + * Don't add a write for ro mode + */ + if (read_only) + continue; + } else if (rw != DDIR_SYNC && rw != DDIR_INVAL) { log_err("bad ddir: %d\n", rw); continue; } @@ -263,6 +271,11 @@ static int read_iolog2(struct thread_data *td, FILE *f) free(act); free(fname); + if (writes && read_only) { + log_err("fio: <%s> skips replay of %d writes due to read-only\n", td->o.name, writes); + writes = 0; + } + if (!reads && !writes) return 1; else if (reads && !writes) @@ -284,7 +297,7 @@ static int read_iolog(struct thread_data *td, FILE *f) unsigned int bytes; char *str, *p; int reads, writes; - enum fio_ddir rw; + int rw; /* * Read in the read iolog and store it, reuse the infrastructure @@ -301,9 +314,14 @@ static int read_iolog(struct thread_data *td, FILE *f) } if (rw == DDIR_READ) reads++; - else if (rw == DDIR_WRITE) + else if (rw == DDIR_WRITE) { writes++; - else if (rw != DDIR_SYNC) { + /* + * Don't add a write for ro mode + */ + if (read_only) + continue; + } else if (rw != DDIR_SYNC) { log_err("bad ddir: %d\n", rw); continue; } @@ -313,7 +331,7 @@ static int read_iolog(struct thread_data *td, FILE *f) INIT_LIST_HEAD(&ipo->list); ipo->offset = offset; ipo->len = bytes; - ipo->ddir = rw; + ipo->ddir = (enum fio_ddir) rw; if (bytes > td->o.max_bs[rw]) td->o.max_bs[rw] = bytes; list_add_tail(&ipo->list, &td->io_log_list); @@ -322,6 +340,11 @@ static int read_iolog(struct thread_data *td, FILE *f) free(str); + if (writes && read_only) { + log_err("fio: <%s> skips replay of %d writes due to read-only\n", td->o.name, writes); + writes = 0; + } + if (!reads && !writes) return 1; else if (reads && !writes)