aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hugetlbfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hugetlbfs/inode.c')
-rw-r--r--fs/hugetlbfs/inode.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 8c718a3d413f..98959b87cdf8 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -22,6 +22,7 @@
22#include <linux/backing-dev.h> 22#include <linux/backing-dev.h>
23#include <linux/hugetlb.h> 23#include <linux/hugetlb.h>
24#include <linux/pagevec.h> 24#include <linux/pagevec.h>
25#include <linux/mman.h>
25#include <linux/quotaops.h> 26#include <linux/quotaops.h>
26#include <linux/slab.h> 27#include <linux/slab.h>
27#include <linux/dnotify.h> 28#include <linux/dnotify.h>
@@ -98,10 +99,7 @@ out:
98 * Called under down_write(mmap_sem). 99 * Called under down_write(mmap_sem).
99 */ 100 */
100 101
101#ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA 102#ifndef HAVE_ARCH_HUGETLB_UNMAPPED_AREA
102unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
103 unsigned long len, unsigned long pgoff, unsigned long flags);
104#else
105static unsigned long 103static unsigned long
106hugetlb_get_unmapped_area(struct file *file, unsigned long addr, 104hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
107 unsigned long len, unsigned long pgoff, unsigned long flags) 105 unsigned long len, unsigned long pgoff, unsigned long flags)
@@ -115,6 +113,12 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
115 if (len > TASK_SIZE) 113 if (len > TASK_SIZE)
116 return -ENOMEM; 114 return -ENOMEM;
117 115
116 if (flags & MAP_FIXED) {
117 if (prepare_hugepage_range(addr, len, pgoff))
118 return -EINVAL;
119 return addr;
120 }
121
118 if (addr) { 122 if (addr) {
119 addr = ALIGN(addr, HPAGE_SIZE); 123 addr = ALIGN(addr, HPAGE_SIZE);
120 vma = find_vma(mm, addr); 124 vma = find_vma(mm, addr);
@@ -453,7 +457,7 @@ static int hugetlbfs_symlink(struct inode *dir,
453 */ 457 */
454static int hugetlbfs_set_page_dirty(struct page *page) 458static int hugetlbfs_set_page_dirty(struct page *page)
455{ 459{
456 struct page *head = (struct page *)page_private(page); 460 struct page *head = compound_head(page);
457 461
458 SetPageDirty(head); 462 SetPageDirty(head);
459 return 0; 463 return 0;
@@ -552,8 +556,7 @@ static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
552{ 556{
553 struct hugetlbfs_inode_info *ei = (struct hugetlbfs_inode_info *)foo; 557 struct hugetlbfs_inode_info *ei = (struct hugetlbfs_inode_info *)foo;
554 558
555 if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == 559 if (flags & SLAB_CTOR_CONSTRUCTOR)
556 SLAB_CTOR_CONSTRUCTOR)
557 inode_init_once(&ei->vfs_inode); 560 inode_init_once(&ei->vfs_inode);
558} 561}
559 562
@@ -744,6 +747,9 @@ struct file *hugetlb_zero_setup(size_t size)
744 char buf[16]; 747 char buf[16];
745 static atomic_t counter; 748 static atomic_t counter;
746 749
750 if (!hugetlbfs_vfsmount)
751 return ERR_PTR(-ENOENT);
752
747 if (!can_do_hugetlb_shm()) 753 if (!can_do_hugetlb_shm())
748 return ERR_PTR(-EPERM); 754 return ERR_PTR(-EPERM);
749 755