+ free_release_files(td);
+
+ /*
+ * Read in the read iolog and store it, reuse the infrastructure
+ * for doing verifications.
+ */
+ str = malloc(4096);
+ fname = malloc(256+16);
+ act = malloc(256+16);
+
+ reads = writes = 0;
+ while ((p = fgets(str, 4096, f)) != NULL) {
+ struct io_piece *ipo;
+ int r;
+
+ r = sscanf(p, "%256s %256s %llu %u", fname, act, &offset, &bytes);
+ if (r == 4) {
+ /*
+ * Check action first
+ */
+ if (!strcmp(act, "read"))
+ rw = DDIR_READ;
+ else if (!strcmp(act, "write"))
+ rw = DDIR_WRITE;
+ else if (!strcmp(act, "sync"))
+ rw = DDIR_SYNC;
+ else {
+ log_err("fio: bad iolog file action: %s\n",act);
+ continue;
+ }
+ } else if (r == 2) {
+ rw = DDIR_INVAL;
+ if (!strcmp(act, "add")) {
+ td->o.nr_files++;
+ fileno = add_file(td, fname);
+ file_action = FIO_LOG_ADD_FILE;
+ continue;
+ } else if (!strcmp(act, "open")) {
+ fileno = get_fileno(td, fname);
+ file_action = FIO_LOG_OPEN_FILE;
+ } else if (!strcmp(act, "close")) {
+ fileno = get_fileno(td, fname);
+ file_action = FIO_LOG_CLOSE_FILE;
+ } else {
+ log_err("fio: bad iolog file action: %s\n",act);
+ continue;
+ }
+ } else {
+ log_err("bad iolog2: %s", 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 && rw != DDIR_INVAL) {
+ log_err("bad ddir: %d\n", rw);
+ continue;
+ }
+
+ /*
+ * Make note of file
+ */
+ 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;
+ if (rw == DDIR_INVAL) {
+ ipo->fileno = fileno;
+ ipo->file_action = file_action;
+ }
+ list_add_tail(&ipo->list, &td->io_log_list);
+ td->total_io_size += bytes;