Move rw= write && read_only check to ->verify callback

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/init.c b/init.c
index 84c312f..cd32725 100644
--- a/init.c
+++ b/init.c
@@ -241,11 +241,13 @@
 	}
 #endif
 
+#if 0
 	if (read_only && td_write(td)) {
 		log_err("fio: job <%s> has write bit set, but fio is in"
 			" read-only mode\n", td->o.name);
 		return 1;
 	}
+#endif
 
 	if (o->write_iolog_file && o->read_iolog_file) {
 		log_err("fio: read iolog overrides write_iolog\n");
diff --git a/options.c b/options.c
index 7135231..354067d 100644
--- a/options.c
+++ b/options.c
@@ -575,6 +575,19 @@
 	return 0;
 }
 
+static int rw_verify(struct fio_option *o, void *data)
+{
+	struct thread_data *td = data;
+
+	if (read_only && td_write(td)) {
+		log_err("fio: job <%s> has write bit set, but fio is in"
+			" read-only mode\n", td->o.name);
+		return 1;
+	}
+
+	return 0;
+}
+
 #define __stringify_1(x)	#x
 #define __stringify(x)		__stringify_1(x)
 
@@ -648,6 +661,7 @@
 		.off1	= td_var_offset(td_ddir),
 		.help	= "IO direction",
 		.def	= "read",
+		.verify	= rw_verify,
 		.posval = {
 			  { .ival = "read",
 			    .oval = TD_DDIR_READ,