Full readonly check
Both in core and in engines. To the extent possible, this should catch
even fio errors.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/fio.h b/fio.h
index 20d1408..1b392a0 100644
--- a/fio.h
+++ b/fio.h
@@ -13,6 +13,7 @@
#include <string.h>
#include <getopt.h>
#include <inttypes.h>
+#include <assert.h>
#include "compiler/compiler.h"
#include "list.h"
@@ -670,6 +671,11 @@
#define td_rw(td) (((td)->o.td_ddir & TD_DDIR_RW) == TD_DDIR_RW)
#define td_random(td) ((td)->o.td_ddir & TD_DDIR_RAND)
+static inline void fio_ro_check(struct thread_data *td, struct io_u *io_u)
+{
+ assert(!(io_u->ddir == DDIR_WRITE && !td_write(td)));
+}
+
#define BLOCKS_PER_MAP (8 * sizeof(long))
#define TO_MAP_BLOCK(td, f, b) ((b) - ((f)->file_offset / (td)->o.rw_min_bs))
#define RAND_MAP_IDX(td, f, b) (TO_MAP_BLOCK(td, f, b) / BLOCKS_PER_MAP)