diff options
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_aops.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 84e372596d56..91d77ac51bba 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c | |||
@@ -927,11 +927,26 @@ xfs_vm_writepage( | |||
927 | end_index = offset >> PAGE_CACHE_SHIFT; | 927 | end_index = offset >> PAGE_CACHE_SHIFT; |
928 | last_index = (offset - 1) >> PAGE_CACHE_SHIFT; | 928 | last_index = (offset - 1) >> PAGE_CACHE_SHIFT; |
929 | if (page->index >= end_index) { | 929 | if (page->index >= end_index) { |
930 | if ((page->index >= end_index + 1) || | 930 | unsigned offset_into_page = offset & (PAGE_CACHE_SIZE - 1); |
931 | !(i_size_read(inode) & (PAGE_CACHE_SIZE - 1))) { | 931 | |
932 | /* | ||
933 | * Just skip the page if it is fully outside i_size, e.g. due | ||
934 | * to a truncate operation that is in progress. | ||
935 | */ | ||
936 | if (page->index >= end_index + 1 || offset_into_page == 0) { | ||
932 | unlock_page(page); | 937 | unlock_page(page); |
933 | return 0; | 938 | return 0; |
934 | } | 939 | } |
940 | |||
941 | /* | ||
942 | * The page straddles i_size. It must be zeroed out on each | ||
943 | * and every writepage invocation because it may be mmapped. | ||
944 | * "A file is mapped in multiples of the page size. For a file | ||
945 | * that is not a multiple of the page size, the remaining | ||
946 | * memory is zeroed when mapped, and writes to that region are | ||
947 | * not written out to the file." | ||
948 | */ | ||
949 | zero_user_segment(page, offset_into_page, PAGE_CACHE_SIZE); | ||
935 | } | 950 | } |
936 | 951 | ||
937 | end_offset = min_t(unsigned long long, | 952 | end_offset = min_t(unsigned long long, |