+ if ((td)->files_index) \
+ for ((i) = 0, (f) = (td)->files[0]; \
+ (i) < (td)->o.nr_files && ((f) = (td)->files[i]) != NULL; \
+ (i)++)
+
+#define fio_assert(td, cond) do { \
+ if (!(cond)) { \
+ int *__foo = NULL; \
+ fprintf(stderr, "file:%s:%d, assert %s failed\n", __FILE__, __LINE__, #cond); \
+ (td)->runstate = TD_EXITED; \
+ (td)->error = EFAULT; \
+ *__foo = 0; \
+ } \
+} while (0)
+
+static inline void fio_file_reset(struct fio_file *f)
+{
+ f->last_free_lookup = 0;
+ f->last_pos = f->file_offset;
+}
+
+static inline void clear_error(struct thread_data *td)
+{
+ td->error = 0;
+ td->verror[0] = '\0';
+}
+
+#ifdef FIO_INC_DEBUG
+static inline void dprint_io_u(struct io_u *io_u, const char *p)
+{
+ struct fio_file *f = io_u->file;
+
+ dprint(FD_IO, "%s: io_u %p: off=%llu/len=%lu/ddir=%d", p, io_u,
+ io_u->offset, io_u->buflen, io_u->ddir);
+ if (fio_debug & (1 << FD_IO)) {
+ if (f)
+ log_info("/%s", f->file_name);
+
+ log_info("\n");
+ }
+}
+#else
+#define dprint_io_u(io_u, p)
+#endif