aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
authorYan Zheng <zheng.yan@oracle.com>2008-11-10 07:34:43 -0500
committerChris Mason <chris.mason@oracle.com>2008-11-10 07:34:43 -0500
commitff5b7ee33d82414bf4baf299c21fb703bcc89629 (patch)
tree926786cf57b375e5ef1f865427c910c3d4bdfc7a /fs/btrfs/file.c
parentf2b1c41cf94d7f839fe9ede5f3ead92698a93fb3 (diff)
Btrfs: Fix csum error for compressed data
The decompress code doesn't take the logical offset in extent pointer into account. If the logical offset isn't zero, data will be decompressed into wrong pages. The solution used here is to record the starting offset of the extent in the file separately from the logical start of the extent_map struct. This allows us to avoid problems inserting overlapping extents. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r--fs/btrfs/file.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 337221ecca27..85841c538805 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -222,6 +222,7 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
222 em->start < start) { 222 em->start < start) {
223 split->start = em->start; 223 split->start = em->start;
224 split->len = start - em->start; 224 split->len = start - em->start;
225 split->orig_start = em->orig_start;
225 split->block_start = em->block_start; 226 split->block_start = em->block_start;
226 227
227 if (compressed) 228 if (compressed)
@@ -243,6 +244,7 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
243 244
244 split->start = start + len; 245 split->start = start + len;
245 split->len = em->start + em->len - (start + len); 246 split->len = em->start + em->len - (start + len);
247 split->orig_start = em->orig_start;
246 split->bdev = em->bdev; 248 split->bdev = em->bdev;
247 split->flags = flags; 249 split->flags = flags;
248 250