- 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;
- enum fio_ddir 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++;
- 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 = 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;