diff options
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r-- | fs/btrfs/relocation.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 704a1b8d2a2b..4febca4fc2de 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -1773,7 +1773,7 @@ again: | |||
1773 | if (!eb || !extent_buffer_uptodate(eb)) { | 1773 | if (!eb || !extent_buffer_uptodate(eb)) { |
1774 | ret = (!eb) ? -ENOMEM : -EIO; | 1774 | ret = (!eb) ? -ENOMEM : -EIO; |
1775 | free_extent_buffer(eb); | 1775 | free_extent_buffer(eb); |
1776 | return ret; | 1776 | break; |
1777 | } | 1777 | } |
1778 | btrfs_tree_lock(eb); | 1778 | btrfs_tree_lock(eb); |
1779 | if (cow) { | 1779 | if (cow) { |
@@ -3350,6 +3350,11 @@ static int delete_block_group_cache(struct btrfs_fs_info *fs_info, | |||
3350 | } | 3350 | } |
3351 | 3351 | ||
3352 | truncate: | 3352 | truncate: |
3353 | ret = btrfs_check_trunc_cache_free_space(root, | ||
3354 | &fs_info->global_block_rsv); | ||
3355 | if (ret) | ||
3356 | goto out; | ||
3357 | |||
3353 | path = btrfs_alloc_path(); | 3358 | path = btrfs_alloc_path(); |
3354 | if (!path) { | 3359 | if (!path) { |
3355 | ret = -ENOMEM; | 3360 | ret = -ENOMEM; |
@@ -4077,7 +4082,7 @@ out: | |||
4077 | return inode; | 4082 | return inode; |
4078 | } | 4083 | } |
4079 | 4084 | ||
4080 | static struct reloc_control *alloc_reloc_control(void) | 4085 | static struct reloc_control *alloc_reloc_control(struct btrfs_fs_info *fs_info) |
4081 | { | 4086 | { |
4082 | struct reloc_control *rc; | 4087 | struct reloc_control *rc; |
4083 | 4088 | ||
@@ -4088,7 +4093,8 @@ static struct reloc_control *alloc_reloc_control(void) | |||
4088 | INIT_LIST_HEAD(&rc->reloc_roots); | 4093 | INIT_LIST_HEAD(&rc->reloc_roots); |
4089 | backref_cache_init(&rc->backref_cache); | 4094 | backref_cache_init(&rc->backref_cache); |
4090 | mapping_tree_init(&rc->reloc_root_tree); | 4095 | mapping_tree_init(&rc->reloc_root_tree); |
4091 | extent_io_tree_init(&rc->processed_blocks, NULL); | 4096 | extent_io_tree_init(&rc->processed_blocks, |
4097 | fs_info->btree_inode->i_mapping); | ||
4092 | return rc; | 4098 | return rc; |
4093 | } | 4099 | } |
4094 | 4100 | ||
@@ -4105,7 +4111,7 @@ int btrfs_relocate_block_group(struct btrfs_root *extent_root, u64 group_start) | |||
4105 | int rw = 0; | 4111 | int rw = 0; |
4106 | int err = 0; | 4112 | int err = 0; |
4107 | 4113 | ||
4108 | rc = alloc_reloc_control(); | 4114 | rc = alloc_reloc_control(fs_info); |
4109 | if (!rc) | 4115 | if (!rc) |
4110 | return -ENOMEM; | 4116 | return -ENOMEM; |
4111 | 4117 | ||
@@ -4306,7 +4312,7 @@ int btrfs_recover_relocation(struct btrfs_root *root) | |||
4306 | if (list_empty(&reloc_roots)) | 4312 | if (list_empty(&reloc_roots)) |
4307 | goto out; | 4313 | goto out; |
4308 | 4314 | ||
4309 | rc = alloc_reloc_control(); | 4315 | rc = alloc_reloc_control(root->fs_info); |
4310 | if (!rc) { | 4316 | if (!rc) { |
4311 | err = -ENOMEM; | 4317 | err = -ENOMEM; |
4312 | goto out; | 4318 | goto out; |