Commit 488111aa authored by Filipe David Borba Manana's avatar Filipe David Borba Manana Committed by Chris Mason

Btrfs: fix csum search offset/length calculation in log tree

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: default avatarFilipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent e46f5388
...@@ -3421,11 +3421,6 @@ static int log_one_extent(struct btrfs_trans_handle *trans, ...@@ -3421,11 +3421,6 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
if (skip_csum) if (skip_csum)
return 0; 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 * First check and see if our csums are on our outstanding ordered
* extents. * extents.
...@@ -3509,8 +3504,13 @@ static int log_one_extent(struct btrfs_trans_handle *trans, ...@@ -3509,8 +3504,13 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
if (!mod_len || ret) if (!mod_len || ret)
return ret; return ret;
if (em->compress_type) {
csum_offset = 0;
csum_len = block_len;
} else {
csum_offset = mod_start - em->start; csum_offset = mod_start - em->start;
csum_len = mod_len; csum_len = mod_len;
}
/* block start is already adjusted for the file extent offset. */ /* block start is already adjusted for the file extent offset. */
ret = btrfs_lookup_csums_range(log->fs_info->csum_root, ret = btrfs_lookup_csums_range(log->fs_info->csum_root,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment