* [patch] hugetlb: allow extending ftruncate on hugetlbfs
@ 2007-08-01 23:36 Ken Chen
2007-08-02 13:05 ` William Lee Irwin III
0 siblings, 1 reply; 2+ messages in thread
From: Ken Chen @ 2007-08-01 23:36 UTC (permalink / raw)
To: Adam Litke, William Lee Irwin III, Andrew Morton; +Cc: linux-mm
For historical reason, expanding ftruncate that increases file size on
hugetlbfs is not allowed due to pages were pre-faulted and lack of
fault handler. Now that we have demand faulting on hugetlb since
2.6.15, there is no reason to hold back that limitation.
This will make hugetlbfs behave more like a normal fs. I'm writing a
user level code that uses hugetlbfs but will fall back to tmpfs if
there are no hugetlb page available in the system. Having hugetlbfs
specific ftruncate behavior is a bit quirky and I would like to remove
that artificial limitation.
Signed-off-by: <kenchen@google.com>
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index c848a19..a255aac 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -313,21 +313,15 @@ hugetlb_vmtruncate_list(struct prio_tree
}
}
-/*
- * 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);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [patch] hugetlb: allow extending ftruncate on hugetlbfs
2007-08-01 23:36 [patch] hugetlb: allow extending ftruncate on hugetlbfs Ken Chen
@ 2007-08-02 13:05 ` William Lee Irwin III
0 siblings, 0 replies; 2+ messages in thread
From: William Lee Irwin III @ 2007-08-02 13:05 UTC (permalink / raw)
To: Ken Chen; +Cc: Adam Litke, Andrew Morton, linux-mm
On Wed, Aug 01, 2007 at 04:36:15PM -0700, Ken Chen wrote:
> For historical reason, expanding ftruncate that increases file size on
> hugetlbfs is not allowed due to pages were pre-faulted and lack of
> fault handler. Now that we have demand faulting on hugetlb since
> 2.6.15, there is no reason to hold back that limitation.
> This will make hugetlbfs behave more like a normal fs. I'm writing a
> user level code that uses hugetlbfs but will fall back to tmpfs if
> there are no hugetlb page available in the system. Having hugetlbfs
> specific ftruncate behavior is a bit quirky and I would like to remove
> that artificial limitation.
> Signed-off-by: <kenchen@google.com>
Excellent, thank you.
Acked-by: Wiliam Irwin <wli@holomorphy.com>
-- wli
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-08-02 13:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-01 23:36 [patch] hugetlb: allow extending ftruncate on hugetlbfs Ken Chen
2007-08-02 13:05 ` William Lee Irwin III
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox