From ff5b7ee33d82414bf4baf299c21fb703bcc89629 Mon Sep 17 00:00:00 2001 From: Yan Zheng Date: Mon, 10 Nov 2008 07:34:43 -0500 Subject: 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 --- fs/btrfs/file.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'fs/btrfs/file.c') 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, em->start < start) { split->start = em->start; split->len = start - em->start; + split->orig_start = em->orig_start; split->block_start = em->block_start; if (compressed) @@ -243,6 +244,7 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, split->start = start + len; split->len = em->start + em->len - (start + len); + split->orig_start = em->orig_start; split->bdev = em->bdev; split->flags = flags; -- cgit v1.2.3