diff options
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r-- | fs/btrfs/ioctl.c | 9 |
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 | ||