[PATCH] Support for hugetlb backed shared memory

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/fio.c b/fio.c
index 3ffe1e1..8713614 100644
--- a/fio.c
+++ b/fio.c
@@ -507,7 +507,12 @@
 		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->orig_buffer_size = (td->orig_buffer_size + FIO_HUGE_PAGE - 1) & ~FIO_HUGE_PAGE;
+	else
+		td->orig_buffer_size += MASK;
 
 	if (allocate_io_mem(td))
 		return 1;