aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-log.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r--fs/btrfs/tree-log.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 4fcfc8b1189b..c766649ad453 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -929,13 +929,15 @@ static noinline int replay_one_csum(struct btrfs_trans_handle *trans,
929 int ret; 929 int ret;
930 u32 item_size = btrfs_item_size_nr(eb, slot); 930 u32 item_size = btrfs_item_size_nr(eb, slot);
931 u64 cur_offset; 931 u64 cur_offset;
932 u16 csum_size =
933 btrfs_super_csum_size(&root->fs_info->super_copy);
932 unsigned long file_bytes; 934 unsigned long file_bytes;
933 struct btrfs_ordered_sum *sums; 935 struct btrfs_ordered_sum *sums;
934 struct btrfs_sector_sum *sector_sum; 936 struct btrfs_sector_sum *sector_sum;
935 struct inode *inode; 937 struct inode *inode;
936 unsigned long ptr; 938 unsigned long ptr;
937 939
938 file_bytes = (item_size / BTRFS_CRC32_SIZE) * root->sectorsize; 940 file_bytes = (item_size / csum_size) * root->sectorsize;
939 inode = read_one_inode(root, key->objectid); 941 inode = read_one_inode(root, key->objectid);
940 if (!inode) { 942 if (!inode) {
941 return -EIO; 943 return -EIO;
@@ -959,10 +961,10 @@ static noinline int replay_one_csum(struct btrfs_trans_handle *trans,
959 ptr = btrfs_item_ptr_offset(eb, slot); 961 ptr = btrfs_item_ptr_offset(eb, slot);
960 while(item_size > 0) { 962 while(item_size > 0) {
961 sector_sum->offset = cur_offset; 963 sector_sum->offset = cur_offset;
962 read_extent_buffer(eb, &sector_sum->sum, ptr, BTRFS_CRC32_SIZE); 964 read_extent_buffer(eb, &sector_sum->sum, ptr, csum_size);
963 sector_sum++; 965 sector_sum++;
964 item_size -= BTRFS_CRC32_SIZE; 966 item_size -= csum_size;
965 ptr += BTRFS_CRC32_SIZE; 967 ptr += csum_size;
966 cur_offset += root->sectorsize; 968 cur_offset += root->sectorsize;
967 } 969 }
968 970