binject: ensure we get aligned memory
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
diff --git a/engines/binject.c b/engines/binject.c
index 7109c7a..47d40fe 100644
--- a/engines/binject.c
+++ b/engines/binject.c
@@ -416,7 +416,7 @@
.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 */
diff --git a/ioengine.h b/ioengine.h
index 7a3c08f..a0c7e2b 100644
--- a/ioengine.h
+++ b/ioengine.h
@@ -128,6 +128,7 @@
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 */
};
/*
diff --git a/memory.c b/memory.c
index 7f4cef5..b94cd6d 100644
--- a/memory.c
+++ b/memory.c
@@ -193,7 +193,8 @@
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;