Skip to content

Commit

Permalink
Btrfs: fix csum search offset/length calculation in log tree
Browse files Browse the repository at this point in the history
We were setting the csums search offset and length to the right values if
the extent is compressed, but later on right before doing the csums lookup
we were overriding these two parameters regardless of compression being
set or not for the extent.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
  • Loading branch information
Filipe David Borba Manana authored and Chris Mason committed Nov 12, 2013
1 parent e46f538 commit 488111a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions fs/btrfs/tree-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -3421,11 +3421,6 @@ 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;
}

/*
* First check and see if our csums are on our outstanding ordered
* extents.
Expand Down Expand Up @@ -3509,8 +3504,13 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
if (!mod_len || ret)
return ret;

csum_offset = mod_start - em->start;
csum_len = mod_len;
if (em->compress_type) {
csum_offset = 0;
csum_len = block_len;
} else {
csum_offset = mod_start - em->start;
csum_len = mod_len;
}

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

0 comments on commit 488111a

Please sign in to comment.