Skip to content

Commit

Permalink
Btrfs: use right range to find checksum for compressed extents
Browse files Browse the repository at this point in the history
For compressed extents, the range of checksum is covered by disk length,
and the disk length is different with ram length, so we need to use disk
length instead to get us the right checksum.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
  • Loading branch information
Liu Bo authored and Josef Bacik committed Jan 24, 2013
1 parent b017511 commit 192000d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs/btrfs/tree-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -3357,6 +3357,11 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
if (skip_csum)
return 0;

if (em->compress_type) {
csum_offset = 0;
csum_len = block_len;
}

/* block start is already adjusted for the file extent offset. */
ret = btrfs_lookup_csums_range(log->fs_info->csum_root,
em->block_start + csum_offset,
Expand Down

0 comments on commit 192000d

Please sign in to comment.