aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2009-09-11 12:36:29 -0400
committerChris Mason <chris.mason@oracle.com>2009-09-11 13:31:08 -0400
commit93c82d575055f1bd0277acae6f966bebafd80dd5 (patch)
tree4b059485eb226291dac336921b32653131b0dd43
parent50a9b214bc6c052caa05a210ebfc1bdf0d7085b2 (diff)
Btrfs: zero page past end of inline file items
When btrfs_get_extent is reading inline file items for readpage, it needs to copy the inline extent into the page. If the inline extent doesn't cover all of the page, that means there is a hole in the file, or that our file is smaller than one page. readpage does zeroing for the case where the file is smaller than one page, but nobody is currently zeroing for the case where there is a hole after the inline item. This commit changes btrfs_get_extent to zero fill the page past the end of the inline item. Signed-off-by: Chris Mason <chris.mason@oracle.com>
-rw-r--r--fs/btrfs/inode.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index c846482e7985..88f9df7bfdae 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4233,6 +4233,11 @@ again:
4233 map = kmap(page); 4233 map = kmap(page);
4234 read_extent_buffer(leaf, map + pg_offset, ptr, 4234 read_extent_buffer(leaf, map + pg_offset, ptr,
4235 copy_size); 4235 copy_size);
4236 if (pg_offset + copy_size < PAGE_CACHE_SIZE) {
4237 memset(map + pg_offset + copy_size, 0,
4238 PAGE_CACHE_SIZE - pg_offset -
4239 copy_size);
4240 }
4236 kunmap(page); 4241 kunmap(page);
4237 } 4242 }
4238 flush_dcache_page(page); 4243 flush_dcache_page(page);