hugetlb: allow extending ftruncate on hugetlbfs
[linux-2.6.git] / fs / hugetlbfs / inode.c
index 70fbb29..8f8e133 100644 (file)
@@ -322,21 +322,15 @@ hugetlb_vmtruncate_list(struct prio_tree_root *root, pgoff_t pgoff)
        }
 }
 
-/*
- * Expanding truncates are not allowed.
- */
 static int hugetlb_vmtruncate(struct inode *inode, loff_t offset)
 {
        pgoff_t pgoff;
        struct address_space *mapping = inode->i_mapping;
 
-       if (offset > inode->i_size)
-               return -EINVAL;
-
        BUG_ON(offset & ~HPAGE_MASK);
        pgoff = offset >> PAGE_SHIFT;
 
-       inode->i_size = offset;
+       i_size_write(inode, offset);
        spin_lock(&mapping->i_mmap_lock);
        if (!prio_tree_empty(&mapping->i_mmap))
                hugetlb_vmtruncate_list(&mapping->i_mmap, pgoff);