X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=log.c;h=039e74b25e77c5098631b83d1e0fbf16b26b0e27;hp=7a3327e5d29c2909700ba3413ae1bd903ce1f197;hb=65bdb10a09222d8b5d213de74824be775772ea8f;hpb=20e354ef1243541ea196619772b83a962d7cb4df diff --git a/log.c b/log.c index 7a3327e5..039e74b2 100644 --- a/log.c +++ b/log.c @@ -233,9 +233,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; } @@ -256,12 +261,18 @@ static int read_iolog2(struct thread_data *td, FILE *f) ipo->file_action = file_action; } list_add_tail(&ipo->list, &td->io_log_list); + td->total_io_size += bytes; } free(str); 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) @@ -283,7 +294,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 @@ -300,9 +311,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; } @@ -312,14 +328,20 @@ 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); + td->total_io_size += bytes; } 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)