Fix pointer alignment bug causing SIGBUS on Sparc64
authorSébastien Bouchex Bellomié <sbouchex@infovista.com>
Tue, 11 Mar 2014 14:54:27 +0000 (08:54 -0600)
committerJens Axboe <axboe@fb.com>
Tue, 11 Mar 2014 14:54:27 +0000 (08:54 -0600)
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>
os/os.h
thread_options.h

diff --git a/os/os.h b/os/os.h
index 7f92d1bc710bbf84a13c582a7e0d5c7893b36697..2f2d06981bdb0cbbdba24e52771551b2ed8a9fbc 100644 (file)
--- a/os/os.h
+++ b/os/os.h
@@ -201,28 +201,22 @@ static inline uint64_t fio_swap64(uint64_t val)
 #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
index 4ea6ebd06a0c07f5212c237f6f7fcfcc808a84c1..bacd86b483aa4f9f2f863227d845d1a76506893f 100644 (file)
@@ -45,7 +45,7 @@ struct thread_options {
        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;