Fix pointer alignment bug causing SIGBUS on Sparc64
OK, the issue was related to the alignment issue between the
thread_options structure and its "packed" version : The lexxx_to_cpu
macros are incorrectly casting the pointers and that causes an bus
error. I have fixed the issue by avoid casting the pointers and calling
directly the "swap" method.
I have also included a fixed on the thread_options structure regarding
the ddir_seq_add variable : Its length was incorrect.
Signed-off-by: Jens Axboe <axboe@fb.com>
diff --git a/os/os.h b/os/os.h
index 7f92d1b..2f2d069 100644
--- a/os/os.h
+++ b/os/os.h
@@ -201,28 +201,22 @@
#endif /* FIO_HAVE_BYTEORDER_FUNCS */
#define le16_to_cpu(val) ({ \
- uint16_t *__val = &(val); \
- __le16_to_cpu(*__val); \
+ __le16_to_cpu(val); \
})
#define le32_to_cpu(val) ({ \
- uint32_t *__val = &(val); \
- __le32_to_cpu(*__val); \
+ __le32_to_cpu(val); \
})
#define le64_to_cpu(val) ({ \
- uint64_t *__val = &(val); \
- __le64_to_cpu(*__val); \
+ __le64_to_cpu(val); \
})
#define cpu_to_le16(val) ({ \
- uint16_t *__val = &(val); \
- __cpu_to_le16(*__val); \
+ __cpu_to_le16(val); \
})
#define cpu_to_le32(val) ({ \
- uint32_t *__val = &(val); \
- __cpu_to_le32(*__val); \
+ __cpu_to_le32(val); \
})
#define cpu_to_le64(val) ({ \
- uint64_t *__val = &(val); \
- __cpu_to_le64(*__val); \
+ __cpu_to_le64(val); \
})
#ifndef FIO_HAVE_BLKTRACE
diff --git a/thread_options.h b/thread_options.h
index 4ea6ebd..bacd86b 100644
--- a/thread_options.h
+++ b/thread_options.h
@@ -45,7 +45,7 @@
unsigned int kb_base;
unsigned int unit_base;
unsigned int ddir_seq_nr;
- long ddir_seq_add;
+ long long ddir_seq_add;
unsigned int iodepth;
unsigned int iodepth_low;
unsigned int iodepth_batch;