malloc memory still needs to be aligned, if we are doing direct IO
authorJens Axboe <jens.axboe@oracle.com>
Thu, 19 Jul 2007 13:06:57 +0000 (15:06 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Thu, 19 Jul 2007 13:06:57 +0000 (15:06 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fio.c
memory.c

diff --git a/fio.c b/fio.c
index 94da6b48744ca7a5bc9fccb019e082c2fb01da30..ead118ec35a0d02572a5366f4fe065a904c0cf05 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -629,8 +629,6 @@ static int init_io_u(struct thread_data *td)
 
        if (td->o.mem_type == MEM_SHMHUGE || td->o.mem_type == MEM_MMAPHUGE)
                td->orig_buffer_size = (td->orig_buffer_size + td->o.hugepage_size - 1) & ~(td->o.hugepage_size - 1);
-       else if (td->orig_buffer_size & page_mask)
-               td->orig_buffer_size = (td->orig_buffer_size + page_mask) & ~page_mask;
 
        if (td->orig_buffer_size != (size_t) td->orig_buffer_size) {
                log_err("fio: IO memory too large. Reduce max_bs or iodepth\n");
index 46eb852a63ed69d59d71972d777009eddbe11a19..c147229e27c67d4135bfe9c64be82f8dbe8e2c46 100644 (file)
--- a/memory.c
+++ b/memory.c
@@ -126,7 +126,12 @@ static int alloc_mem_mmap(struct thread_data *td)
 
 static int alloc_mem_malloc(struct thread_data *td)
 {
-       td->orig_buffer = malloc(td->orig_buffer_size);
+       unsigned int bsize = td->orig_buffer_size;
+
+       if (td->o.odirect)
+               bsize += page_mask;
+               
+       td->orig_buffer = malloc(bsize);
        if (td->orig_buffer)
                return 0;