Messages in this thread Patch in this message | | | Subject | RE: [PATCH] ftruncate on huge page couldn't extend hugetlb file | Date | Wed, 8 Mar 2006 11:03:20 -0800 | From | "Chen, Kenneth W" <> |
| |
Zhang, Yanmin wrote on Tuesday, March 07, 2006 10:54 PM > From: Zhang Yanmin <yanmin.zhang@intel.com> > > Currently, ftruncate on hugetlb files couldn't extend them. My patch enables it. > > This patch is against 2.6.16-rc5-mm3 and on the top of the patch which > implements mmap on zero-length hugetlb files with PROT_NONE.
Reservation should be already done at the mmap time. Like this?
Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>
--- linux-2.6.15/fs/hugetlbfs/inode.c.orig 2006-03-08 11:39:49.782708398 -0800 +++ linux-2.6.15/fs/hugetlbfs/inode.c 2006-03-08 11:51:04.382309509 -0800 @@ -337,20 +337,18 @@ hugetlb_vmtruncate_list(struct prio_tree } } -/* - * Expanding truncates are not allowed. - */ static int hugetlb_vmtruncate(struct inode *inode, loff_t offset) { unsigned long pgoff; struct address_space *mapping = inode->i_mapping; - if (offset > inode->i_size) - return -EINVAL; - BUG_ON(offset & ~HPAGE_MASK); pgoff = offset >> HPAGE_SHIFT; + if (offset > inode->i_size) { + inode->i_size = offset; + return 0; + } inode->i_size = offset; spin_lock(&mapping->i_mmap_lock); if (!prio_tree_empty(&mapping->i_mmap)) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |