fio: fix some struct alignment issues
[fio.git] / fio.h
diff --git a/fio.h b/fio.h
index b67613e6d10bdcb4309e9df6c14f7dbae9cc2f1e..ed631bc70ab0c490c98d3e5432b6eebc109139dc 100644 (file)
--- a/fio.h
+++ b/fio.h
 #define MPOL_LOCAL MPOL_MAX
 #endif
 
+#ifdef CONFIG_CUDA
+#include <cuda.h>
+#endif
+
 /*
  * offset generator types
  */
@@ -145,7 +149,7 @@ struct thread_data {
        unsigned int thread_number;
        unsigned int subjob_number;
        unsigned int groupid;
-       struct thread_stat ts;
+       struct thread_stat ts __attribute__ ((aligned));
 
        int client_type;
 
@@ -408,6 +412,18 @@ struct thread_data {
        struct steadystate_data ss;
 
        char verror[FIO_VERROR_SIZE];
+
+#ifdef CONFIG_CUDA
+       /*
+        * for GPU memory management
+        */
+       int gpu_dev_cnt;
+       int gpu_dev_id;
+       CUdevice  cu_dev;
+       CUcontext cu_ctx;
+       CUdeviceptr dev_mem_ptr;
+#endif 
+
 };
 
 /*
@@ -580,7 +596,8 @@ static inline enum fio_ioengine_flags td_ioengine_flags(struct thread_data *td)
 
 static inline void td_set_ioengine_flags(struct thread_data *td)
 {
-       td->flags |= (td->io_ops->flags << TD_ENG_FLAG_SHIFT);
+       td->flags = (~(TD_ENG_FLAG_MASK << TD_ENG_FLAG_SHIFT) & td->flags) |
+                   (td->io_ops->flags << TD_ENG_FLAG_SHIFT);
 }
 
 static inline bool td_ioengine_flagged(struct thread_data *td,