- unsigned long shift, mask;
-
- mmap_map_size = MMAP_TOTAL_SZ / td->o.nr_files;
- mask = mmap_map_size;
- shift = 0;
- do {
- mask >>= 1;
- if (!mask)
- break;
- shift++;
- } while (1);
-
- mmap_map_mask = 1UL << shift;
+ struct thread_options *o = &td->o;
+
+ if ((o->rw_min_bs & page_mask) &&
+ (o->odirect || o->fsync_blocks || o->fdatasync_blocks)) {
+ log_err("fio: mmap options dictate a minimum block size of "
+ "%llu bytes\n", (unsigned long long) page_size);
+ return 1;
+ }
+
+ mmap_map_size = MMAP_TOTAL_SZ / o->nr_files;
+ return 0;
+}
+
+static int fio_mmapio_open_file(struct thread_data *td, struct fio_file *f)
+{
+ struct fio_mmap_data *fmd;
+ int ret;
+
+ ret = generic_open_file(td, f);
+ if (ret)
+ return ret;
+
+ fmd = calloc(1, sizeof(*fmd));
+ if (!fmd) {
+ int fio_unused __ret;
+ __ret = generic_close_file(td, f);
+ return 1;
+ }
+
+ FILE_SET_ENG_DATA(f, fmd);