X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=engines%2Fmmap.c;h=6671fc0e66d8e78e9f7c0fbeac8dd98a8b4d0946;hp=05a4d5163ce5dbd45a3ba351419417e642b65be1;hb=f6db4fa5a64501a3df72c2c4394d4c8d9fd9d991;hpb=ac89311241264280574c81e6400c9a0c59615082 diff --git a/engines/mmap.c b/engines/mmap.c index 05a4d516..6671fc0e 100644 --- a/engines/mmap.c +++ b/engines/mmap.c @@ -12,6 +12,7 @@ #include #include "../fio.h" +#include "../verify.h" /* * Limits us to 2GB of mapped files in total @@ -43,14 +44,9 @@ static int fio_mmap_file(struct thread_data *td, struct fio_file *f, f->mmap_ptr = NULL; td_verror(td, err, "mmap"); - if (err == EINVAL && f->io_size > 2*1024*1024*1024UL) - log_err("fio: mmap size likely too large\n"); goto err; } - if (file_invalidate_cache(td, f)) - goto err; - if (!td_random(td)) { if (madvise(f->mmap_ptr, length, MADV_SEQUENTIAL) < 0) { td_verror(td, errno, "madvise"); @@ -117,7 +113,7 @@ static int fio_mmapio_queue(struct thread_data *td, struct io_u *io_u) memcpy(io_u->xfer_buf, io_u->mmap_data, io_u->xfer_buflen); else if (io_u->ddir == DDIR_WRITE) memcpy(io_u->mmap_data, io_u->xfer_buf, io_u->xfer_buflen); - else if (io_u->ddir == DDIR_SYNC) { + else if (ddir_sync(io_u->ddir)) { if (msync(f->mmap_ptr, f->mmap_sz, MS_SYNC)) { io_u->error = errno; td_verror(td, io_u->error, "msync"); @@ -127,7 +123,7 @@ static int fio_mmapio_queue(struct thread_data *td, struct io_u *io_u) /* * not really direct, but should drop the pages from the cache */ - if (td->o.odirect && io_u->ddir != DDIR_SYNC) { + if (td->o.odirect && !ddir_sync(io_u->ddir)) { if (msync(io_u->mmap_data, io_u->xfer_buflen, MS_SYNC) < 0) { io_u->error = errno; td_verror(td, io_u->error, "msync");