X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=log.c;h=66b8f5babfe106ba3d7d1a68ab02d393d3467c22;hp=92bcebfcca5248961b3bf1dfa74f3240199c5089;hb=3a6d267d644226983a430cf0f217c27f4c38cd45;hpb=b3f4b4f51e05b019ee9e5fddb9232975cf15ce93 diff --git a/log.c b/log.c index 92bcebfc..66b8f5ba 100644 --- a/log.c +++ b/log.c @@ -91,6 +91,7 @@ int read_iolog_get(struct thread_data *td, struct io_u *io_u) return 0; } + td->done = 1; return 1; } @@ -173,9 +174,10 @@ static int read_iolog2(struct thread_data *td, FILE *f) { unsigned long long offset; unsigned int bytes; - int rw, reads, writes, fileno = 0, file_action = 0; /* stupid gcc */ + int reads, writes, fileno = 0, file_action = 0; /* stupid gcc */ char *fname, *act; char *str, *p; + enum fio_ddir rw; free_release_files(td); @@ -231,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; } @@ -246,7 +253,7 @@ static int read_iolog2(struct thread_data *td, FILE *f) INIT_LIST_HEAD(&ipo->list); ipo->offset = offset; ipo->len = bytes; - ipo->ddir = (enum fio_ddir) rw; + ipo->ddir = rw; if (bytes > td->o.max_bs[rw]) td->o.max_bs[rw] = bytes; if (rw == DDIR_INVAL) { @@ -254,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) @@ -280,7 +293,8 @@ static int read_iolog(struct thread_data *td, FILE *f) unsigned long long offset; unsigned int bytes; char *str, *p; - int rw, reads, writes; + int reads, writes; + enum fio_ddir rw; /* * Read in the read iolog and store it, reuse the infrastructure @@ -297,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; } @@ -309,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 = (enum fio_ddir) rw; + ipo->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)