Tweak handling of write traces with --readonly

Don't add them at all, that allows us to replay a trace with writes
included when the --readonly switch is set. Before it would tell you
that it was 'X' number of writes, and then fail when it tried to
replay then anyway. Now just don't add those events.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/log.c b/log.c
index aea0398..86de3e8 100644
--- a/log.c
+++ b/log.c
@@ -70,9 +70,15 @@
 			struct fio_file *f = td->files[ipo->fileno];
 
 			if (ipo->file_action == FIO_LOG_OPEN_FILE) {
-				assert(!td_io_open_file(td, f));
-				free(ipo);
-				continue;
+				int ret;
+
+				ret = td_io_open_file(td, f);
+				if (!ret) {
+					free(ipo);
+					continue;
+				}
+				td_verror(td, ret, "iolog open file");
+				return 1;
 			} else if (ipo->file_action == FIO_LOG_CLOSE_FILE) {
 				td_io_close_file(td, f);
 				free(ipo);
@@ -247,12 +253,12 @@
 		if (rw == DDIR_READ)
 			reads++;
 		else if (rw == DDIR_WRITE) {
-			writes++;
 			/*
 			 * Don't add a write for ro mode
 			 */
 			if (read_only)
 				continue;
+			writes++;
 		} else if (rw != DDIR_SYNC && rw != DDIR_INVAL) {
 			log_err("bad ddir: %d\n", rw);
 			continue;
@@ -326,12 +332,12 @@
 		if (rw == DDIR_READ)
 			reads++;
 		else if (rw == DDIR_WRITE) {
-			writes++;
 			/*
 			 * Don't add a write for ro mode
 			 */
 			if (read_only)
 				continue;
+			writes++;
 		} else if (rw != DDIR_SYNC) {
 			log_err("bad ddir: %d\n", rw);
 			continue;