From: Benjamin Herrenschmidt Date: Sun, 6 May 2007 21:50:12 +0000 (-0700) Subject: get_unmapped_area handles MAP_FIXED in hugetlbfs X-Git-Tag: v2.6.22-rc1~929 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=036e08568cbee4b16e14551e9f004c3d490d6271;p=linux-2.6 get_unmapped_area handles MAP_FIXED in hugetlbfs Generic hugetlb_get_unmapped_area() now handles MAP_FIXED by just calling prepare_hugepage_range() Signed-off-by: Benjamin Herrenschmidt Acked-by: William Irwin Cc: Paul Mackerras Cc: Richard Henderson Cc: Ivan Kokshaysky Cc: Russell King Cc: David Howells Cc: Andi Kleen Cc: "Luck, Tony" Cc: Kyle McMartin Cc: Grant Grundler Cc: Matthew Wilcox Cc: "David S. Miller" Cc: Adam Litke Cc: David Gibson Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 8e1b7825e2..fe625cd171 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -112,6 +113,12 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, if (len > TASK_SIZE) return -ENOMEM; + if (flags & MAP_FIXED) { + if (prepare_hugepage_range(addr, len, pgoff)) + return -EINVAL; + return addr; + } + if (addr) { addr = ALIGN(addr, HPAGE_SIZE); vma = find_vma(mm, addr);