Merge branch 'xnvme_includes' of https://github.com/safl/fio
[fio.git] / ioengines.c
index 843dd466373a28ae853b1b4e62c3cdbd6eeeff8c..361727250eb70ff0932e899d8f31e98ddeaecba6 100644 (file)
@@ -17,6 +17,7 @@
 #include <assert.h>
 #include <sys/types.h>
 #include <dirent.h>
+#include <errno.h>
 
 #include "fio.h"
 #include "diskutil.h"
@@ -341,10 +342,14 @@ enum fio_q_status td_io_queue(struct thread_data *td, struct io_u *io_u)
         * started the overlap check because the IO_U_F_FLIGHT
         * flag is now set
         */
-       if (io_u->flags & IO_U_F_OVERLAP_LOCK) {
-               int res = pthread_mutex_unlock(&overlap_check);
-               assert(res == 0);
-               io_u_clear(td, io_u, IO_U_F_OVERLAP_LOCK);
+       if (td_offload_overlap(td)) {
+               int res;
+
+               res = pthread_mutex_unlock(&overlap_check);
+               if (fio_unlikely(res != 0)) {
+                       log_err("failed to unlock overlap check mutex, err: %i:%s", errno, strerror(errno));
+                       abort();
+               }
        }
 
        assert(fio_file_open(io_u->file));
@@ -566,6 +571,10 @@ int td_io_open_file(struct thread_data *td, struct fio_file *f)
                        flags = POSIX_FADV_RANDOM;
                else if (td->o.fadvise_hint == F_ADV_SEQUENTIAL)
                        flags = POSIX_FADV_SEQUENTIAL;
+#ifdef POSIX_FADV_NOREUSE
+               else if (td->o.fadvise_hint == F_ADV_NOREUSE)
+                       flags = POSIX_FADV_NOREUSE;
+#endif
                else {
                        log_err("fio: unknown fadvise type %d\n",
                                                        td->o.fadvise_hint);