*/
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
#include <errno.h>
#include <sys/mman.h>
return false;
}
}
- if (posix_madvise(fmd->mmap_ptr, length, POSIX_MADV_DONTNEED) < 0) {
- td_verror(td, errno, "madvise");
- return false;
- }
-
-#ifdef FIO_MADV_FREE
- if (f->filetype == FIO_TYPE_BLOCK)
- (void) posix_madvise(fmd->mmap_ptr, fmd->mmap_sz, FIO_MADV_FREE);
-#endif
return true;
}
if (!fio_madvise_file(td, f, length))
goto err;
+ if (posix_madvise(fmd->mmap_ptr, length, POSIX_MADV_DONTNEED) < 0) {
+ td_verror(td, errno, "madvise");
+ goto err;
+ }
+
+#ifdef FIO_MADV_FREE
+ if (f->filetype == FIO_TYPE_BLOCK)
+ (void) posix_madvise(fmd->mmap_ptr, fmd->mmap_sz, FIO_MADV_FREE);
+#endif
+
err:
if (td->error && fmd->mmap_ptr)
munmap(fmd->mmap_ptr, length);
return 0;
}
-static int fio_mmapio_queue(struct thread_data *td, struct io_u *io_u)
+static enum fio_q_status fio_mmapio_queue(struct thread_data *td,
+ struct io_u *io_u)
{
struct fio_file *f = io_u->file;
struct fio_mmap_data *fmd = FILE_ENG_DATA(f);