Re: [PATCH 1/1] Enable fully functional truncate for hugetlbfs

From: Ken Chen
Date: Mon Feb 12 2007 - 17:15:29 EST


On 2/12/07, Dave McCracken <dave.mccracken@xxxxxxxxxx> wrote:
This patch enables the full functionality of truncate for hugetlbfs
files. Truncate was originally limited to reducing the file size
because page faults were not supported for hugetlbfs. Now that page
faults have been implemented it is now possible to fully support
truncate.

ye!

--- 2.6.20/./fs/hugetlbfs/inode.c 2007-02-04 12:44:54.000000000 -0600
+++ 2.6.20-htrunc/./fs/hugetlbfs/inode.c 2007-02-05 13:02:00.000000000 -0600
+ if (hugetlb_reserve_pages(inode, inode->i_size >> HPAGE_SHIFT,
+ offset >> HPAGE_SHIFT))
+ goto out_mem;
+ i_size_write(inode, offset);

hugetlb_reserve_pages() is used to reserve pages for shared mapping
and is used only for the size of mapping at the time of mmap(). We
shouldn't call this function when expanding hugetlb file.

- Ken
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/