Add support for O_ATOMIC
[fio.git] / memory.c
index f1cd2d770f4cbe3597ecbc5e236b355e930fc49a..b208320c5d88cc619f7167626e3b7502ded07799 100644 (file)
--- a/memory.c
+++ b/memory.c
@@ -5,12 +5,12 @@
 #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"
+#ifndef FIO_NO_HAVE_SHM_H
+#include <sys/shm.h>
+#endif
 
 void fio_unpin_memory(struct thread_data *td)
 {
@@ -209,7 +209,7 @@ 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->o.oatomic ||
            (td->io_ops->flags & FIO_MEMALIGN)) {
                total_mem += page_mask;
                if (td->o.mem_align && td->o.mem_align > page_size)
@@ -240,7 +240,7 @@ void free_io_mem(struct thread_data *td)
        unsigned int total_mem;
 
        total_mem = td->orig_buffer_size;
-       if (td->o.odirect)
+       if (td->o.odirect || td->o.oatomic)
                total_mem += page_mask;
 
        if (td->o.mem_type == MEM_MALLOC)