mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 15:27:29 +00:00
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>
This commit is contained in:
parent
f2b1c41cf9
commit
ff5b7ee33d
4 changed files with 8 additions and 4 deletions
|
@ -3949,6 +3949,8 @@ again:
|
|||
found_type == BTRFS_FILE_EXTENT_PREALLOC) {
|
||||
em->start = extent_start;
|
||||
em->len = extent_end - extent_start;
|
||||
em->orig_start = extent_start -
|
||||
btrfs_file_extent_offset(leaf, item);
|
||||
bytenr = btrfs_file_extent_disk_bytenr(leaf, item);
|
||||
if (bytenr == 0) {
|
||||
em->block_start = EXTENT_MAP_HOLE;
|
||||
|
@ -3988,6 +3990,7 @@ again:
|
|||
em->start = extent_start + extent_offset;
|
||||
em->len = (copy_size + root->sectorsize - 1) &
|
||||
~((u64)root->sectorsize - 1);
|
||||
em->orig_start = EXTENT_MAP_INLINE;
|
||||
if (compressed)
|
||||
set_bit(EXTENT_FLAG_COMPRESSED, &em->flags);
|
||||
ptr = btrfs_file_extent_inline_start(item) + extent_offset;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue