summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-log.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@redhat.com>2008-12-02 07:17:45 -0500
committerChris Mason <chris.mason@oracle.com>2008-12-02 07:17:45 -0500
commit607d432da0542e84ddcd358adfddac6f68500e3d (patch)
tree44425bf1fe8378022bc1b84425ca4ba9d0176566 /fs/btrfs/tree-log.c
parentc6e2bac1a52ffc36dd10769b594dfa3994e95f77 (diff)
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 <jbacik@redhat.com>
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 4fcfc8b1189..c766649ad45 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, &sector_sum->sum, ptr, BTRFS_CRC32_SIZE);
+ read_extent_buffer(eb, &sector_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;
}