aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r--fs/btrfs/extent_io.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 2a3624adc0cf..17c508a941eb 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1988,9 +1988,12 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
1988 u64 nr_delalloc; 1988 u64 nr_delalloc;
1989 u64 delalloc_end; 1989 u64 delalloc_end;
1990 1990
1991
1991 WARN_ON(!PageLocked(page)); 1992 WARN_ON(!PageLocked(page));
1992 if (page->index > end_index) { 1993 page_offset = i_size & (PAGE_CACHE_SIZE - 1);
1993 clear_extent_dirty(tree, start, page_end, GFP_NOFS); 1994 if (page->index > end_index ||
1995 (page->index == end_index && !page_offset)) {
1996 page->mapping->a_ops->invalidatepage(page, 0);
1994 unlock_page(page); 1997 unlock_page(page);
1995 return 0; 1998 return 0;
1996 } 1999 }
@@ -1998,13 +2001,13 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
1998 if (page->index == end_index) { 2001 if (page->index == end_index) {
1999 char *userpage; 2002 char *userpage;
2000 2003
2001 size_t offset = i_size & (PAGE_CACHE_SIZE - 1);
2002
2003 userpage = kmap_atomic(page, KM_USER0); 2004 userpage = kmap_atomic(page, KM_USER0);
2004 memset(userpage + offset, 0, PAGE_CACHE_SIZE - offset); 2005 memset(userpage + page_offset, 0,
2005 flush_dcache_page(page); 2006 PAGE_CACHE_SIZE - page_offset);
2006 kunmap_atomic(userpage, KM_USER0); 2007 kunmap_atomic(userpage, KM_USER0);
2008 flush_dcache_page(page);
2007 } 2009 }
2010 page_offset = 0;
2008 2011
2009 set_page_extent_mapped(page); 2012 set_page_extent_mapped(page);
2010 2013