Re: [PATCH] [12/16] Refactor truncate to allow direct truncatingof page

From: Wu Fengguang
Date: Thu Jun 04 2009 - 00:32:30 EST


On Thu, Jun 04, 2009 at 02:46:46AM +0800, Andi Kleen wrote:
>
> From: Nick Piggin <npiggin@xxxxxxx>
>
> Extract out truncate_inode_page() out of the truncate path so that
> it can be used by memory-failure.c
>
> [AK: description, headers, fix typos]
>
> Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
>
> ---
> include/linux/mm.h | 2 ++
> mm/truncate.c | 24 ++++++++++++------------
> 2 files changed, 14 insertions(+), 12 deletions(-)
>
> Index: linux/mm/truncate.c
> ===================================================================
> --- linux.orig/mm/truncate.c 2009-06-03 19:37:38.000000000 +0200
> +++ linux/mm/truncate.c 2009-06-03 20:13:43.000000000 +0200
> @@ -135,6 +135,16 @@
> return ret;
> }
>
> +void truncate_inode_page(struct address_space *mapping, struct page *page)
> +{
> + if (page_mapped(page)) {
> + unmap_mapping_range(mapping,
> + (loff_t)page->index<<PAGE_CACHE_SHIFT,
> + PAGE_CACHE_SIZE, 0);
> + }
> + truncate_complete_page(mapping, page);
> +}
> +

Small style cleanup:

---
mm/truncate.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- sound-2.6.orig/mm/truncate.c
+++ sound-2.6/mm/truncate.c
@@ -139,8 +139,8 @@ void truncate_inode_page(struct address_
{
if (page_mapped(page)) {
unmap_mapping_range(mapping,
- (loff_t)page->index<<PAGE_CACHE_SHIFT,
- PAGE_CACHE_SIZE, 0);
+ (loff_t)page->index << PAGE_CACHE_SHIFT,
+ PAGE_CACHE_SIZE, 0);
}
truncate_complete_page(mapping, page);
}
--
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/