From 4cc35634219a79db5a75c7c063fa1b6d351164e6 Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Tue, 28 Aug 2007 14:40:57 -0700 Subject: [PATCH] Do not use f_mapping in simple_prepare_write() Seems that simple_prepare_write() may occasionally be called for a page that does not have a mapping yet. Retrieve the page size from the page instead of the mapping. Signed-off-by: Christoph Lameter --- fs/libfs.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/libfs.c b/fs/libfs.c index 5788495..4e83b3e 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -341,10 +341,10 @@ int simple_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to) { if (!PageUptodate(page)) { - if (to - from != page_cache_size(file->f_mapping)) + if (to - from != page_cache_page_size(page)) zero_user_segments(page, 0, from, - to, page_cache_size(file->f_mapping)); + to, page_cache_page_size(page)); } return 0; } -- 1.5.4.1