diff options
Diffstat (limited to 'fs/btrfs/extent-tree.c')
| -rw-r--r-- | fs/btrfs/extent-tree.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index c6a5d9095d5f..4669c6f8a44d 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -2763,6 +2763,7 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags, | |||
| 2763 | if (found) { | 2763 | if (found) { |
| 2764 | spin_lock(&found->lock); | 2764 | spin_lock(&found->lock); |
| 2765 | found->total_bytes += total_bytes; | 2765 | found->total_bytes += total_bytes; |
| 2766 | found->disk_total += total_bytes * factor; | ||
| 2766 | found->bytes_used += bytes_used; | 2767 | found->bytes_used += bytes_used; |
| 2767 | found->disk_used += bytes_used * factor; | 2768 | found->disk_used += bytes_used * factor; |
| 2768 | found->full = 0; | 2769 | found->full = 0; |
| @@ -2782,6 +2783,7 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags, | |||
| 2782 | BTRFS_BLOCK_GROUP_SYSTEM | | 2783 | BTRFS_BLOCK_GROUP_SYSTEM | |
| 2783 | BTRFS_BLOCK_GROUP_METADATA); | 2784 | BTRFS_BLOCK_GROUP_METADATA); |
| 2784 | found->total_bytes = total_bytes; | 2785 | found->total_bytes = total_bytes; |
| 2786 | found->disk_total = total_bytes * factor; | ||
| 2785 | found->bytes_used = bytes_used; | 2787 | found->bytes_used = bytes_used; |
| 2786 | found->disk_used = bytes_used * factor; | 2788 | found->disk_used = bytes_used * factor; |
| 2787 | found->bytes_pinned = 0; | 2789 | found->bytes_pinned = 0; |
| @@ -8095,6 +8097,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, | |||
| 8095 | struct btrfs_free_cluster *cluster; | 8097 | struct btrfs_free_cluster *cluster; |
| 8096 | struct btrfs_key key; | 8098 | struct btrfs_key key; |
| 8097 | int ret; | 8099 | int ret; |
| 8100 | int factor; | ||
| 8098 | 8101 | ||
| 8099 | root = root->fs_info->extent_root; | 8102 | root = root->fs_info->extent_root; |
| 8100 | 8103 | ||
| @@ -8103,6 +8106,12 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, | |||
| 8103 | BUG_ON(!block_group->ro); | 8106 | BUG_ON(!block_group->ro); |
| 8104 | 8107 | ||
| 8105 | memcpy(&key, &block_group->key, sizeof(key)); | 8108 | memcpy(&key, &block_group->key, sizeof(key)); |
| 8109 | if (block_group->flags & (BTRFS_BLOCK_GROUP_DUP | | ||
| 8110 | BTRFS_BLOCK_GROUP_RAID1 | | ||
| 8111 | BTRFS_BLOCK_GROUP_RAID10)) | ||
| 8112 | factor = 2; | ||
| 8113 | else | ||
| 8114 | factor = 1; | ||
| 8106 | 8115 | ||
| 8107 | /* make sure this block group isn't part of an allocation cluster */ | 8116 | /* make sure this block group isn't part of an allocation cluster */ |
| 8108 | cluster = &root->fs_info->data_alloc_cluster; | 8117 | cluster = &root->fs_info->data_alloc_cluster; |
| @@ -8143,6 +8152,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, | |||
| 8143 | spin_lock(&block_group->space_info->lock); | 8152 | spin_lock(&block_group->space_info->lock); |
| 8144 | block_group->space_info->total_bytes -= block_group->key.offset; | 8153 | block_group->space_info->total_bytes -= block_group->key.offset; |
| 8145 | block_group->space_info->bytes_readonly -= block_group->key.offset; | 8154 | block_group->space_info->bytes_readonly -= block_group->key.offset; |
| 8155 | block_group->space_info->disk_total -= block_group->key.offset * factor; | ||
| 8146 | spin_unlock(&block_group->space_info->lock); | 8156 | spin_unlock(&block_group->space_info->lock); |
| 8147 | 8157 | ||
| 8148 | btrfs_clear_space_info_full(root->fs_info); | 8158 | btrfs_clear_space_info_full(root->fs_info); |
