+ f->mmap_sz = mmap_map_size;
+ if (f->mmap_sz > f->io_size)
+ f->mmap_sz = f->io_size;
+
+ f->mmap_off = io_u->offset;
+
+ return fio_mmap_file(td, f, f->mmap_sz, f->mmap_off);
+}
+
+/*
+ * Attempt to mmap the entire file
+ */
+static int fio_mmapio_prep_full(struct thread_data *td, struct io_u *io_u)
+{
+ struct fio_file *f = io_u->file;
+ int ret;
+
+ if (fio_file_partial_mmap(f))
+ return EINVAL;
+
+ f->mmap_sz = f->io_size;
+ f->mmap_off = 0;
+
+ ret = fio_mmap_file(td, f, f->mmap_sz, f->mmap_off);
+ if (ret)
+ fio_file_set_partial_mmap(f);
+
+ return ret;
+}
+
+static int fio_mmapio_prep(struct thread_data *td, struct io_u *io_u)
+{
+ struct fio_file *f = io_u->file;
+ int ret;
+
+ /*
+ * It fits within existing mapping, use it
+ */