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/ioctl.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'fs/btrfs/ioctl.c') diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index caea9eed9d62..b4da53d55c82 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -714,7 +714,8 @@ static long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, u64 len = olen; u64 bs = root->fs_info->sb->s_blocksize; u64 hint_byte; - + u16 csum_size = + btrfs_super_csum_size(&root->fs_info->super_copy); /* * TODO: * - split compressed inline extents. annoying: we need to @@ -964,7 +965,7 @@ static long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, int coff, clen; size = btrfs_item_size_nr(leaf, slot); - coverslen = (size / BTRFS_CRC32_SIZE) << + coverslen = (size / csum_size) << root->fs_info->sb->s_blocksize_bits; printk("csums for %llu~%llu\n", key.offset, coverslen); @@ -981,12 +982,12 @@ static long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, if (off > key.offset) coff = ((off - key.offset) >> root->fs_info->sb->s_blocksize_bits) * - BTRFS_CRC32_SIZE; + csum_size; clen = size - coff; if (key.offset + coverslen > off+len) clen -= ((key.offset+coverslen-off-len) >> root->fs_info->sb->s_blocksize_bits) * - BTRFS_CRC32_SIZE; + csum_size; printk(" will dup %d~%d of %d\n", coff, clen, size); -- cgit v1.2.3