summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ioctl.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/ioctl.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/ioctl.c')
-rw-r--r--fs/btrfs/ioctl.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index caea9eed9d6..b4da53d55c8 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);