From 607d432da0542e84ddcd358adfddac6f68500e3d Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Tue, 2 Dec 2008 07:17:45 -0500 Subject: Btrfs: add support for multiple csum algorithms This patch gives us the space we will need in order to have different csum algorithims at some point in the future. We save the csum algorithim type in the superblock, and use those instead of define's. Signed-off-by: Josef Bacik --- fs/btrfs/tree-log.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'fs/btrfs/tree-log.c') 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, int ret; u32 item_size = btrfs_item_size_nr(eb, slot); u64 cur_offset; + u16 csum_size = + btrfs_super_csum_size(&root->fs_info->super_copy); unsigned long file_bytes; struct btrfs_ordered_sum *sums; struct btrfs_sector_sum *sector_sum; struct inode *inode; unsigned long ptr; - file_bytes = (item_size / BTRFS_CRC32_SIZE) * root->sectorsize; + file_bytes = (item_size / csum_size) * root->sectorsize; inode = read_one_inode(root, key->objectid); if (!inode) { return -EIO; @@ -959,10 +961,10 @@ static noinline int replay_one_csum(struct btrfs_trans_handle *trans, ptr = btrfs_item_ptr_offset(eb, slot); while(item_size > 0) { sector_sum->offset = cur_offset; - read_extent_buffer(eb, §or_sum->sum, ptr, BTRFS_CRC32_SIZE); + read_extent_buffer(eb, §or_sum->sum, ptr, csum_size); sector_sum++; - item_size -= BTRFS_CRC32_SIZE; - ptr += BTRFS_CRC32_SIZE; + item_size -= csum_size; + ptr += csum_size; cur_offset += root->sectorsize; } -- cgit v1.2.3