diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/ctree.h | 2 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 8302ecd4197f..9e21176cdf57 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -2157,6 +2157,8 @@ int btrfs_free_extent(struct btrfs_trans_handle *trans, | |||
2157 | u64 root_objectid, u64 owner, u64 offset); | 2157 | u64 root_objectid, u64 owner, u64 offset); |
2158 | 2158 | ||
2159 | int btrfs_free_reserved_extent(struct btrfs_root *root, u64 start, u64 len); | 2159 | int btrfs_free_reserved_extent(struct btrfs_root *root, u64 start, u64 len); |
2160 | int btrfs_update_reserved_bytes(struct btrfs_block_group_cache *cache, | ||
2161 | u64 num_bytes, int reserve, int sinfo); | ||
2160 | int btrfs_prepare_extent_commit(struct btrfs_trans_handle *trans, | 2162 | int btrfs_prepare_extent_commit(struct btrfs_trans_handle *trans, |
2161 | struct btrfs_root *root); | 2163 | struct btrfs_root *root); |
2162 | int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans, | 2164 | int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans, |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 7922f296420d..0671f5b77eb8 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -36,8 +36,6 @@ | |||
36 | static int update_block_group(struct btrfs_trans_handle *trans, | 36 | static int update_block_group(struct btrfs_trans_handle *trans, |
37 | struct btrfs_root *root, | 37 | struct btrfs_root *root, |
38 | u64 bytenr, u64 num_bytes, int alloc); | 38 | u64 bytenr, u64 num_bytes, int alloc); |
39 | static int update_reserved_bytes(struct btrfs_block_group_cache *cache, | ||
40 | u64 num_bytes, int reserve, int sinfo); | ||
41 | static int __btrfs_free_extent(struct btrfs_trans_handle *trans, | 39 | static int __btrfs_free_extent(struct btrfs_trans_handle *trans, |
42 | struct btrfs_root *root, | 40 | struct btrfs_root *root, |
43 | u64 bytenr, u64 num_bytes, u64 parent, | 41 | u64 bytenr, u64 num_bytes, u64 parent, |
@@ -4233,8 +4231,8 @@ int btrfs_pin_extent(struct btrfs_root *root, | |||
4233 | * update size of reserved extents. this function may return -EAGAIN | 4231 | * update size of reserved extents. this function may return -EAGAIN |
4234 | * if 'reserve' is true or 'sinfo' is false. | 4232 | * if 'reserve' is true or 'sinfo' is false. |
4235 | */ | 4233 | */ |
4236 | static int update_reserved_bytes(struct btrfs_block_group_cache *cache, | 4234 | int btrfs_update_reserved_bytes(struct btrfs_block_group_cache *cache, |
4237 | u64 num_bytes, int reserve, int sinfo) | 4235 | u64 num_bytes, int reserve, int sinfo) |
4238 | { | 4236 | { |
4239 | int ret = 0; | 4237 | int ret = 0; |
4240 | if (sinfo) { | 4238 | if (sinfo) { |
@@ -4714,10 +4712,10 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans, | |||
4714 | WARN_ON(test_bit(EXTENT_BUFFER_DIRTY, &buf->bflags)); | 4712 | WARN_ON(test_bit(EXTENT_BUFFER_DIRTY, &buf->bflags)); |
4715 | 4713 | ||
4716 | btrfs_add_free_space(cache, buf->start, buf->len); | 4714 | btrfs_add_free_space(cache, buf->start, buf->len); |
4717 | ret = update_reserved_bytes(cache, buf->len, 0, 0); | 4715 | ret = btrfs_update_reserved_bytes(cache, buf->len, 0, 0); |
4718 | if (ret == -EAGAIN) { | 4716 | if (ret == -EAGAIN) { |
4719 | /* block group became read-only */ | 4717 | /* block group became read-only */ |
4720 | update_reserved_bytes(cache, buf->len, 0, 1); | 4718 | btrfs_update_reserved_bytes(cache, buf->len, 0, 1); |
4721 | goto out; | 4719 | goto out; |
4722 | } | 4720 | } |
4723 | 4721 | ||
@@ -5206,7 +5204,7 @@ checks: | |||
5206 | search_start - offset); | 5204 | search_start - offset); |
5207 | BUG_ON(offset > search_start); | 5205 | BUG_ON(offset > search_start); |
5208 | 5206 | ||
5209 | ret = update_reserved_bytes(block_group, num_bytes, 1, | 5207 | ret = btrfs_update_reserved_bytes(block_group, num_bytes, 1, |
5210 | (data & BTRFS_BLOCK_GROUP_DATA)); | 5208 | (data & BTRFS_BLOCK_GROUP_DATA)); |
5211 | if (ret == -EAGAIN) { | 5209 | if (ret == -EAGAIN) { |
5212 | btrfs_add_free_space(block_group, offset, num_bytes); | 5210 | btrfs_add_free_space(block_group, offset, num_bytes); |
@@ -5432,7 +5430,7 @@ int btrfs_free_reserved_extent(struct btrfs_root *root, u64 start, u64 len) | |||
5432 | ret = btrfs_discard_extent(root, start, len); | 5430 | ret = btrfs_discard_extent(root, start, len); |
5433 | 5431 | ||
5434 | btrfs_add_free_space(cache, start, len); | 5432 | btrfs_add_free_space(cache, start, len); |
5435 | update_reserved_bytes(cache, len, 0, 1); | 5433 | btrfs_update_reserved_bytes(cache, len, 0, 1); |
5436 | btrfs_put_block_group(cache); | 5434 | btrfs_put_block_group(cache); |
5437 | 5435 | ||
5438 | trace_btrfs_reserved_extent_free(root, start, len); | 5436 | trace_btrfs_reserved_extent_free(root, start, len); |
@@ -5634,7 +5632,7 @@ int btrfs_alloc_logged_file_extent(struct btrfs_trans_handle *trans, | |||
5634 | put_caching_control(caching_ctl); | 5632 | put_caching_control(caching_ctl); |
5635 | } | 5633 | } |
5636 | 5634 | ||
5637 | ret = update_reserved_bytes(block_group, ins->offset, 1, 1); | 5635 | ret = btrfs_update_reserved_bytes(block_group, ins->offset, 1, 1); |
5638 | BUG_ON(ret); | 5636 | BUG_ON(ret); |
5639 | btrfs_put_block_group(block_group); | 5637 | btrfs_put_block_group(block_group); |
5640 | ret = alloc_reserved_file_extent(trans, root, 0, root_objectid, | 5638 | ret = alloc_reserved_file_extent(trans, root, 0, root_objectid, |