windowsaio: initialize and map windowsaio IO structure to io_u
[fio.git] / memory.c
index 82a79bd7175b9a74ca0846a669d767e06d50b84d..4a9dc4af212d05feee7b360c9fd6dd08ea6200f4 100644 (file)
--- a/memory.c
+++ b/memory.c
@@ -5,7 +5,9 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
+#ifndef FIO_NO_HAVE_SHM_H
 #include <sys/shm.h>
+#endif
 #include <sys/mman.h>
 
 #include "fio.h"
@@ -121,6 +123,13 @@ static int alloc_mem_mmap(struct thread_data *td, size_t total_mem)
 
        td->mmapfd = 1;
 
+       if (td->o.mem_type == MEM_MMAPHUGE) {
+               unsigned long mask = td->o.hugepage_size - 1;
+
+               flags |= MAP_HUGETLB;
+               total_mem = (total_mem + mask) & ~mask;
+       }
+
        if (td->mmapfile) {
                td->mmapfd = open(td->mmapfile, O_RDWR|O_CREAT, 0644);