binject: ensure we get aligned memory
authorJens Axboe <jaxboe@fusionio.com>
Thu, 28 Oct 2010 14:52:13 +0000 (08:52 -0600)
committerJens Axboe <jaxboe@fusionio.com>
Thu, 28 Oct 2010 14:52:13 +0000 (08:52 -0600)
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
engines/binject.c
ioengine.h
memory.c

index 7109c7acbf6fb2c40f690acaea5f0791b0741b81..47d40fefbb3f6d8fd0a2037d22da60a5f21cbdfb 100644 (file)
@@ -416,7 +416,7 @@ static struct ioengine_ops ioengine = {
        .open_file      = fio_binject_open_file,
        .close_file     = fio_binject_close_file,
        .get_file_size  = generic_get_file_size,
-       .flags          = FIO_RAWIO | FIO_BARRIER,
+       .flags          = FIO_RAWIO | FIO_BARRIER | FIO_MEMALIGN,
 };
 
 #else /* FIO_HAVE_BINJECT */
index 7a3c08fd7891c48d600c333342d5ad6c5ec65892..a0c7e2bc3e40f893d690435af6d3a5a39f2d9bbe 100644 (file)
@@ -128,6 +128,7 @@ enum fio_ioengine_flags {
        FIO_SIGQUIT     = 1 << 7,       /* needs SIGQUIT to exit */
        FIO_PIPEIO      = 1 << 8,       /* input/output no seekable */
        FIO_BARRIER     = 1 << 9,       /* engine supports barriers */
+       FIO_MEMALIGN    = 1 << 10,      /* engine wants aligned memory */
 };
 
 /*
index 7f4cef529a52e55ecbf099c0e23738943ab2b492..b94cd6df35feed843659bc9bf88921bf55ba9be4 100644 (file)
--- a/memory.c
+++ b/memory.c
@@ -193,7 +193,8 @@ int allocate_io_mem(struct thread_data *td)
 
        total_mem = td->orig_buffer_size;
 
-       if (td->o.odirect || td->o.mem_align) {
+       if (td->o.odirect || td->o.mem_align ||
+           (td->io_ops->flags & FIO_MEMALIGN)) {
                total_mem += page_mask;
                if (td->o.mem_align && td->o.mem_align > page_size)
                        total_mem += td->o.mem_align - page_size;