From: Jens Axboe Date: Sat, 22 Jan 2011 22:11:13 +0000 (-0700) Subject: mmap: catch invalid msync() errors early X-Git-Tag: fio-1.50~4 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=913ea0db12596b735a030a1836bd913497b7120a;ds=inline mmap: catch invalid msync() errors early Reported-by: Bruce Cran Signed-off-by: Jens Axboe --- diff --git a/engines/mmap.c b/engines/mmap.c index 059bfcfa..79238b1e 100644 --- a/engines/mmap.c +++ b/engines/mmap.c @@ -181,8 +181,16 @@ static int fio_mmapio_queue(struct thread_data *td, struct io_u *io_u) static int fio_mmapio_init(struct thread_data *td) { + struct thread_options *o = &td->o; unsigned long shift, mask; + if ((td->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 " + "%lu bytes\n", page_size); + return 1; + } + mmap_map_size = MMAP_TOTAL_SZ / td->o.nr_files; mask = mmap_map_size; shift = 0;