aboutsummaryrefslogtreecommitdiffstats
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 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,
714 u64 len = olen; 714 u64 len = olen;
715 u64 bs = root->fs_info->sb->s_blocksize; 715 u64 bs = root->fs_info->sb->s_blocksize;
716 u64 hint_byte; 716 u64 hint_byte;
717 717 u16 csum_size =
718 btrfs_super_csum_size(&root->fs_info->super_copy);
718 /* 719 /*
719 * TODO: 720 * TODO:
720 * - split compressed inline extents. annoying: we need to 721 * - split compressed inline extents. annoying: we need to
@@ -964,7 +965,7 @@ static long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
964 int coff, clen; 965 int coff, clen;
965 966
966 size = btrfs_item_size_nr(leaf, slot); 967 size = btrfs_item_size_nr(leaf, slot);
967 coverslen = (size / BTRFS_CRC32_SIZE) << 968 coverslen = (size / csum_size) <<
968 root->fs_info->sb->s_blocksize_bits; 969 root->fs_info->sb->s_blocksize_bits;
969 printk("csums for %llu~%llu\n", 970 printk("csums for %llu~%llu\n",
970 key.offset, coverslen); 971 key.offset, coverslen);
@@ -981,12 +982,12 @@ static long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
981 if (off > key.offset) 982 if (off > key.offset)
982 coff = ((off - key.offset) >> 983 coff = ((off - key.offset) >>
983 root->fs_info->sb->s_blocksize_bits) * 984 root->fs_info->sb->s_blocksize_bits) *
984 BTRFS_CRC32_SIZE; 985 csum_size;
985 clen = size - coff; 986 clen = size - coff;
986 if (key.offset + coverslen > off+len) 987 if (key.offset + coverslen > off+len)
987 clen -= ((key.offset+coverslen-off-len) >> 988 clen -= ((key.offset+coverslen-off-len) >>
988 root->fs_info->sb->s_blocksize_bits) * 989 root->fs_info->sb->s_blocksize_bits) *
989 BTRFS_CRC32_SIZE; 990 csum_size;
990 printk(" will dup %d~%d of %d\n", 991 printk(" will dup %d~%d of %d\n",
991 coff, clen, size); 992 coff, clen, size);
992 993