aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/relocation.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r--fs/btrfs/relocation.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index d91f106df665..12096496cc99 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -4458,10 +4458,8 @@ out:
4458int btrfs_reloc_clone_csums(struct inode *inode, u64 file_pos, u64 len) 4458int btrfs_reloc_clone_csums(struct inode *inode, u64 file_pos, u64 len)
4459{ 4459{
4460 struct btrfs_ordered_sum *sums; 4460 struct btrfs_ordered_sum *sums;
4461 struct btrfs_sector_sum *sector_sum;
4462 struct btrfs_ordered_extent *ordered; 4461 struct btrfs_ordered_extent *ordered;
4463 struct btrfs_root *root = BTRFS_I(inode)->root; 4462 struct btrfs_root *root = BTRFS_I(inode)->root;
4464 size_t offset;
4465 int ret; 4463 int ret;
4466 u64 disk_bytenr; 4464 u64 disk_bytenr;
4467 LIST_HEAD(list); 4465 LIST_HEAD(list);
@@ -4475,19 +4473,13 @@ int btrfs_reloc_clone_csums(struct inode *inode, u64 file_pos, u64 len)
4475 if (ret) 4473 if (ret)
4476 goto out; 4474 goto out;
4477 4475
4476 disk_bytenr = ordered->start;
4478 while (!list_empty(&list)) { 4477 while (!list_empty(&list)) {
4479 sums = list_entry(list.next, struct btrfs_ordered_sum, list); 4478 sums = list_entry(list.next, struct btrfs_ordered_sum, list);
4480 list_del_init(&sums->list); 4479 list_del_init(&sums->list);
4481 4480
4482 sector_sum = sums->sums; 4481 sums->bytenr = disk_bytenr;
4483 sums->bytenr = ordered->start; 4482 disk_bytenr += sums->len;
4484
4485 offset = 0;
4486 while (offset < sums->len) {
4487 sector_sum->bytenr += ordered->start - disk_bytenr;
4488 sector_sum++;
4489 offset += root->sectorsize;
4490 }
4491 4483
4492 btrfs_add_ordered_sum(inode, ordered, sums); 4484 btrfs_add_ordered_sum(inode, ordered, sums);
4493 } 4485 }