- if (!reads && !writes)
- return 1;
- else if (reads && !writes)
- td->o.td_ddir = TD_DDIR_READ;
- else if (!reads && writes)
- td->o.td_ddir = TD_DDIR_WRITE;
- else
- td->o.td_ddir = TD_DDIR_RW;
-
- return 0;
-}
-
-/*
- * Read version 1 iolog data.
- */
-static int read_iolog(struct thread_data *td, FILE *f)
-{
- unsigned long long offset;
- unsigned int bytes;
- char *str, *p;
- int reads, writes;
- int rw;
-
- /*
- * Read in the read iolog and store it, reuse the infrastructure
- * for doing verifications.
- */
- str = malloc(4096);
- reads = writes = 0;
- while ((p = fgets(str, 4096, f)) != NULL) {
- struct io_piece *ipo;
-
- if (sscanf(p, "%d,%llu,%u", &rw, &offset, &bytes) != 3) {
- log_err("bad iolog: %s\n", p);
- continue;
- }
- if (rw == DDIR_READ)
- reads++;
- else if (rw == DDIR_WRITE) {
- writes++;
- /*
- * 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;
- }
-
- ipo = malloc(sizeof(*ipo));
- memset(ipo, 0, sizeof(*ipo));
- INIT_LIST_HEAD(&ipo->list);
- ipo->offset = offset;
- ipo->len = bytes;
- 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)