From: Jens Axboe Date: Thu, 19 Jul 2007 13:06:57 +0000 (+0200) Subject: malloc memory still needs to be aligned, if we are doing direct IO X-Git-Tag: fio-1.16.8~1 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=d87612ac34a3cf1ac94a9ddc0cada672b6541b3c;hp=088b42076dcbadf4d61367e19e49cb0d12aaadd1 malloc memory still needs to be aligned, if we are doing direct IO Signed-off-by: Jens Axboe --- diff --git a/fio.c b/fio.c index 94da6b48..ead118ec 100644 --- 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"); diff --git a/memory.c b/memory.c index 46eb852a..c147229e 100644 --- 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;