From c2d93a1c2764c35ccffa8a1adff067a9e8bb6202 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 file changed, 2 insertions(+), 2 deletions(-) Index: mm/fs/libfs.c =================================================================== --- mm.orig/fs/libfs.c 2007-11-28 14:15:15.441727161 -0800 +++ mm/fs/libfs.c 2007-11-28 14:17:47.549228049 -0800 @@ -342,10 +342,10 @@ int simple_prepare_write(struct file *fi 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; }