Improve thread reap handling
[fio.git] / fio.h
diff --git a/fio.h b/fio.h
index aeb45bf73611bd718ae0cfd89294b04c600e9fb6..7a4b1d19c8ebfa527814bee59976b014b5de9a99 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -76,6 +76,11 @@ struct syslet_req {
 };
 #endif
 
+enum {
+       IO_U_F_FREE     = 1 << 0,
+       IO_U_F_FLIGHT   = 1 << 1,
+};
+
 /*
  * The io unit
  */
@@ -124,6 +129,8 @@ struct io_u {
                unsigned int seen;
        };
 
+       unsigned int flags;
+
        struct fio_file *file;
 
        struct list_head list;
@@ -421,8 +428,21 @@ struct thread_data {
         */
        struct list_head io_hist_list;
        struct list_head io_log_list;
+
+       /*
+        * timeout handling
+        */
+       struct timeval timeout_end;
+       struct itimerval timer;
 };
 
+/*
+ * 30 second per-io_u timeout, with 5 second intervals to avoid resetting
+ * the timer on each queue operation.
+ */
+#define IO_U_TIMEOUT_INC       5
+#define IO_U_TIMEOUT           30
+
 #define __td_verror(td, err, msg)                                      \
        do {                                                            \
                if ((td)->error)                                        \
@@ -557,6 +577,7 @@ extern void usec_sleep(struct thread_data *, unsigned long);
 extern void rate_throttle(struct thread_data *, unsigned long, unsigned int, int);
 extern void fill_start_time(struct timeval *);
 extern void fio_gettime(struct timeval *, void *);
+extern void set_genesis_time(void);
 
 /*
  * Init functions
@@ -621,6 +642,8 @@ extern void requeue_io_u(struct thread_data *, struct io_u **);
 extern long __must_check io_u_sync_complete(struct thread_data *, struct io_u *, endio_handler *);
 extern long __must_check io_u_queued_complete(struct thread_data *, int, endio_handler *);
 extern void io_u_queued(struct thread_data *, struct io_u *);
+extern void io_u_init_timeout(void);
+extern void io_u_set_timeout(struct thread_data *);
 
 /*
  * io engine entry points