[PATCH] Support for mmap of hugetlb files as memory backing
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index a4efe385bbb11364638d0b3567842189186e1af3..8a4a44dc902f0f0dde0695deceaefb1dbab9ae4a 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -105,7 +105,7 @@ static int check_min_rate(struct thread_data *td, struct timeval *now)
 
                rate = (td->this_io_bytes[ddir] - td->rate_bytes) / spent;
                if (rate < td->ratemin) {
-                       fprintf(f_out, "%s: min rate %d not met, got %ldKiB/sec\n", td->name, td->ratemin, rate);
+                       fprintf(f_out, "%s: min rate %u not met, got %luKiB/sec\n", td->name, td->ratemin, rate);
                        return 1;
                }
        }
@@ -242,7 +242,7 @@ static int fio_io_sync(struct thread_data *td, struct fio_file *f)
  * The main verify engine. Runs over the writes we previusly submitted,
  * reads the blocks back in, and checks the crc/md5 of the data.
  */
-void do_verify(struct thread_data *td)
+static void do_verify(struct thread_data *td)
 {
        struct io_u *io_u, *v_io_u = NULL;
        struct io_completion_data icd;
@@ -507,7 +507,12 @@ static int init_io_u(struct thread_data *td)
                max_units = td->iodepth;
 
        max_bs = max(td->max_bs[DDIR_READ], td->max_bs[DDIR_WRITE]);
-       td->orig_buffer_size = max_bs * max_units + MASK;
+       td->orig_buffer_size = max_bs * max_units;
+
+       if (td->mem_type == MEM_SHMHUGE || td->mem_type == MEM_MMAPHUGE)
+               td->orig_buffer_size = (td->orig_buffer_size + FIO_HUGE_PAGE - 1) & ~(FIO_HUGE_PAGE - 1);
+       else
+               td->orig_buffer_size += MASK;
 
        if (allocate_io_mem(td))
                return 1;