Sometimes we allocated too little memory for buffers
authorJens Axboe <jens.axboe@oracle.com>
Tue, 20 Mar 2007 12:53:39 +0000 (13:53 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 20 Mar 2007 12:53:39 +0000 (13:53 +0100)
Fix it by adding page_mask to the allocation size, then the
alignment is guarenteed to fit.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fio.c

diff --git a/fio.c b/fio.c
index 3c01156d1bd2d20c6f97c3c7ff58bcb9ea5bd59a..92cb6573ac60f72562c1364dd0e20b3a43b465d1 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -599,7 +599,7 @@ static int init_io_u(struct thread_data *td)
                max_units = td->o.iodepth;
 
        max_bs = max(td->o.max_bs[DDIR_READ], td->o.max_bs[DDIR_WRITE]);
-       td->orig_buffer_size = max_bs * max_units;
+       td->orig_buffer_size = page_mask + (max_bs * max_units);
 
        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);