Merge branch 'master' of ssh://brick.kernel.dk/data/git/fio
authorJens Axboe <jens.axboe@oracle.com>
Fri, 17 Jul 2009 20:33:45 +0000 (22:33 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 17 Jul 2009 20:33:45 +0000 (22:33 +0200)
init.c
io_u.c
smalloc.c

diff --git a/init.c b/init.c
index 600237488de2b2fd8b94d3f6eb5f12e0aa6217ee..ec36724ab8aceac761d25ff902bdf3b63323cd0e 100644 (file)
--- a/init.c
+++ b/init.c
@@ -20,7 +20,7 @@
 #include "filehash.h"
 #include "verify.h"
 
-static char fio_version_string[] = "fio 1.30";
+static char fio_version_string[] = "fio 1.31";
 
 #define FIO_RANDSEED           (0xb1899bedUL)
 
diff --git a/io_u.c b/io_u.c
index 654980481c8f7fbd5450991684ed6a171fdf8931..96683954a0378f5ad5eb6163ea6e424e401d73ca 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -999,7 +999,7 @@ static void io_completed(struct thread_data *td, struct io_u *io_u,
                                                        &icd->time);
 
                        if (!td->o.disable_clat) {
-                               add_clat_sample(td, idx, usec, bytes);
+                               add_clat_sample(td, idx, lusec, bytes);
                                io_u_mark_latency(td, lusec);
                        }
                        if (!td->o.disable_bw)
index e82ef1da0b59faab23a706db1257808c3fb10bbb..ac5754d5f496119a342180eeae58bb4a229e4cf0 100644 (file)
--- a/smalloc.c
+++ b/smalloc.c
@@ -27,6 +27,7 @@
 #define SMALLOC_POST_RED       0x5aa55aa5U
 
 unsigned int smalloc_pool_size = INITIAL_SIZE;
+const int int_mask = sizeof(int) - 1;
 
 struct pool {
        struct fio_mutex *lock;                 /* protects this pool */
@@ -268,9 +269,19 @@ void scleanup(void)
 }
 
 #ifdef SMALLOC_REDZONE
+static void *postred_ptr(struct block_hdr *hdr)
+{
+       unsigned long ptr;
+
+       ptr = (unsigned long) hdr + hdr->size - sizeof(unsigned int);
+       ptr = (ptr + int_mask) & ~int_mask;
+
+       return (void *) ptr;
+}
+
 static void fill_redzone(struct block_hdr *hdr)
 {
-       unsigned int *postred = (void *) hdr + hdr->size - sizeof(unsigned int);
+       unsigned int *postred = postred_ptr(hdr);
 
        hdr->prered = SMALLOC_PRE_RED;
        *postred = SMALLOC_POST_RED;
@@ -278,7 +289,7 @@ static void fill_redzone(struct block_hdr *hdr)
 
 static void sfree_check_redzone(struct block_hdr *hdr)
 {
-       unsigned int *postred = (void *) hdr + hdr->size - sizeof(unsigned int);
+       unsigned int *postred = postred_ptr(hdr);
 
        if (hdr->prered != SMALLOC_PRE_RED) {
                fprintf(stderr, "smalloc pre redzone destroyed!\n");
@@ -414,8 +425,13 @@ static void *smalloc_pool(struct pool *pool, unsigned int size)
        unsigned int alloc_size = size + sizeof(struct block_hdr);
        void *ptr;
 
+       /*
+        * Round to int alignment, so that the postred pointer will
+        * be naturally aligned as well.
+        */
 #ifdef SMALLOC_REDZONE
        alloc_size += sizeof(unsigned int);
+       alloc_size = (alloc_size + int_mask) & ~int_mask;
 #endif
 
        ptr = __smalloc_pool(pool, alloc_size);