]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - fs/hugetlbfs/inode.c
[PATCH] Hugetlb: Copy on Write support
[mirror_ubuntu-zesty-kernel.git] / fs / hugetlbfs / inode.c
index e026c807e6b376fe57deb2dc2050d1d58d7c917a..8c41315a6e4294e782a4be7e450885447ffd79d3 100644 (file)
@@ -63,7 +63,7 @@ static void huge_pagevec_release(struct pagevec *pvec)
  *
  * Result is in bytes to be compatible with is_hugepage_mem_enough()
  */
-unsigned long
+static unsigned long
 huge_pages_needed(struct address_space *mapping, struct vm_area_struct *vma)
 {
        int i;
@@ -100,9 +100,6 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
        loff_t len, vma_len;
        int ret;
 
-       if ((vma->vm_flags & (VM_MAYSHARE | VM_WRITE)) == VM_WRITE)
-               return -EINVAL;
-
        if (vma->vm_pgoff & (HPAGE_SIZE / PAGE_SIZE - 1))
                return -EINVAL;
 
@@ -512,10 +509,14 @@ static int hugetlbfs_statfs(struct super_block *sb, struct kstatfs *buf)
        buf->f_bsize = HPAGE_SIZE;
        if (sbinfo) {
                spin_lock(&sbinfo->stat_lock);
-               buf->f_blocks = sbinfo->max_blocks;
-               buf->f_bavail = buf->f_bfree = sbinfo->free_blocks;
-               buf->f_files = sbinfo->max_inodes;
-               buf->f_ffree = sbinfo->free_inodes;
+               /* If no limits set, just report 0 for max/free/used
+                * blocks, like simple_statfs() */
+               if (sbinfo->max_blocks >= 0) {
+                       buf->f_blocks = sbinfo->max_blocks;
+                       buf->f_bavail = buf->f_bfree = sbinfo->free_blocks;
+                       buf->f_files = sbinfo->max_inodes;
+                       buf->f_ffree = sbinfo->free_inodes;
+               }
                spin_unlock(&sbinfo->stat_lock);
        }
        buf->f_namelen = NAME_MAX;