aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 280ac1aa9b6d..bbf04e80a1a3 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3278,6 +3278,7 @@ static int noinline relocate_data_extent(struct inode *reloc_inode,
3278 3278
3279 em->start = extent_key->objectid - offset; 3279 em->start = extent_key->objectid - offset;
3280 em->len = extent_key->offset; 3280 em->len = extent_key->offset;
3281 em->block_len = extent_key->offset;
3281 em->block_start = extent_key->objectid; 3282 em->block_start = extent_key->objectid;
3282 em->bdev = root->fs_info->fs_devices->latest_bdev; 3283 em->bdev = root->fs_info->fs_devices->latest_bdev;
3283 set_bit(EXTENT_FLAG_PINNED, &em->flags); 3284 set_bit(EXTENT_FLAG_PINNED, &em->flags);
@@ -3314,10 +3315,14 @@ struct btrfs_ref_path {
3314}; 3315};
3315 3316
3316struct disk_extent { 3317struct disk_extent {
3318 u64 ram_bytes;
3317 u64 disk_bytenr; 3319 u64 disk_bytenr;
3318 u64 disk_num_bytes; 3320 u64 disk_num_bytes;
3319 u64 offset; 3321 u64 offset;
3320 u64 num_bytes; 3322 u64 num_bytes;
3323 u8 compression;
3324 u8 encryption;
3325 u16 other_encoding;
3321}; 3326};
3322 3327
3323static int is_cowonly_root(u64 root_objectid) 3328static int is_cowonly_root(u64 root_objectid)
@@ -3631,6 +3636,11 @@ static int noinline get_new_locations(struct inode *reloc_inode,
3631 btrfs_file_extent_disk_num_bytes(leaf, fi); 3636 btrfs_file_extent_disk_num_bytes(leaf, fi);
3632 exts[nr].offset = btrfs_file_extent_offset(leaf, fi); 3637 exts[nr].offset = btrfs_file_extent_offset(leaf, fi);
3633 exts[nr].num_bytes = btrfs_file_extent_num_bytes(leaf, fi); 3638 exts[nr].num_bytes = btrfs_file_extent_num_bytes(leaf, fi);
3639 exts[nr].ram_bytes = btrfs_file_extent_ram_bytes(leaf, fi);
3640 exts[nr].compression = btrfs_file_extent_compression(leaf, fi);
3641 exts[nr].encryption = btrfs_file_extent_encryption(leaf, fi);
3642 exts[nr].other_encoding = btrfs_file_extent_other_encoding(leaf,
3643 fi);
3634 WARN_ON(exts[nr].offset > 0); 3644 WARN_ON(exts[nr].offset > 0);
3635 WARN_ON(exts[nr].num_bytes != exts[nr].disk_num_bytes); 3645 WARN_ON(exts[nr].num_bytes != exts[nr].disk_num_bytes);
3636 3646
@@ -3846,6 +3856,8 @@ next:
3846 new_extents[0].disk_bytenr); 3856 new_extents[0].disk_bytenr);
3847 btrfs_set_file_extent_disk_num_bytes(leaf, fi, 3857 btrfs_set_file_extent_disk_num_bytes(leaf, fi,
3848 new_extents[0].disk_num_bytes); 3858 new_extents[0].disk_num_bytes);
3859 btrfs_set_file_extent_ram_bytes(leaf, fi,
3860 new_extents[0].ram_bytes);
3849 ext_offset += new_extents[0].offset; 3861 ext_offset += new_extents[0].offset;
3850 btrfs_set_file_extent_offset(leaf, fi, ext_offset); 3862 btrfs_set_file_extent_offset(leaf, fi, ext_offset);
3851 btrfs_mark_buffer_dirty(leaf); 3863 btrfs_mark_buffer_dirty(leaf);
@@ -3911,6 +3923,16 @@ next:
3911 new_extents[i].disk_bytenr); 3923 new_extents[i].disk_bytenr);
3912 btrfs_set_file_extent_disk_num_bytes(leaf, fi, 3924 btrfs_set_file_extent_disk_num_bytes(leaf, fi,
3913 new_extents[i].disk_num_bytes); 3925 new_extents[i].disk_num_bytes);
3926 btrfs_set_file_extent_ram_bytes(leaf, fi,
3927 new_extents[i].ram_bytes);
3928
3929 btrfs_set_file_extent_compression(leaf, fi,
3930 new_extents[i].compression);
3931 btrfs_set_file_extent_encryption(leaf, fi,
3932 new_extents[i].encryption);
3933 btrfs_set_file_extent_other_encoding(leaf, fi,
3934 new_extents[i].other_encoding);
3935
3914 btrfs_set_file_extent_num_bytes(leaf, fi, 3936 btrfs_set_file_extent_num_bytes(leaf, fi,
3915 extent_len); 3937 extent_len);
3916 ext_offset += new_extents[i].offset; 3938 ext_offset += new_extents[i].offset;
@@ -4169,6 +4191,8 @@ static int noinline replace_extents_in_leaf(struct btrfs_trans_handle *trans,
4169 ref->extents[ext_index].num_bytes = new_extent->disk_num_bytes; 4191 ref->extents[ext_index].num_bytes = new_extent->disk_num_bytes;
4170 4192
4171 btrfs_set_file_extent_generation(leaf, fi, trans->transid); 4193 btrfs_set_file_extent_generation(leaf, fi, trans->transid);
4194 btrfs_set_file_extent_ram_bytes(leaf, fi,
4195 new_extent->ram_bytes);
4172 btrfs_set_file_extent_disk_bytenr(leaf, fi, 4196 btrfs_set_file_extent_disk_bytenr(leaf, fi,
4173 new_extent->disk_bytenr); 4197 new_extent->disk_bytenr);
4174 btrfs_set_file_extent_disk_num_bytes(leaf, fi, 4198 btrfs_set_file_extent_disk_num_bytes(leaf, fi,
@@ -4847,7 +4871,8 @@ static struct inode noinline *create_reloc_inode(struct btrfs_fs_info *fs_info,
4847 BUG_ON(err); 4871 BUG_ON(err);
4848 4872
4849 err = btrfs_insert_file_extent(trans, root, objectid, 0, 0, 0, 4873 err = btrfs_insert_file_extent(trans, root, objectid, 0, 0, 0,
4850 group->key.offset, 0); 4874 group->key.offset, 0, group->key.offset,
4875 0, 0, 0);
4851 BUG_ON(err); 4876 BUG_ON(err);
4852 4877
4853 inode = btrfs_iget_locked(root->fs_info->sb, objectid, root); 4878 inode = btrfs_iget_locked(root->fs_info->sb, objectid, root);