-
- if (sscanf(p, "%d,%llu,%u", &rw, &offset, &bytes) != 3) {
- fprintf(stderr, "bad iolog: %s\n", p);
+ int r;
+
+ r = sscanf(p, "%256s %256s %llu %u", fname, act, &offset,
+ &bytes);
+ if (r == 4) {
+ /*
+ * Check action first
+ */
+ if (!strcmp(act, "wait"))
+ rw = DDIR_WAIT;
+ else if (!strcmp(act, "read"))
+ rw = DDIR_READ;
+ else if (!strcmp(act, "write"))
+ rw = DDIR_WRITE;
+ else if (!strcmp(act, "sync"))
+ rw = DDIR_SYNC;
+ else if (!strcmp(act, "datasync"))
+ rw = DDIR_DATASYNC;
+ else if (!strcmp(act, "trim"))
+ rw = DDIR_TRIM;
+ 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);